Type Annotations for boto3 AppRegistry
mypy-boto3-servicecatalog-appregistry provides PEP 561 compliant type annotations for the AWS AppRegistry service client in boto3. It helps developers leverage static type checking with tools like mypy, ensuring correctness and improving autocompletion for boto3 interactions. The current version is 1.42.3, generated by mypy-boto3-builder 8.12.0, with frequent releases synchronised with boto3 updates.
Warnings
- breaking Dropped support for Python 3.8. Packages generated with `mypy-boto3-builder` version 8.12.0 and newer (including this package) now require Python 3.9 or higher.
- breaking TypeDef naming conventions changed in builder version 8.9.0. Argument TypeDefs might have shorter names (e.g., `CreateRequestRequestTypeDef` -> `CreateRequestTypeDef`), and `Extra` postfixes were moved (e.g., `CreateExtraRequestTypeDef` -> `CreateRequestExtraTypeDef`).
- gotcha Migration to PEP 561 compliance. While generally an improvement, some older type-checking setups or tools might require updates to correctly discover and utilize the type stubs.
- gotcha Legacy `mypy-boto3` packages (pre-8.9.0 builder) were merged into `boto3-stubs`. If you're upgrading from very old `mypy-boto3` versions, ensure you're installing the correct new `mypy-boto3-*` package structure.
- gotcha AWS service names can change or be deprecated (e.g., `sms-voice` was replaced by `pinpoint-sms-voice`). This means the corresponding `mypy-boto3` package name will also change, requiring updates to your dependencies and imports.
Install
-
pip install mypy-boto3-servicecatalog-appregistry boto3 mypy
Imports
- AppRegistryClient
from mypy_boto3_servicecatalog_appregistry.client import AppRegistryClient
- AppRegistryServiceResource
from mypy_boto3_servicecatalog_appregistry.service_resource import AppRegistryServiceResource
- ApplicationSummaryTypeDef
from mypy_boto3_servicecatalog_appregistry.type_defs import ApplicationSummaryTypeDef
Quickstart
import boto3
from mypy_boto3_servicecatalog_appregistry.client import AppRegistryClient
from typing import TYPE_CHECKING
# For advanced type checking of response objects
if TYPE_CHECKING:
from mypy_boto3_servicecatalog_appregistry.type_defs import CreateApplicationResponseTypeDef
def create_example_application(app_name: str, app_description: str):
# boto3 client is untyped by default
client = boto3.client(
"servicecatalog-appregistry",
aws_access_key_id="AKIATEST", # Using dummy creds for example
aws_secret_access_key="SECRET",
region_name="us-east-1"
)
# Type hint the client for mypy
typed_client: AppRegistryClient = client
# With the typed_client, autocompletion and type checking work
response = typed_client.create_application(
name=app_name,
description=app_description
)
# TYPE_CHECKING guard ensures this import is only for static analysis
if TYPE_CHECKING:
response_typed: CreateApplicationResponseTypeDef = response
print(f"Application ID: {response_typed['application']['id']}")
else:
print(f"Application ID: {response['application']['id']}")
# To run this example, replace dummy creds and provide a unique application name
# create_example_application("MyUniqueApp", "Managed by mypy-boto3 example")