mypy-boto3-route53 Type Annotations
mypy-boto3-route53 provides comprehensive type annotations for the Amazon Route53 service client in `boto3`. It enhances development with static type checking, autocompletion, and improved readability for AWS interactions. The current version is 1.42.6, generated with `mypy-boto3-builder 8.12.0`, and it typically releases new versions in sync with `boto3` and `botocore` updates.
Warnings
- breaking Support for Python 3.8 has been removed across all `mypy-boto3-builder` generated packages. Projects still on Python 3.8 will encounter compatibility errors.
- breaking TypeDef naming conventions were changed in `mypy-boto3-builder`, resulting in shorter or re-ordered names for some type definitions. This will break code that explicitly imports or references `TypeDef` objects by their old names.
- gotcha These stubs are generated for specific `boto3` and `botocore` versions. Using a significantly different version of `boto3` can lead to discrepancies between the actual runtime behavior and the provided type hints, resulting in `mypy` errors or incorrect assumptions.
- gotcha The `mypy-boto3-builder` ecosystem transitioned to PEP 561 compliance in version 8.12.0. While largely transparent, this could affect type checker discovery in complex setups or when using custom `MYPYPATH` configurations.
Install
-
pip install mypy-boto3-route53 -
pip install boto3-stubs[route53]
Imports
- Route53Client
from mypy_boto3_route53.client import Route53Client
- ListHostedZonesResponseTypeDef
from mypy_boto3_route53.type_defs import ListHostedZonesResponseTypeDef
Quickstart
import boto3
from mypy_boto3_route53 import Route53Client
from mypy_boto3_route53.type_defs import ListHostedZonesResponseTypeDef
def get_hosted_zones() -> ListHostedZonesResponseTypeDef:
# boto3.client is untyped by default
client: Route53Client = boto3.client("route53")
response: ListHostedZonesResponseTypeDef = client.list_hosted_zones()
print(f"Found {len(response.get('HostedZones', []))} hosted zones.")
for zone in response.get('HostedZones', []):
print(f" - {zone.get('Name')} ({zone.get('Id')})")
return response
if __name__ == "__main__":
get_hosted_zones()