{"id":3337,"library":"mypy-boto3-backup-gateway","title":"mypy-boto3-backup-gateway","description":"mypy-boto3-backup-gateway provides high-quality type annotations for the boto3 BackupGateway service, ensuring better code completion, static analysis, and error detection in development environments. It is part of the larger `mypy-boto3` ecosystem, generated by `mypy-boto3-builder`. The current version is 1.42.58, and it is frequently updated to align with `boto3` releases and schema changes.","status":"active","version":"1.42.58","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","mypy","type-hints","stubs","backup-gateway","typed"],"install":[{"cmd":"pip install mypy-boto3-backup-gateway","lang":"bash","label":"Install package"}],"dependencies":[{"reason":"This package provides type annotations for boto3; boto3 itself must be installed to use the annotated AWS SDK client.","package":"boto3","optional":false}],"imports":[{"symbol":"BackupGatewayClient","correct":"from mypy_boto3_backup_gateway.client import BackupGatewayClient"},{"note":"Type definition names commonly end with 'TypeDef' in mypy-boto3, not just the raw response name.","wrong":"from mypy_boto3_backup_gateway.type_defs import ListGatewaysOutput","symbol":"ListGatewaysOutputTypeDef","correct":"from mypy_boto3_backup_gateway.type_defs import ListGatewaysOutputTypeDef"}],"quickstart":{"code":"import boto3\nfrom boto3.session import Session\nfrom mypy_boto3_backup_gateway.client import BackupGatewayClient\nfrom mypy_boto3_backup_gateway.type_defs import ListGatewaysOutputTypeDef\n\ndef get_backup_gateway_client() -> BackupGatewayClient:\n    \"\"\"Initializes and returns a type-hinted BackupGateway client.\"\"\"\n    # A real application would configure AWS credentials via environment variables or ~/.aws/credentials\n    session = Session(region_name='us-east-1')\n    client: BackupGatewayClient = session.client('backup-gateway')\n    return client\n\ndef list_all_gateways() -> ListGatewaysOutputTypeDef:\n    \"\"\"Lists all Backup Gateways and returns the typed response.\"\"\"\n    client = get_backup_gateway_client()\n    response: ListGatewaysOutputTypeDef = client.list_gateways()\n    print(f\"Found {len(response['Gateways'])} gateways.\")\n    return response\n\nif __name__ == '__main__':\n    gateways_data = list_all_gateways()\n    # Mypy will now correctly infer types for gateways_data, e.g., gateways_data['Gateways']\n    # without needing runtime checks.\n    for gateway in gateways_data.get('Gateways', []):\n        print(f\"Gateway ARN: {gateway['GatewayArn']}, Name: {gateway['GatewayDisplayName']}\")","lang":"python","description":"This quickstart demonstrates how to initialize a `BackupGatewayClient` with type hints and use a basic operation like `list_gateways`. The `mypy-boto3-backup-gateway` package provides the necessary type definitions for the client and its responses, enabling static type checking with tools like MyPy."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or a newer supported version.","message":"Support for Python 3.8 was removed in `mypy-boto3-builder` version 8.12.0. All `mypy-boto3` packages, including `mypy-boto3-backup-gateway`, now require Python 3.9 or newer.","severity":"breaking","affected_versions":">=8.12.0 (builder), >=1.42.x (package)"},{"fix":"Ensure your `mypy` or `pyright` setup is up-to-date and correctly configured to find installed stub packages. In most cases, a standard `pip install` should work, but older or custom setups might need adjustment.","message":"The `mypy-boto3` ecosystem migrated to PEP 561-compliant packaging in `mypy-boto3-builder` version 8.12.0. This might require updating older type checker configurations or virtual environments to correctly discover stubs, though it generally improves compatibility with modern tooling.","severity":"breaking","affected_versions":">=8.12.0 (builder), >=1.42.x (package)"},{"fix":"Review your code for any custom `TypeDef` imports and update the names according to the new conventions.","message":"In `mypy-boto3-builder` version 8.9.0, certain TypeDef names were refactored for clarity and consistency. Specifically, TypeDefs for packed method arguments use shorter names (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`) and conflicting `Extra` postfixes were moved to the end (e.g., `CreateDistributionExtraRequestTypeDef` -> `CreateDistributionRequestExtraTypeDef`).","severity":"breaking","affected_versions":">=8.9.0 (builder), corresponding package versions"},{"fix":"Explicitly add type annotations to your `boto3` client and resource assignments for improved IDE experience.","message":"While `mypy-boto3` strives for implicit type inference, some IDEs (like VSCode with older Python extensions or PyCharm) may still benefit from explicit type annotations for `boto3.client` and `session.client` calls to provide optimal auto-completion and type checking. For example, `client: BackupGatewayClient = session.client('backup-gateway')`.","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"}