{"id":3142,"library":"mypy-boto3-servicecatalog","title":"mypy-boto3-servicecatalog: ServiceCatalog Type Annotations","description":"mypy-boto3-servicecatalog provides comprehensive type annotations for the `boto3` ServiceCatalog service, enhancing static analysis, autocompletion, and error detection for `boto3` code. It is currently at version 1.42.3 and is generated by the `mypy-boto3-builder` to align with `boto3` releases, ensuring up-to-date type definitions.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["mypy","boto3","aws","type-hints","servicecatalog","stubs"],"install":[{"cmd":"pip install mypy-boto3-servicecatalog","lang":"bash","label":"Standalone package"},{"cmd":"pip install 'boto3-stubs[servicecatalog]'","lang":"bash","label":"Integrated with boto3-stubs"}],"dependencies":[{"reason":"This package provides type stubs for `boto3`. `boto3` itself is a runtime dependency for the actual AWS SDK operations.","package":"boto3","optional":true}],"imports":[{"symbol":"ServiceCatalogClient","correct":"from mypy_boto3_servicecatalog.client import ServiceCatalogClient"},{"note":"For explicit type hints of API call parameters.","symbol":"AcceptPortfolioShareInputTypeDef","correct":"from mypy_boto3_servicecatalog.type_defs import AcceptPortfolioShareInputTypeDef"},{"note":"For explicit type hints of literal values.","symbol":"AccessLevelFilterKeyType","correct":"from mypy_boto3_servicecatalog.literals import AccessLevelFilterKeyType"}],"quickstart":{"code":"import boto3\nfrom typing import TYPE_CHECKING\n\nif TYPE_CHECKING:\n    from mypy_boto3_servicecatalog.client import ServiceCatalogClient\n    from mypy_boto3_servicecatalog.type_defs import SearchProductsOutputTypeDef\n\ndef list_servicecatalog_products() -> list[str]:\n    \"\"\"Lists Service Catalog products with type hints.\"\"\"\n    # boto3 client is dynamically typed at runtime, stubs provide static types\n    client: ServiceCatalogClient = boto3.client(\"servicecatalog\")\n    \n    response: SearchProductsOutputTypeDef = client.search_products()\n    product_names = []\n    for product_view in response.get('ProductViewAggregations', []):\n        if 'ProductViewSummary' in product_view and 'Name' in product_view['ProductViewSummary']:\n            product_names.append(product_view['ProductViewSummary']['Name'])\n    return product_names\n\nif __name__ == \"__main__\":\n    print(\"Attempting to list Service Catalog products (requires AWS credentials)...\")\n    try:\n        products = list_servicecatalog_products()\n        if products:\n            print(f\"Found {len(products)} products:\")\n            for product in products:\n                print(f\"- {product}\")\n        else:\n            print(\"No Service Catalog products found.\")\n    except Exception as e:\n        print(f\"Error listing products: {e}\")\n","lang":"python","description":"This quickstart demonstrates how to use `mypy-boto3-servicecatalog` to add type hints to a `boto3` ServiceCatalog client. It defines a function that lists Service Catalog products, explicitly typing the client and response objects to leverage static analysis. The `TYPE_CHECKING` block ensures the stubs are only loaded during static analysis, not at runtime."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer.","message":"Python 3.8 support was removed for all `mypy-boto3` packages (including `mypy-boto3-servicecatalog`) starting with `mypy-boto3-builder` version 8.12.0. Projects using Python 3.8 or older will need to upgrade their Python version.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.12.0"},{"fix":"Review and update explicit `TypeDef` imports and usage according to the new naming conventions.","message":"In `mypy-boto3-builder` version 8.9.0, some `TypeDef` names for method arguments were shortened (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`). Conflicting `Extra` postfixes were also moved to the end. This may require updating explicit `TypeDef` imports.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.9.0"},{"fix":"Ensure you are installing and using `boto3` for actual runtime operations. The `mypy-boto3-servicecatalog` package is only for type checkers (like mypy, pyright) and IDEs.","message":"`mypy-boto3-servicecatalog` provides type stubs for `boto3` and should not be used as a runtime dependency or for importing classes directly for runtime execution. It is intended solely for static type checking.","severity":"gotcha","affected_versions":"All versions"},{"fix":"To fix this, you can set all typed variables to `object` in the `else` block of your `TYPE_CHECKING` conditional, or disable the specific Pylint warning.","message":"When using `mypy-boto3` stubs with Pylint, it might complain about undefined variables within `if TYPE_CHECKING:` blocks.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}