{"id":3076,"library":"mypy-boto3-docdb","title":"Type Annotations for boto3 DocDB","description":"This library provides type annotations for the AWS DocDB (DocumentDB) service client when using boto3. Generated with mypy-boto3-builder 8.12.0, `mypy-boto3-docdb` (current version 1.42.3) enhances static analysis, provides auto-completion in IDEs, and helps catch type-related errors before runtime. It releases in sync with boto3 versions.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","mypy","type-hints","docdb","database","stubs"],"install":[{"cmd":"pip install boto3 mypy-boto3-docdb mypy","lang":"bash","label":"Install with runtime dependency and type checker"}],"dependencies":[{"reason":"Runtime dependency for the AWS SDK for Python. `mypy-boto3-docdb` provides type hints for this library, but does not replace it.","package":"boto3","optional":false},{"reason":"Required to perform static type checking with the provided stubs.","package":"mypy","optional":true}],"imports":[{"note":"This is the type hint for the DocDB client returned by `boto3.client('docdb')`.","symbol":"DocDBClient","correct":"from mypy_boto3_docdb.client import DocDBClient"},{"note":"Import TypedDicts for specific API call responses to enable precise type checking of return values.","symbol":"DescribeDBInstancesResponseTypeDef","correct":"from mypy_boto3_docdb.type_defs import DescribeDBInstancesResponseTypeDef"}],"quickstart":{"code":"from typing import TYPE_CHECKING\nimport boto3\n\nif TYPE_CHECKING:\n    from mypy_boto3_docdb.client import DocDBClient\n    from mypy_boto3_docdb.type_defs import DescribeDBInstancesResponseTypeDef\n\n\ndef get_docdb_instances() -> \"DescribeDBInstancesResponseTypeDef\":\n    # The type hint 'DocDBClient' is picked up by mypy and IDEs.\n    # At runtime, you still get the regular boto3 client.\n    client: DocDBClient = boto3.client(\"docdb\")\n    response = client.describe_db_instances()\n    print(f\"Found {len(response['DBInstances'])} DocDB instances.\")\n    return response\n\nif __name__ == \"__main__\":\n    # This example requires AWS credentials configured (e.g., via AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY\n    # or ~/.aws/credentials) to run successfully against a real AWS account.\n    try:\n        instances_data = get_docdb_instances()\n        # Further processing with type-checked 'instances_data'\n    except Exception as e:\n        print(f\"Error describing DocDB instances: {e}\")","lang":"python","description":"This example demonstrates how to use `mypy-boto3-docdb` for type hinting a `boto3` DocDB client. It explicitly imports `DocDBClient` and `DescribeDBInstancesResponseTypeDef` under a `TYPE_CHECKING` guard, ensuring they are only used during static analysis and do not add runtime dependencies. The `boto3.client('docdb')` call is type-hinted, enabling autocompletion and type validation for DocDB-specific methods and their responses."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or higher. If you must use Python 3.8, pin `mypy-boto3-docdb` to a version older than 8.12.0 (e.g., `<8.12.0`).","message":"Support for Python 3.8 has been removed across all packages generated by `mypy-boto3-builder`, including `mypy-boto3-docdb` versions 8.12.0 and above.","severity":"breaking","affected_versions":"8.12.0+"},{"fix":"Ensure your type checker (e.g., Mypy) is updated to a recent version that fully supports PEP 561. Standard `pip install` usage should generally be unaffected.","message":"`mypy-boto3` packages migrated to PEP 561. While this improves how type checkers find stubs, it might affect complex build setups or older type checker versions.","severity":"breaking","affected_versions":"8.12.0+"},{"fix":"Install `boto3` (e.g., `pip install boto3`) as a runtime dependency and `mypy-boto3-docdb` as a development dependency (e.g., `pip install mypy-boto3-docdb`).","message":"`mypy-boto3-docdb` provides *only* type stubs. It does not include the `boto3` runtime library itself. Your application still requires `boto3` to be installed and available at runtime.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Update your type annotations to reflect the new, shorter TypeDef names for method arguments as per the latest stub definitions. Refer to the specific `mypy-boto3-docdb` documentation for updated names.","message":"TypeDef names for method arguments may have been shortened (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`). This can break existing explicit type annotations.","severity":"breaking","affected_versions":"8.9.0+"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}