{"id":3029,"library":"mypy-boto3-backup","title":"mypy-boto3-backup: Type Annotations for AWS Backup Service","description":"mypy-boto3-backup provides static type annotations for the AWS Backup 1.42.86 service, generated with mypy-boto3-builder 8.12.0. It enhances developer experience by offering type checking and auto-completion for `boto3` clients, resources, paginators, waiters, and specific type definitions for the Backup service, compatible with `mypy`, `pyright`, VSCode, and PyCharm.","status":"active","version":"1.42.86","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","mypy","type-annotations","stubs","backup","static-analysis","autocompletion"],"install":[{"cmd":"pip install mypy-boto3-backup boto3","lang":"bash","label":"Install with boto3"},{"cmd":"pip install 'boto3-stubs[backup]' boto3","lang":"bash","label":"Alternative via boto3-stubs extras"}],"dependencies":[{"reason":"Provides the underlying AWS SDK for Python that these stubs annotate.","package":"boto3"},{"reason":"The primary static type checker for which these stubs are designed.","package":"mypy"},{"reason":"Required for advanced type system features, especially for Python versions older than 3.9, though it's often a dependency for modern type hints.","package":"typing-extensions"}],"imports":[{"note":"For explicit type annotation of the AWS Backup service client.","symbol":"BackupClient","correct":"from mypy_boto3_backup.client import BackupClient"},{"note":"For explicit type annotation of specific API response structures (TypedDicts).","symbol":"ListBackupPlansOutputTypeDef","correct":"from mypy_boto3_backup.type_defs import ListBackupPlansOutputTypeDef"},{"note":"For explicit type annotation of service-specific literal values.","symbol":"AggregationPeriodType","correct":"from mypy_boto3_backup.literals import AggregationPeriodType"}],"quickstart":{"code":"import boto3\nfrom typing import TYPE_CHECKING\n\n# These imports are only for type checking and won't be bundled in production\nif TYPE_CHECKING:\n    from mypy_boto3_backup.client import BackupClient\n    from mypy_boto3_backup.type_defs import ListBackupPlansOutputTypeDef\n\ndef get_backup_plans() -> ListBackupPlansOutputTypeDef:\n    \"\"\"Lists AWS Backup plans and returns the response.\"\"\"\n    # Type annotation for the client for better IDE support and mypy checking\n    client: BackupClient = boto3.client(\"backup\")\n    \n    response = client.list_backup_plans(\n        MaxResults=5, # Example parameter\n        # Add other filters or parameters as needed\n    )\n    return response\n\nif __name__ == \"__main__\":\n    try:\n        backup_plans = get_backup_plans()\n        print(f\"Successfully retrieved {len(backup_plans.get('BackupPlansList', []))} backup plans.\")\n        for plan in backup_plans.get('BackupPlansList', [])[:2]: # Print first 2 for brevity\n            print(f\"  - Plan ID: {plan.get('BackupPlanId')}, Name: {plan.get('BackupPlanName')}\")\n    except Exception as e:\n        print(f\"Error listing backup plans: {e}\")","lang":"python","description":"This quickstart demonstrates how to initialize a `boto3` Backup client and call an API method (`list_backup_plans`) with the benefit of type annotations from `mypy-boto3-backup`. It includes conditional imports to ensure type-checking dependencies are not present at runtime, a common pattern for stub packages."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or a newer version, or pin `mypy-boto3-backup` to a version compatible with Python 3.8 (e.g., <1.42.0).","message":"As of `mypy-boto3-builder` 8.12.0 (which generates `mypy-boto3-backup` versions 1.42.x and later), support for Python 3.8 has been removed. Projects using these stubs must target Python 3.9 or newer.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.12.0, mypy-boto3-backup >=1.42.x"},{"fix":"Ensure `mypy` is up-to-date and correctly configured to find installed PEP 561 compatible stub packages. In most cases, `mypy` should automatically find them if installed in the same environment.","message":"Starting with `mypy-boto3-builder` 8.12.0, all `mypy-boto3` packages migrated to PEP 561. This change affects how type checkers (like `mypy`) discover and use type information, potentially requiring updates to `mypy` configurations or environment setups if issues arise.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.12.0, mypy-boto3-backup >=1.42.x"},{"fix":"Review and update explicit TypeDef imports and usage in your codebase to reflect the new naming conventions. Consult the specific `mypy-boto3-backup` documentation or generated stubs for exact new names.","message":"Version 8.9.0 of `mypy-boto3-builder` introduced breaking changes to how TypeDef names are generated. Specifically, argument TypeDefs were shortened (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`), and conflicting `Extra` postfixes were moved (e.g., `CreateDistributionExtraRequestTypeDef` to `CreateDistributionRequestExtraTypeDef`). While the example refers to other services, this naming convention change may apply to other service-specific TypeDefs.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.9.0, mypy-boto3-backup >=1.38.x (approx)"},{"fix":"Migrate your `pip install` commands to use `boto3-stubs` with service extras (e.g., `pip install 'boto3-stubs[backup]'`) or install standalone service stubs (e.g., `pip install mypy-boto3-backup`).","message":"If you were previously using the monolithic `mypy-boto3` package, note that `mypy-boto3-builder` 8.9.0 moved the 'legacy' `mypy-boto3` to a separate product. This means you should now install `boto3-stubs` (with service extras) or specific `mypy-boto3-service` packages like `mypy-boto3-backup`.","severity":"gotcha","affected_versions":"mypy-boto3-builder >=8.9.0, mypy-boto3-backup >=1.38.x (approx)"},{"fix":"Always explicitly annotate your `boto3` client or resource objects, e.g., `client: BackupClient = boto3.client(\"backup\")`.","message":"When using standalone `mypy-boto3-backup` (or `boto3-stubs-lite[backup]`), explicit type annotations for `boto3.client` and `boto3.resource` calls are recommended for optimal type checking and auto-completion, as these packages may not provide overloads for `session.client`/`resource`.","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"}