Registry /
type-stubs / mypy-boto3-backup-gateway
Install & Compatibility
Where this runs
tested against v1.43.55 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.3MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
BackupGatewayClient
✓ from mypy_boto3_backup_gateway import BackupGatewayClient
✗ from mypy_boto3_backup_gateway import BackupGatewayClient
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.
import boto3
from boto3.session import Session
from mypy_boto3_backup_gateway.client import BackupGatewayClient
from mypy_boto3_backup_gateway.type_defs import ListGatewaysOutputTypeDef
def get_backup_gateway_client() -> BackupGatewayClient:
"""Initializes and returns a type-hinted BackupGateway client."""
# A real application would configure AWS credentials via environment variables or ~/.aws/credentials
session = Session(region_name='us-east-1')
client: BackupGatewayClient = session.client('backup-gateway')
return client
def list_all_gateways() -> ListGatewaysOutputTypeDef:
"""Lists all Backup Gateways and returns the typed response."""
client = get_backup_gateway_client()
response: ListGatewaysOutputTypeDef = client.list_gateways()
print(f"Found {len(response['Gateways'])} gateways.")
return response
if __name__ == '__main__':
gateways_data = list_all_gateways()
# Mypy will now correctly infer types for gateways_data, e.g., gateways_data['Gateways']
# without needing runtime checks.
for gateway in gateways_data.get('Gateways', []):
print(f"Gateway ARN: {gateway['GatewayArn']}, Name: {gateway['GatewayDisplayName']}")
Debug
Known issues
breakingSupport 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.fixUpgrade your Python environment to 3.9 or a newer supported version.
affects: >=8.12.0 (builder), >=1.42.x (package)
breakingThe `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.fixEnsure 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.
affects: >=8.12.0 (builder), >=1.42.x (package)
breakingIn `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`).fixReview your code for any custom `TypeDef` imports and update the names according to the new conventions.
affects: >=8.9.0 (builder), corresponding package versions
gotchaWhile `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')`.fixExplicitly add type annotations to your `boto3` client and resource assignments for improved IDE experience.
affects: All versions
Upgrade
Version history
1.43.55latest on PyPI · released Jul 23, 2026
Audit
Dependencies
boto3requiredThis package provides type annotations for boto3; boto3 itself must be installed to use the annotated AWS SDK client.