mypy-boto3-route53-recovery-control-config Type Annotations
This library provides type annotations for the `boto3` AWS SDK's Route53RecoveryControlConfig service, compatible with static analysis tools like mypy, pyright, and various IDEs. Currently at version `1.42.3`, it helps improve code quality and error detection for `boto3` usage. The release cadence is tied to updates in `boto3` itself and the `mypy-boto3-builder` project, which generates these stubs.
Warnings
- breaking Starting with `mypy-boto3-builder` version 8.12.0 (which generated this package), support for Python 3.8 has been removed. Projects using this package must use Python 3.9 or newer.
- breaking In `mypy-boto3-builder` version 8.9.0, there were changes to `TypeDef` naming conventions to be more concise (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`). While this specific example might not apply directly to all services, be aware that `TypeDef` names for inputs/outputs across services might have changed in this or subsequent `mypy-boto3-builder` versions.
- gotcha This package provides only type stubs and does not include any runtime code for the AWS SDK. You must separately install and use the `boto3` library for your application to function correctly.
- gotcha The `mypy-boto3` packages are PEP 561 compliant, meaning type checkers like `mypy` and `pyright` should automatically discover them. However, for optimal type checking and IDE integration, ensure your type checker is correctly configured (e.g., `mypy` with `strict=True` in `pyproject.toml` or `mypy.ini`).
Install
-
pip install mypy-boto3-route53-recovery-control-config boto3
Imports
- Route53RecoveryControlConfigClient
from mypy_boto3_route53_recovery_control_config.client import Route53RecoveryControlConfigClient
- ListClustersOutputTypeDef
from mypy_boto3_route53_recovery_control_config.type_defs import ListClustersOutputTypeDef
Quickstart
import boto3
import os
from mypy_boto3_route53_recovery_control_config.client import Route53RecoveryControlConfigClient
from mypy_boto3_route53_recovery_control_config.type_defs import ListClustersOutputTypeDef
def get_r53_recovery_control_config_client() -> Route53RecoveryControlConfigClient:
"""Returns a type-hinted Route53RecoveryControlConfig client."""
# Ensure AWS credentials and region are configured (e.g., via environment variables or ~/.aws/credentials)
region_name = os.environ.get('AWS_REGION', 'us-east-1')
return boto3.client('route53-recovery-control-config', region_name=region_name)
def list_r53_recovery_clusters() -> ListClustersOutputTypeDef:
"""Lists Route53 Recovery Control Config clusters with type hints."""
client = get_r53_recovery_control_config_client()
response: ListClustersOutputTypeDef = client.list_clusters()
for cluster in response.get('Clusters', []):
print(f"Cluster ARN: {cluster['ClusterArn']}, Name: {cluster['ClusterName']}")
return response
if __name__ == '__main__':
try:
print("Listing Route53 Recovery Control Config clusters...")
result = list_r53_recovery_clusters()
print(f"Successfully listed {len(result.get('Clusters', []))} clusters.")
except Exception as e:
print(f"An error occurred: {e}")
print("Please ensure 'boto3' is installed and AWS credentials/region are configured.")