mypy-boto3-route53profiles - Type Annotations for AWS Route53Profiles
mypy-boto3-route53profiles provides comprehensive type annotations for the `boto3` Route53Profiles service client. This library enables static analysis tools like `mypy` to perform rigorous type checking, offering improved developer experience through better auto-completion and early error detection for AWS SDK interactions. It is built using `mypy-boto3-builder` and typically updates in alignment with `boto3` releases.
Warnings
- breaking Python 3.8 support was removed starting with `mypy-boto3-builder 8.12.0`. All `mypy-boto3-*` packages generated with this builder version or later no longer support Python 3.8.
- breaking Some `TypeDef` naming conventions changed with `mypy-boto3-builder 8.9.0`. Specifically, names for packed method arguments became shorter (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`), and conflicting `Extra` postfixes were moved (e.g., `CreateDistributionExtraRequestTypeDef` -> `CreateDistributionRequestExtraTypeDef`).
- gotcha This library provides type stubs only. For your code to function at runtime, you must have the actual `boto3` library installed.
- gotcha To ensure accurate type checking, the version of `mypy-boto3-route53profiles` should ideally match the major and minor version of your installed `boto3` library. Mismatched versions can lead to incorrect type hints for new or changed `boto3` features.
Install
-
pip install mypy-boto3-route53profiles
Imports
- Route53ProfilesClient
from mypy_boto3_route53profiles.client import Route53ProfilesClient
- ListProfileAssociationsOutputTypeDef
from mypy_boto3_route53profiles.type_defs import ListProfileAssociationsOutputTypeDef
Quickstart
import boto3
from mypy_boto3_route53profiles.client import Route53ProfilesClient
from mypy_boto3_route53profiles.type_defs import ListProfileAssociationsOutputTypeDef
def get_profile_associations() -> ListProfileAssociationsOutputTypeDef:
# In a real application, boto3 will automatically pick up credentials
# from environment variables, ~/.aws/credentials, or IAM roles.
# For local testing, ensure your AWS credentials are configured.
client: Route53ProfilesClient = boto3.client("route53profiles")
response = client.list_profile_associations(
MaxResults=5 # Example optional parameter
)
print(f"Found {len(response.get('ProfileAssociations', []))} profile associations.")
# Mypy will ensure 'response' has methods like .get() for 'ProfileAssociations'
# and that 'ProfileAssociations' contains correctly typed dicts.
return response
if __name__ == "__main__":
# To run this code, ensure AWS credentials are set up for boto3.
# For type checking only, you don't need active credentials.
print("This quickstart demonstrates type hinting for boto3's Route53Profiles client.")
print("Run `mypy your_script_name.py` to see the type checking in action.")
# Example of mypy benefits:
client_typed: Route53ProfilesClient = boto3.client("route53profiles")
# client_typed.non_existent_method() # Mypy would flag this as an error
# client_typed.list_profile_associations(InvalidParam=True) # Mypy would flag this