Registry /
type-stubs / mypy-boto3-cloudcontrol
mypy-boto3-cloudcontrol provides type annotations for the AWS boto3 CloudControlApi service. It is part of the larger `mypy-boto3-builder` ecosystem, which generates stubs for all boto3 services. This specific package, currently at version 1.42.3, helps static type checkers like Mypy understand the dynamic nature of boto3 clients, offering improved code completion, error detection, and overall developer experience for Cloud Control API interactions. The builder project releases frequently, often synchronizing with `boto3` and `botocore` updates.
Install & Compatibility
Where this runs
tested against v1.43.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
The `boto3` library does not expose directly typed client classes. `mypy-boto3-cloudcontrol` provides the static type definition for type checkers. Imports of type definitions are typically guarded by `if TYPE_CHECKING:` to avoid runtime dependency.
from mypy_boto3_cloudcontrol.client import CloudControlClient
Type definitions for response structures and request parameters are available in the `type_defs` submodule.
from mypy_boto3_cloudcontrol.type_defs import ResourceDescriptionTypeDef
This quickstart demonstrates how to use `mypy-boto3-cloudcontrol` for type hinting an AWS Cloud Control API client. It shows importing the `CloudControlClient` type within a `TYPE_CHECKING` block to ensure `mypy-boto3-cloudcontrol` is only a development dependency. The `boto3` runtime client is then instantiated and passed to a function with explicit type hints, enabling static analysis by `mypy`.
from typing import TYPE_CHECKING
import boto3
import os
# Only import type stubs when type checking
if TYPE_CHECKING:
from mypy_boto3_cloudcontrol.client import CloudControlClient
from mypy_boto3_cloudcontrol.type_defs import ListResourcesOutputTypeDef
def list_cloud_control_resources(client: 'CloudControlClient') -> 'ListResourcesOutputTypeDef':
"""Lists resources managed by AWS Cloud Control API."""
# Example: List up to 10 resources of a specific type
# Replace 'AWS::S3::Bucket' with an actual resource type if needed
response = client.list_resources(
TypeName='AWS::S3::Bucket', # Use a valid AWS resource type
MaxResults=10
)
print(f"Found {len(response.get('ResourceDescriptions', []))} resources.")
for resource in response.get('ResourceDescriptions', []):
print(f" - ID: {resource.get('Identifier')}, Name: {resource.get('ResourceModel')}")
return response
if __name__ == "__main__":
# Ensure AWS credentials are configured (e.g., via environment variables or AWS CLI)
# This is a runtime client, not directly from mypy-boto3-cloudcontrol
session = boto3.Session(
aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', ''),
aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', ''),
aws_session_token=os.environ.get('AWS_SESSION_TOKEN', ''),
region_name=os.environ.get('AWS_REGION', 'us-east-1')
)
cloudcontrol_client: 'CloudControlClient' = session.client("cloudcontrol")
try:
list_cloud_control_resources(cloudcontrol_client)
except Exception as e:
print(f"An error occurred: {e}")
print("Make sure 'AWS::S3::Bucket' (or chosen TypeName) is a valid and accessible resource type.")
# To run mypy:
# mypy your_script_name.py
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.