{"id":3042,"library":"mypy-boto3-cloudcontrol","title":"mypy-boto3-cloudcontrol: Type Annotations for AWS Cloud Control API","description":"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.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["type hinting","mypy","boto3","aws","cloudcontrol","stubs","static analysis"],"install":[{"cmd":"pip install mypy-boto3-cloudcontrol boto3 mypy","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Provides the runtime functionality for interacting with AWS services. `mypy-boto3-cloudcontrol` only provides type stubs, not the actual client implementation.","package":"boto3"},{"reason":"The primary static type checker that utilizes these type stubs to perform type analysis.","package":"mypy"}],"imports":[{"note":"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.","wrong":"from boto3.client import CloudControlClient","symbol":"CloudControlClient","correct":"from mypy_boto3_cloudcontrol.client import CloudControlClient"},{"note":"Type definitions for response structures and request parameters are available in the `type_defs` submodule.","symbol":"ResourceDescriptionTypeDef","correct":"from mypy_boto3_cloudcontrol.type_defs import ResourceDescriptionTypeDef"}],"quickstart":{"code":"from typing import TYPE_CHECKING\nimport boto3\nimport os\n\n# Only import type stubs when type checking\nif TYPE_CHECKING:\n    from mypy_boto3_cloudcontrol.client import CloudControlClient\n    from mypy_boto3_cloudcontrol.type_defs import ListResourcesOutputTypeDef\n\n\ndef list_cloud_control_resources(client: 'CloudControlClient') -> 'ListResourcesOutputTypeDef':\n    \"\"\"Lists resources managed by AWS Cloud Control API.\"\"\"\n    # Example: List up to 10 resources of a specific type\n    # Replace 'AWS::S3::Bucket' with an actual resource type if needed\n    response = client.list_resources(\n        TypeName='AWS::S3::Bucket', # Use a valid AWS resource type\n        MaxResults=10\n    )\n    print(f\"Found {len(response.get('ResourceDescriptions', []))} resources.\")\n    for resource in response.get('ResourceDescriptions', []):\n        print(f\"  - ID: {resource.get('Identifier')}, Name: {resource.get('ResourceModel')}\")\n    return response\n\nif __name__ == \"__main__\":\n    # Ensure AWS credentials are configured (e.g., via environment variables or AWS CLI)\n    # This is a runtime client, not directly from mypy-boto3-cloudcontrol\n    session = boto3.Session(\n        aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', ''),\n        aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', ''),\n        aws_session_token=os.environ.get('AWS_SESSION_TOKEN', ''),\n        region_name=os.environ.get('AWS_REGION', 'us-east-1')\n    )\n    cloudcontrol_client: 'CloudControlClient' = session.client(\"cloudcontrol\")\n    \n    try:\n        list_cloud_control_resources(cloudcontrol_client)\n    except Exception as e:\n        print(f\"An error occurred: {e}\")\n        print(\"Make sure 'AWS::S3::Bucket' (or chosen TypeName) is a valid and accessible resource type.\")\n\n# To run mypy:\n# mypy your_script_name.py","lang":"python","description":"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`."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or higher. For older Python versions, pin `mypy-boto3-builder` and generated stub packages to versions prior to 8.12.0.","message":"Python 3.8 support was removed starting with `mypy-boto3-builder` version 8.12.0 (and thus for generated packages like `mypy-boto3-cloudcontrol`). Projects using Python 3.8 will need to upgrade to Python 3.9 or newer.","severity":"breaking","affected_versions":">=8.12.0 of mypy-boto3-builder (and corresponding stub package versions)"},{"fix":"Ensure your `mypy` and `pip` versions are up-to-date. If issues arise with type discovery, consult the `mypy-boto3-builder` documentation for any specific `mypy` configuration changes or package root settings.","message":"The builder migrated to PEP 561 compatible packages in version 8.12.0. While this is generally an improvement for type checker discovery, it's a significant packaging change that might affect build systems or older `mypy` versions.","severity":"breaking","affected_versions":">=8.12.0 of mypy-boto3-builder (and corresponding stub package versions)"},{"fix":"Update explicit imports of TypeDefs to reflect the new naming conventions. This primarily impacts users who directly import TypeDefs by their full names.","message":"TypeDef naming conventions changed in `mypy-boto3-builder` version 8.9.0. Specifically, redundant 'Request' suffixes were removed (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`), and conflicting 'Extra' postfixes were moved (e.g., `CreateDistributionExtraRequestTypeDef` became `CreateDistributionRequestExtraTypeDef`).","severity":"breaking","affected_versions":">=8.9.0 of mypy-boto3-builder (and corresponding stub package versions)"},{"fix":"Always install `boto3` alongside `mypy-boto3-cloudcontrol`. Wrap explicit type imports (e.g., `from mypy_boto3_cloudcontrol.client import CloudControlClient`) within an `if TYPE_CHECKING:` block to keep `mypy-boto3-cloudcontrol` as a development-only dependency.","message":"`mypy-boto3-cloudcontrol` provides only type annotations; it is not a runtime dependency. You must still install and use the `boto3` library for actual AWS interactions. Importing `mypy-boto3` types directly without `if TYPE_CHECKING:` can make it an unnecessary runtime dependency.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}