{"id":3354,"library":"mypy-boto3-datazone","title":"Type Annotations for boto3 DataZone","description":"mypy-boto3-datazone provides type annotations for the boto3 DataZone service, enabling static type checking with tools like mypy, pyright, and enhanced IDE autocomplete. It is part of the `boto3-stubs` ecosystem, generated by `mypy-boto3-builder`. The current version is 1.42.85, released in sync with boto3 versions, ensuring compatibility and a frequent update cadence.","status":"active","version":"1.42.85","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","type-annotations","mypy","datazone","stubs"],"install":[{"cmd":"pip install mypy-boto3-datazone","lang":"bash","label":"Install standalone DataZone stubs"},{"cmd":"pip install 'boto3-stubs[datazone]'","lang":"bash","label":"Install as part of boto3-stubs (recommended)"}],"dependencies":[{"reason":"mypy-boto3-datazone provides type stubs for boto3; boto3 itself must be installed for runtime execution.","package":"boto3","optional":false}],"imports":[{"note":"While `boto3.client('datazone')` returns a client, for full type-hinting, import the stub client directly. Importing `DataZoneClient` directly from `mypy_boto3_datazone` works but explicit `mypy_boto3_datazone.client` is clearer.","wrong":"from boto3.client import DataZoneClient","symbol":"DataZoneClient","correct":"from mypy_boto3_datazone.client import DataZoneClient"},{"note":"Type definitions (TypeDefs) are located in the `type_defs` submodule for clarity and organization.","wrong":"from mypy_boto3_datazone.client import ListDomainsOutputTypeDef","symbol":"ListDomainsOutputTypeDef","correct":"from mypy_boto3_datazone.type_defs import ListDomainsOutputTypeDef"},{"note":"Paginator type hints are provided in the `paginator` submodule.","symbol":"ListDomainsPaginator","correct":"from mypy_boto3_datazone.paginator import ListDomainsPaginator"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_datazone.client import DataZoneClient\nfrom mypy_boto3_datazone.type_defs import ListDomainsOutputTypeDef\nfrom typing import TYPE_CHECKING, cast\n\nif TYPE_CHECKING:\n    client: DataZoneClient = boto3.client(\"datazone\")\nelse:\n    client = boto3.client(\"datazone\")\n\ndef list_datazone_domains() -> ListDomainsOutputTypeDef:\n    \"\"\"Lists DataZone domains with type hints.\"\"\"\n    # Example: List domains\n    response = client.list_domains()\n    print(f\"Found {len(response.get('items', []))} DataZone domains.\")\n    return cast(ListDomainsOutputTypeDef, response)\n\nif __name__ == \"__main__\":\n    # Ensure boto3 is configured (e.g., AWS_REGION, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)\n    # For demonstration, we'll assume default config or environment variables.\n    try:\n        domains = list_datazone_domains()\n        for domain in domains.get('items', []):\n            print(f\"- Domain ID: {domain.get('id')}, Name: {domain.get('name')}\")\n    except Exception as e:\n        print(f\"Error listing domains: {e}\")\n        # In a real application, you'd handle specific boto3 exceptions.\n","lang":"python","description":"This quickstart demonstrates how to use `mypy-boto3-datazone` to add type hints to a boto3 DataZone client. It shows importing the client type and a common `TypeDef` for a response, then using them with a standard `boto3` client call. The `TYPE_CHECKING` block ensures the stub package is only used for type analysis, not runtime."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer.","message":"Python 3.8 support was removed in `mypy-boto3-builder` version 8.12.0. Users on Python 3.8 or older will need to upgrade their Python version to `>=3.9` to use recent versions of `mypy-boto3-datazone`.","severity":"breaking","affected_versions":">=8.12.0 of mypy-boto3-builder and derived stub packages"},{"fix":"Review and update `TypeDef` import paths and names in your codebase according to the new naming conventions.","message":"Breaking changes in `mypy-boto3-builder` version 8.9.0 introduced shorter names for TypeDefs used in packed method arguments (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`). Conflicting `Extra` postfixes in TypeDef names were also moved to the end.","severity":"breaking","affected_versions":">=8.9.0 of mypy-boto3-builder and derived stub packages"},{"fix":"Prefer `pip install 'boto3-stubs[service]'` over `pip install mypy-boto3-service` for managing service stubs, although both approaches for `mypy-boto3-datazone` are currently functional.","message":"The standalone `mypy-boto3` package is considered legacy. While `mypy-boto3-datazone` is a valid and current service-specific stub, it is recommended to install service stubs using the `boto3-stubs` meta-package (e.g., `pip install 'boto3-stubs[datazone]'`) for better maintainability and to avoid confusion with the older `mypy-boto3` meta-package.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Use explicit type annotations as shown in the quickstart (e.g., `client: DataZoneClient = boto3.client(\"datazone\")`). Consider using `boto3-stubs-lite` if PyCharm performance issues arise with large projects, though it requires more explicit typing.","message":"Some IDEs (like older PyCharm versions) or linters might require explicit type annotations for `boto3.client` calls to ensure full autocomplete and type checking, due to limitations with function 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"}