mypy-boto3-proton Type Stubs
Type annotations for boto3 Proton 1.42.3 service generated with mypy-boto3-builder 8.12.0. This library provides type stubs, not the actual `boto3` implementation, to enable static type checking for AWS Proton operations. It is frequently updated to align with `boto3` and `botocore` releases, often multiple times a month.
Warnings
- breaking Support for Python 3.8 was removed with the underlying `mypy-boto3-builder` version 8.12.0. Projects using `mypy-boto3` stubs will now require Python 3.9 or newer.
- breaking The `mypy-boto3-builder` (version 8.12.0) migrated to the PEP 561 package format. While generally seamless, if you have custom `mypy` configurations or non-standard module resolution, this change *could* impact stub discovery.
- breaking In `mypy-boto3-builder` version 8.9.0, TypeDef names for packed method arguments were shortened (e.g., `CreateDistributionRequestRequestTypeDef` to `CreateDistributionRequestTypeDef`). If you explicitly import these TypeDefs, your code may break upon upgrading.
- gotcha This package provides only type stubs for `boto3`. The actual `boto3` library must be installed and available at runtime for your code to function.
- gotcha For optimal type checking, it's crucial to align `mypy-boto3-proton`'s version with your `boto3` version. Mismatched versions can lead to incorrect type hints, missing attributes, or `mypy` errors if service APIs differ.
Install
-
pip install boto3 mypy-boto3-proton
Imports
- ProtonClient
from mypy_boto3_proton.client import ProtonClient
- Paginator
from mypy_boto3_proton.paginator import ListComponentsPaginator
- TypeDefs
from mypy_boto3_proton.type_defs import CreateEnvironmentInputRequestTypeDef
Quickstart
import boto3
from mypy_boto3_proton.client import ProtonClient
from mypy_boto3_proton.type_defs import ListEnvironmentsOutputTypeDef
# Ensure boto3 is installed: pip install boto3
# Ensure stubs are installed: pip install mypy-boto3-proton
def get_proton_environments(client: ProtonClient) -> ListEnvironmentsOutputTypeDef:
"""Lists Proton environments using a type-hinted client."""
response = client.list_environments()
return response
if __name__ == "__main__":
# Initialize a boto3 client (region may vary)
# Use a region where Proton is available, e.g., 'us-west-2'
boto3_client = boto3.client("proton", region_name="us-west-2")
# Type-hint the boto3 client with mypy-boto3-proton's Client
proton_client: ProtonClient = boto3_client
print("Listing Proton environments:")
try:
environments_data = get_proton_environments(proton_client)
for env in environments_data.get("environments", []):
print(f" Environment: {env['name']} ({env['arn']}) - {env['provisioning']}")
except Exception as e:
print(f"An error occurred: {e}")
print("Please ensure you have AWS credentials configured and Proton is available in 'us-west-2'.")