{"id":3154,"library":"mypy-boto3-synthetics","title":"mypy-boto3-synthetics Type Stubs for AWS Synthetics","description":"mypy-boto3-synthetics provides comprehensive type annotations for the AWS Synthetics service within the boto3 library. It enables static type checking with tools like MyPy and Pyright, enhancing developer experience with features such as auto-completion and early bug detection in IDEs like VSCode and PyCharm. The package, currently at version 1.42.3, is generated by mypy-boto3-builder and is actively maintained, with updates often aligned with boto3 releases.","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","synthetics","stubs","typing"],"install":[{"cmd":"pip install mypy-boto3-synthetics","lang":"bash","label":"Install standalone package"},{"cmd":"pip install 'boto3-stubs[synthetics]'","lang":"bash","label":"Install as part of boto3-stubs"}],"dependencies":[{"reason":"Provides the core AWS SDK functionality that these stubs type-annotate.","package":"boto3"},{"reason":"May be required for compatibility with certain Python versions or advanced type features; automatically managed by the builder's dependency calculation.","package":"typing-extensions","optional":true}],"imports":[{"note":"This is the explicit import for the Synthetics client type.","symbol":"SyntheticsClient","correct":"from mypy_boto3_synthetics.client import SyntheticsClient"},{"note":"Used for Literal type hints when calling boto3.client.","symbol":"SyntheticsServiceName","correct":"from mypy_boto3_synthetics.literals import SyntheticsServiceName"},{"note":"Example of importing a specific TypedDict for request parameters.","symbol":"CreateCanaryRequestRequestTypeDef","correct":"from mypy_boto3_synthetics.type_defs import CreateCanaryRequestRequestTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_synthetics.client import SyntheticsClient\nfrom mypy_boto3_synthetics.type_defs import GetCanaryResponseTypeDef\n\n\ndef get_synthetics_client() -> SyntheticsClient:\n    \"\"\"Returns a type-hinted AWS Synthetics client.\"\"\"\n    session = boto3.Session()\n    client: SyntheticsClient = session.client(\"synthetics\")\n    return client\n\n\nif __name__ == \"__main__\":\n    synthetics_client = get_synthetics_client()\n\n    try:\n        canary_name = \"my-test-canary\"\n        response: GetCanaryResponseTypeDef = synthetics_client.get_canary(Name=canary_name)\n        print(f\"Successfully retrieved canary '{canary_name}':\")\n        print(response)\n    except synthetics_client.exceptions.NotFoundException:\n        print(f\"Canary '{canary_name}' not found.\")\n    except Exception as e:\n        print(f\"An error occurred: {e}\")\n","lang":"python","description":"This quickstart demonstrates how to obtain a type-hinted AWS Synthetics client and use it to call an API method (e.g., `get_canary`). Explicit type annotations are shown for clarity and to ensure full type checking capabilities."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or a later version. Update your `requires_python` in `pyproject.toml` or `setup.py`.","message":"Starting with mypy-boto3-builder 8.12.0 (which generated mypy-boto3-synthetics 1.42.3), Python 3.8 is no longer supported. Projects must use Python 3.9 or newer.","severity":"breaking","affected_versions":"mypy-boto3-synthetics >=1.42.3, mypy-boto3-builder >=8.12.0"},{"fix":"Review and update `TypedDict` references in your code to match the new, shorter naming conventions provided by the stubs. Consult the specific service's `type_defs.pyi` for correct names.","message":"mypy-boto3-builder 8.9.0 introduced breaking changes to TypeDef naming conventions, making names shorter (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`). If you manually referenced these types, your code might break.","severity":"breaking","affected_versions":"mypy-boto3-synthetics >=1.38.0 (generated by builder 8.9.0)"},{"fix":"Ensure `mypy-boto3-synthetics` or `boto3-stubs[synthetics]` is correctly installed in your project's environment. For standalone packages, explicit type annotations (`client: SyntheticsClient`) are often necessary for optimal IDE support.","message":"The mypy-boto3 ecosystem migrated to PEP 561-compliant packages with builder 8.12.0. This change might require explicit installation of `mypy-boto3-synthetics` or `boto3-stubs[synthetics]` to ensure type checkers properly discover and use the stubs.","severity":"gotcha","affected_versions":"mypy-boto3-synthetics >=1.42.3, mypy-boto3-builder >=8.12.0"},{"fix":"Always add explicit type hints for the client object returned by `session.client()` or `boto3.client()`.","message":"When using standalone service packages like `mypy-boto3-synthetics` (or `boto3-stubs-lite`), explicit type annotations on `boto3.Session().client()` calls are recommended (`client: SyntheticsClient = session.client(\"synthetics\")`) to ensure full IDE auto-completion and type checking capabilities.","severity":"gotcha","affected_versions":"All versions of mypy-boto3-synthetics"},{"fix":"Always verify the correct service name and import path for the AWS service you intend to use. Refer to the official `boto3-stubs` documentation for the latest naming conventions.","message":"A service like `sms-voice` was deprecated and replaced by `pinpoint-sms-voice` in mypy-boto3-builder 8.11.0. While specific to another service, this highlights that service names can change, potentially requiring updates to your imports and client instantiation strings.","severity":"gotcha","affected_versions":"mypy-boto3-builder >=8.11.0"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}