{"id":3043,"library":"mypy-boto3-clouddirectory","title":"Mypy Boto3 CloudDirectory - Type Annotations","description":"mypy-boto3-clouddirectory provides type annotations for the AWS boto3 CloudDirectory service. It ensures static type checking with tools like mypy, enhancing code quality and developer experience for Python applications interacting with AWS CloudDirectory. The project's builder (`mypy-boto3-builder`) releases frequently, typically in sync with new boto3/botocore versions.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["python","type-hints","mypy","boto3","aws","cloud","clouddirectory","stubs"],"install":[{"cmd":"pip install mypy-boto3-clouddirectory boto3","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Provides the core AWS SDK functionality that these type stubs annotate.","package":"boto3"}],"imports":[{"symbol":"CloudDirectoryClient","correct":"from mypy_boto3_clouddirectory.client import CloudDirectoryClient"},{"symbol":"ListDirectoriesResponseTypeDef","correct":"from mypy_boto3_clouddirectory.type_defs import ListDirectoriesResponseTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_clouddirectory.client import CloudDirectoryClient\nfrom mypy_boto3_clouddirectory.type_defs import ListDirectoriesResponseTypeDef\n\n\ndef list_clouddirectory_stuff() -> ListDirectoriesResponseTypeDef:\n    # Initialize a CloudDirectory client with type hints\n    client: CloudDirectoryClient = boto3.client(\"clouddirectory\")\n\n    # Call an API operation; mypy will check arguments and return types\n    response: ListDirectoriesResponseTypeDef = client.list_directories(\n        MaxResults=5\n    )\n    \n    print(f\"Found {len(response.get('Directories', []))} directories.\")\n    # Example of accessing type-hinted data\n    for directory in response.get('Directories', []):\n        print(f\"  - Directory ARN: {directory['DirectoryArn']}\")\n    return response\n\nif __name__ == \"__main__\":\n    # This code requires AWS credentials configured (e.g., via AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY env vars)\n    # or a configured AWS CLI profile.\n    # If no credentials are found, boto3 will raise a ClientError.\n    try:\n        list_clouddirectory_stuff()\n    except Exception as e:\n        print(f\"An error occurred: {e}\")\n        print(\"Please ensure AWS credentials are configured (e.g., ~/.aws/credentials or environment variables).\")","lang":"python","description":"This quickstart demonstrates how to instantiate a boto3 CloudDirectory client with explicit type annotations using `mypy-boto3-clouddirectory`. It then calls `list_directories` and accesses the type-hinted response data, showing how the stub types improve code completion and static analysis."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or higher.","message":"Support for Python 3.8 has been removed in `mypy-boto3-builder` version 8.12.0 and later. Projects using this library must use Python 3.9 or newer.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.12.0"},{"fix":"Ensure your build and type-checking environments are updated to correctly resolve PEP 561 packages. Most modern tools should handle this automatically.","message":"The `mypy-boto3-builder` migrated to PEP 561 compliant packages in version 8.12.0. This might affect how packages are discovered or handled by some tools, especially in complex project setups.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.12.0"},{"fix":"Review and update explicit `TypeDef` annotations in your codebase to match the new naming conventions, or rely on implicit type inference where possible.","message":"TypeDef naming conventions changed in `mypy-boto3-builder` version 8.9.0. Specifically, redundant `Request` postfixes were removed (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`), and `Extra` postfixes moved to the end of names. This could break existing explicit type annotations in your code.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.9.0"},{"fix":"Migrate your code and type annotations from the `sms-voice` service to the `pinpoint-sms-voice` service stubs.","message":"The `sms-voice` service was removed from `mypy-boto3-builder` in version 8.11.0. If your project uses type annotations for this service, you should migrate to `pinpoint-sms-voice`.","severity":"deprecated","affected_versions":"mypy-boto3-builder >=8.11.0"},{"fix":"Consider installing `boto3-stubs-lite[clouddirectory]` (if available for the specific service) or disabling PyCharm's internal type checker and using `mypy` or `pyright` instead for type analysis.","message":"PyCharm users might experience slow performance or high CPU usage due to `Literal` overloads when using the full `boto3-stubs` or standalone `mypy-boto3-*` packages. The `boto3-stubs-lite` versions are recommended as a workaround until the upstream PyCharm issue is resolved.","severity":"gotcha","affected_versions":"All versions, specifically with PyCharm"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}