Type Annotations for boto3 Route53RecoveryCluster
This library provides comprehensive type annotations for the `boto3` AWS SDK's Route53RecoveryCluster service (version 1.42.3), generated by `mypy-boto3-builder` 8.12.0. It enhances development with static type checking, autocompletion, and early error detection for `boto3` calls related to Route53RecoveryCluster. The project is actively maintained, with new versions frequently released, often in sync with `boto3` updates and `mypy-boto3-builder` enhancements.
Warnings
- breaking Python 3.8 support was removed with `mypy-boto3-builder` version 8.12.0. Users on Python 3.8 or older must upgrade their Python environment to `3.9` or higher to continue receiving updates for `mypy-boto3` packages.
- breaking `mypy-boto3-builder` (from which this package is generated) migrated to PEP 561 compliant packages in version 8.12.0. This changes how stub files are distributed and discovered, potentially impacting complex build setups or custom stub path configurations.
- breaking Starting with `mypy-boto3-builder` 8.9.0, `TypeDef` naming conventions changed. This includes shortening names for packed method arguments (e.g., `RequestRequestTypeDef` -> `RequestTypeDef`) and moving `Extra` postfixes. This can lead to `NameError` or incorrect type hints if you directly import or refer to these `TypeDef`s by their old names.
- gotcha For optimal autocompletion and robust type checking, especially within IDEs like VSCode or PyCharm, it's often recommended to explicitly annotate the type of the `boto3` client (e.g., `client: Route53RecoveryClusterClient = boto3.client(...)`) rather than relying solely on implicit type inference.
- gotcha When conditionally importing `mypy-boto3` types using `if TYPE_CHECKING:`, `pylint` might report 'Undefined variable' errors in the `else` branch.
Install
-
pip install mypy-boto3-route53-recovery-cluster
Imports
- Route53RecoveryClusterClient
from mypy_boto3_route53_recovery_cluster.client import Route53RecoveryClusterClient
- DescribeRecoveryGroupResponseTypeDef
from mypy_boto3_route53_recovery_cluster.type_defs import DescribeRecoveryGroupResponseTypeDef
- Route53RecoveryClusterServiceName
from mypy_boto3_route53_recovery_cluster.literals import Route53RecoveryClusterServiceName
Quickstart
import boto3
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from mypy_boto3_route53_recovery_cluster.client import Route53RecoveryClusterClient
from mypy_boto3_route53_recovery_cluster.type_defs import ListClustersResponseTypeDef
def get_recovery_cluster_info() -> ListClustersResponseTypeDef:
# It's recommended to explicitly type the client for best autocompletion and type checking.
client: Route53RecoveryClusterClient = boto3.client(
"route53-recovery-cluster",
region_name="us-east-1", # Replace with your region
aws_access_key_id="AKIATEST", # Use os.environ.get('AWS_ACCESS_KEY_ID', '') in real code
aws_secret_access_key="SECRETLONGKEY", # Use os.environ.get('AWS_SECRET_ACCESS_KEY', '')
aws_session_token="SESSIONTOKEN" # Use os.environ.get('AWS_SESSION_TOKEN', '') if applicable
)
response = client.list_clusters()
print(f"Clusters: {response.get('Clusters')}")
return response
if __name__ == "__main__":
# This part would typically run in a properly configured AWS environment
# For this example, we'll just print a placeholder as credentials are not live
print("--- Mocking AWS client call for quickstart ---")
if TYPE_CHECKING:
result = get_recovery_cluster_info()
print(f"Mocked Cluster List (Type-checked): {result.get('Clusters')}")
else:
print("Run mypy to check types. Actual execution requires AWS credentials.")