{"id":3338,"library":"mypy-boto3-backupsearch","title":"mypy-boto3-backupsearch Type Stubs","description":"mypy-boto3-backupsearch provides type annotations for the `boto3` AWS BackupSearch service (version 1.42.3), generated by the `mypy-boto3-builder` (version 8.12.0). It enhances static type checking and IDE auto-completion for `boto3` client and resource operations, addressing the dynamic nature of `boto3` to improve code quality and prevent runtime errors. The library follows the release cadence of `boto3` and `botocore` services.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["type-hints","mypy","boto3","aws","backupsearch","static-analysis"],"install":[{"cmd":"pip install mypy-boto3-backupsearch boto3 mypy","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"This package provides type stubs for the runtime library `boto3` for the BackupSearch service; `boto3` itself must be installed to use the service functionality.","package":"boto3","optional":false},{"reason":"This package provides type stubs for static type checking; `mypy` is the primary tool used to perform this checking.","package":"mypy","optional":true}],"imports":[{"note":"Imports the specific client type stub for BackupSearch.","symbol":"BackupSearchClient","correct":"from mypy_boto3_backupsearch.client import BackupSearchClient"},{"note":"Standard boto3 session import, used for creating clients.","symbol":"Session","correct":"from boto3.session import Session"},{"note":"Imports a generated TypedDict for service response structures.","symbol":"BackupCreationTimeFilterOutputTypeDef","correct":"from mypy_boto3_backupsearch.type_defs import BackupCreationTimeFilterOutputTypeDef"}],"quickstart":{"code":"import boto3\nfrom typing import TYPE_CHECKING\n\nif TYPE_CHECKING:\n    from mypy_boto3_backupsearch.client import BackupSearchClient\n\nsession = boto3.session.Session()\n\n# Explicit type annotation for the client\nclient: \"BackupSearchClient\" = session.client(\"backupsearch\", region_name=\"us-east-1\")\n\n# Example of a client method call (type-hinted)\nresponse = client.list_search_jobs()\nprint(f\"Listed BackupSearch Jobs: {len(response.get('SearchJobs', []))}\")\n\n# Example with a TypedDict for a more complex response part\nif TYPE_CHECKING:\n    from mypy_boto3_backupsearch.type_defs import SearchJobTypeDef\n\njobs: list[\"SearchJobTypeDef\"] = response.get('SearchJobs', [])\nif jobs:\n    print(f\"First job ID: {jobs[0].get('BackupVaultName')}\")","lang":"python","description":"This quickstart demonstrates how to initialize a `boto3` BackupSearch client and apply explicit type annotations using `mypy-boto3-backupsearch` for enhanced static analysis. It also shows an example of using a generated `TypedDict` for response structures. The `TYPE_CHECKING` block ensures these type hints are only present during static analysis and do not add runtime dependencies."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer.","message":"Support for Python 3.8 was removed in `mypy-boto3-builder` version 8.12.0. Users on Python 3.8 will need to upgrade their Python version to 3.9 or higher. `mypy` itself also no longer supports Python 3.8.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.12.0, mypy-boto3-backupsearch >= 1.42.0"},{"fix":"Ensure your `mypy` and environment are up-to-date and correctly configured to find PEP 561-compliant stub packages. This is typically handled automatically by modern `pip` and `mypy` versions.","message":"As of `mypy-boto3-builder` 8.12.0, packages migrated to PEP 561, using `py.typed` marker files. This might affect how type checkers discover and interpret the stubs in certain environments or older toolchains.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.12.0, mypy-boto3-backupsearch >= 1.42.0"},{"fix":"Review your code for any explicit imports or usage of `TypeDef` names and adjust them according to the latest documentation or error messages from `mypy`.","message":"In `mypy-boto3-builder` 8.9.0, there were breaking changes to `TypeDef` naming conventions (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`). While this example is not for BackupSearch, similar renames might apply to BackupSearch `TypeDefs`.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.9.0, mypy-boto3-backupsearch >= 1.39.0"},{"fix":"Always install `boto3` alongside `mypy-boto3-backupsearch`: `pip install boto3 mypy-boto3-backupsearch`.","message":"This package provides *only* type annotations. The actual `boto3` library is a mandatory runtime dependency and must be installed separately to execute any AWS API calls.","severity":"gotcha","affected_versions":"All"},{"fix":"Keep `mypy-boto3-backupsearch` and `boto3` versions as closely matched as possible. For best compatibility, install `mypy-boto3-builder` and generate stubs locally tied to your exact `boto3` version.","message":"The `mypy-boto3` stub versions are typically aligned with `boto3` versions. Using a stub package version that significantly deviates from your installed `boto3` runtime version can lead to type mismatches or incorrect hints.","severity":"gotcha","affected_versions":"All"},{"fix":"Wrap type hint imports with `from typing import TYPE_CHECKING` and `if TYPE_CHECKING:` blocks.","message":"For compatibility with `pylint` and to avoid unnecessary runtime dependencies, it is recommended to conditionally import type hints using `if TYPE_CHECKING:`.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}