{"id":3572,"library":"mypy-boto3-docdb-elastic","title":"mypy-boto3-docdb-elastic","description":"mypy-boto3-docdb-elastic provides type annotations for the boto3 DocDBElastic service. It ensures static type checking with tools like MyPy, offering improved code quality and developer experience for AWS DocumentDB Elastic Clusters interactions. The current version is 1.42.3, generated with mypy-boto3-builder 8.12.0, and new versions are released in sync with boto3 updates.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["mypy","boto3","aws","type-hints","docdb-elastic","amazon-documentdb"],"install":[{"cmd":"pip install mypy-boto3-docdb-elastic boto3 mypy","lang":"bash","label":"Install standalone stubs with boto3 and mypy"},{"cmd":"pip install 'boto3-stubs[docdb-elastic]' boto3 mypy","lang":"bash","label":"Install integrated boto3-stubs with service extras"}],"dependencies":[{"reason":"Runtime library for AWS SDK interactions, type annotations are provided for it.","package":"boto3"},{"reason":"Static type checker that consumes these type annotations.","package":"mypy"}],"imports":[{"symbol":"DocDBElasticClient","correct":"from mypy_boto3_docdb_elastic import DocDBElasticClient"},{"symbol":"ListClustersPaginator","correct":"from mypy_boto3_docdb_elastic.paginators import ListClustersPaginator"},{"symbol":"ApplyMethodType","correct":"from mypy_boto3_docdb_elastic.literals import ApplyMethodType"},{"note":"Type definition names can change between major builder versions, verify against the specific package documentation for your version.","wrong":"from mypy_boto3_docdb_elastic.type_defs import ListClustersOutputTypeDef","symbol":"ClusterListTypeDef","correct":"from mypy_boto3_docdb_elastic.type_defs import ClusterListTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_docdb_elastic import DocDBElasticClient\nfrom typing import TYPE_CHECKING\n\n# Ensure AWS credentials are configured (e.g., via environment variables or ~/.aws/credentials)\n# For local execution, you might mock credentials or ensure they're available.\n# For example, using environment variables:\n# os.environ['AWS_ACCESS_KEY_ID'] = 'YOUR_ACCESS_KEY'\n# os.environ['AWS_SECRET_ACCESS_KEY'] = 'YOUR_SECRET_KEY'\n# os.environ['AWS_REGION'] = 'us-east-1'\n\nif TYPE_CHECKING:\n    client: DocDBElasticClient = boto3.client('docdb-elastic')\nelse:\n    client = boto3.client('docdb-elastic')\n\ntry:\n    # Example: List DocumentDB Elastic clusters\n    response = client.list_clusters(\n        maxResults=10\n    )\n    print(f\"Successfully listed {len(response.get('Clusters', []))} clusters.\")\n    for cluster in response.get('Clusters', []):\n        print(f\"  Cluster ARN: {cluster.get('ClusterArn')}, Status: {cluster.get('Status')}\")\nexcept client.exceptions.AccessDeniedException as e:\n    print(f\"Authentication or authorization error: {e}\")\nexcept Exception as e:\n    print(f\"An unexpected error occurred: {e}\")\n","lang":"python","description":"This quickstart demonstrates how to instantiate a boto3 DocDBElastic client and use it with mypy-boto3-docdb-elastic for type annotations. The `TYPE_CHECKING` block ensures type hints are only active during static analysis, avoiding runtime dependency if desired. It includes error handling for common issues like AccessDeniedException."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer.","message":"Starting with mypy-boto3-builder 8.12.0 (which generated this stub), Python 3.8 support has been removed for all packages. Ensure your project uses Python 3.9 or higher.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.12.0, mypy-boto3-docdb-elastic >=1.42.3"},{"fix":"Consult the specific package documentation or generated `type_defs.pyi` for the correct TypeDef names in your version of mypy-boto3-docdb-elastic.","message":"mypy-boto3-builder 8.9.0 introduced breaking changes to TypeDef naming conventions, potentially causing `NameError` or incorrect type resolution for previously used type definitions. Shorter names for packed method arguments and postfix changes for conflicting TypeDefs are common.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.9.0, mypy-boto3-docdb-elastic versions generated with builder >=8.9.0"},{"fix":"Assign `object` to the conditionally imported types in the `else` block (e.g., `else: DocDBElasticClient = object`) or configure Pylint to ignore these specific warnings.","message":"When using `if TYPE_CHECKING:` for conditional imports to avoid runtime dependencies, Pylint might report 'undefined variable' errors.","severity":"gotcha","affected_versions":"All versions when using conditional imports with Pylint"},{"fix":"Install `boto3-stubs[docdb-elastic]` to ensure synchronized versions with `boto3`, or manually verify `mypy-boto3-docdb-elastic` and `boto3` versions are compatible.","message":"The `mypy-boto3-*` packages are closely tied to `boto3` versions. To ensure accurate type hints, the version of `mypy-boto3-docdb-elastic` should ideally align with your installed `boto3` version.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Consider using `boto3-stubs-lite[docdb-elastic]` (which is more RAM-friendly but requires explicit type annotations) or disabling PyCharm's internal type checker and relying on external tools like `mypy` or `pyright`.","message":"PyCharm users might experience slow performance with Literal overloads.","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"}