{"id":3005,"library":"mypy-boto3-account","title":"mypy-boto3-account Type Annotations","description":"Type annotations for boto3 Account 1.42.6 service generated with mypy-boto3-builder 8.12.0. This library provides precise type hints for the AWS Account service, significantly enhancing static analysis capabilities with tools like mypy, VSCode, and PyCharm for improved code quality and developer experience.","status":"active","version":"1.42.6","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["mypy","boto3","aws","type hints","static analysis","account"],"install":[{"cmd":"pip install mypy-boto3-account boto3 mypy","lang":"bash","label":"Install with dependencies"}],"dependencies":[{"reason":"Runtime dependency for interacting with AWS services.","package":"boto3"},{"reason":"Static type checker for utilizing the provided type annotations.","package":"mypy","optional":true}],"imports":[{"symbol":"AccountClient","correct":"from mypy_boto3_account import AccountClient"},{"symbol":"ListRegionsPaginator","correct":"from mypy_boto3_account.paginator import ListRegionsPaginator"},{"symbol":"AlternateContactTypeType","correct":"from mypy_boto3_account.literals import AlternateContactTypeType"},{"symbol":"AcceptPrimaryEmailUpdateRequestTypeDef","correct":"from mypy_boto3_account.type_defs import AcceptPrimaryEmailUpdateRequestTypeDef"},{"note":"For production code where mypy-boto3-account is only a dev dependency, use `TYPE_CHECKING` to avoid runtime import errors and satisfy linters like Pylint.","wrong":"from mypy_boto3_account import AccountClient # in production without TYPE_CHECKING","symbol":"AccountClient","correct":"from typing import TYPE_CHECKING\nif TYPE_CHECKING:\n    from mypy_boto3_account import AccountClient\nelse:\n    AccountClient = object"}],"quickstart":{"code":"from typing import TYPE_CHECKING\nimport boto3\n\nif TYPE_CHECKING:\n    from mypy_boto3_account import AccountClient\n    from mypy_boto3_account.type_defs import ListRegionsResponseTypeDef\n\ndef get_account_regions() -> 'ListRegionsResponseTypeDef':\n    \"\"\"Gets a list of regions for the current AWS account.\"\"\"\n    client: AccountClient = boto3.client(\"account\")\n    response: ListRegionsResponseTypeDef = client.list_regions()\n    return response\n\nif __name__ == \"__main__\":\n    # Ensure AWS credentials are configured (e.g., via AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION env vars)\n    # Or use a local AWS config/credentials file\n    try:\n        regions_data = get_account_regions()\n        print(f\"Account Regions: {[r['RegionName'] for r in regions_data.get('Regions', [])]}\")\n    except Exception as e:\n        print(f\"Error: {e}\")\n        print(\"Ensure AWS credentials and permissions for 'account:ListRegions' are configured.\")","lang":"python","description":"This example demonstrates how to obtain an AWS Account client with type annotations and use it to list regions. It employs `TYPE_CHECKING` for safe development-only dependency management and explicit type hints for maximal static analysis benefit."},"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 subsequently across all generated packages. Projects targeting `mypy-boto3-account` must use Python 3.9 or newer.","severity":"breaking","affected_versions":">=8.12.0"},{"fix":"Review and update `TypeDef` import paths and names in your codebase according to the new conventions. Consult the specific service's documentation for exact type names.","message":"TypeDef naming conventions changed in `mypy-boto3-builder` version 8.9.0. This includes shortening packed argument TypeDefs (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`) and moving `Extra` postfixes (e.g., `CreateDistributionExtraRequestTypeDef` -> `CreateDistributionRequestExtraTypeDef`). These changes may require updates to existing type hint usage for various services.","severity":"breaking","affected_versions":">=8.9.0"},{"fix":"Ensure your `mypy` version is recent and your `pyproject.toml` (or equivalent) configuration correctly points to your installed type stubs. You may need to rebuild your environment or clear caches if type resolution issues occur.","message":"The `mypy-boto3-builder` and its generated packages migrated to PEP 561 standard packages. This change might affect how type checkers or IDEs discover types if your build setup is not up-to-date or if you rely on older `mypy` versions.","severity":"gotcha","affected_versions":">=8.12.0"},{"fix":"Migrate your code to use the `pinpoint-sms-voice` service and install `mypy-boto3-pinpoint-sms-voice` if applicable.","message":"The `sms-voice` service was deprecated and removed from `mypy-boto3` builds in version 8.11.0 of the builder. Users should now use `pinpoint-sms-voice` instead.","severity":"deprecated","affected_versions":">=8.11.0 (for `sms-voice` related packages)"},{"fix":"Either update `Pylint` to a version that correctly handles `TYPE_CHECKING` or explicitly set the types to `object` in the `else` branch of your `TYPE_CHECKING` block. Example: `if TYPE_CHECKING: from mypy_boto3_ec2 import EC2Client else: EC2Client = object`.","message":"When using `mypy-boto3-account` as a development-only dependency with `TYPE_CHECKING` guards, older versions of `Pylint` might incorrectly complain about undefined variables. This can be mitigated by explicitly assigning `object` to the type hints in the `else` block.","severity":"gotcha","affected_versions":"All versions when using `TYPE_CHECKING` with specific Pylint versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}