{"id":3367,"library":"mypy-boto3-iotthingsgraph","title":"mypy-boto3-iotthingsgraph Type Stubs","description":"mypy-boto3-iotthingsgraph provides type annotations for the `boto3` IoTThingsGraph service client, compatible with static type checkers like MyPy, Pyright, and IDEs like VSCode and PyCharm. It helps in catching type-related errors early and improves code autocompletion. The library is actively maintained with releases frequently synchronized with `boto3` and its upstream `mypy-boto3-builder` versions.","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","iot","iotthingsgraph","typing"],"install":[{"cmd":"pip install mypy-boto3-iotthingsgraph boto3","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Runtime dependency for AWS SDK functionality, `mypy-boto3-iotthingsgraph` provides only type stubs for it.","package":"boto3","optional":false}],"imports":[{"note":"Type stubs are imported from the `mypy_boto3_servicename` package, not directly from `boto3`.","wrong":"from boto3.client import IoTThingsGraphClient","symbol":"IoTThingsGraphClient","correct":"from mypy_boto3_iotthingsgraph.client import IoTThingsGraphClient"},{"note":"Specific TypeDefs for API response structures are available in the `type_defs` submodule.","symbol":"ListFlowTemplatesResponseTypeDef","correct":"from mypy_boto3_iotthingsgraph.type_defs import ListFlowTemplatesResponseTypeDef"},{"note":"It is best practice to import type stubs only within `if TYPE_CHECKING:` blocks to avoid runtime dependencies.","symbol":"TYPE_CHECKING","correct":"from typing import TYPE_CHECKING"}],"quickstart":{"code":"import boto3\nfrom typing import TYPE_CHECKING\n\nif TYPE_CHECKING:\n    from mypy_boto3_iotthingsgraph.client import IoTThingsGraphClient\n    from mypy_boto3_iotthingsgraph.type_defs import ListFlowTemplatesResponseTypeDef\n\n\ndef get_iotthingsgraph_flow_templates() -> list[str]:\n    client: IoTThingsGraphClient = boto3.client('iotthingsgraph')\n    response: ListFlowTemplatesResponseTypeDef = client.list_flow_templates()\n    template_names = [t['id'] for t in response.get('flowTemplates', [])]\n    return template_names\n\n# Example usage (will not run without AWS credentials and actual resources)\n# print(get_iotthingsgraph_flow_templates())","lang":"python","description":"This quickstart demonstrates how to use `mypy-boto3-iotthingsgraph` to add type hints to a boto3 IoTThingsGraph client. The `IoTThingsGraphClient` type from `mypy_boto3_iotthingsgraph.client` is used to explicitly type the `boto3.client('iotthingsgraph')` instance, enabling autocompletion and static analysis. The `TYPE_CHECKING` block ensures that these type-only imports are excluded at runtime."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer. Ensure your `requires_python` matches in your project configuration.","message":"Python 3.8 support has been removed since `mypy-boto3-builder 8.12.0`, which `mypy-boto3-iotthingsgraph 1.42.3` is based on. Projects requiring type stubs must now use Python 3.9 or higher.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.12.0, mypy-boto3-iotthingsgraph >=1.42.3"},{"fix":"Ensure your type checker (e.g., MyPy) is up-to-date. If issues persist, verify that your project structure and `py.typed` markers (if applicable for custom setups) align with PEP 561 guidelines.","message":"The `mypy-boto3-builder` project migrated to PEP 561 compliant packages. While this generally improves compatibility with type checkers, users relying on specific older mechanisms for stub discovery might need to adjust their `mypy` configuration or package installation methods.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.12.0, mypy-boto3-iotthingsgraph >=1.42.3"},{"fix":"Review and update `TypeDef` imports and usage in your codebase to match the new, shorter naming conventions as described in the release notes or the generated stub files.","message":"TypeDef naming conventions were changed in `mypy-boto3-builder 8.9.0`. For example, `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`, and conflicting `Extra` postfixes were moved. This affects all generated type stubs, including IoTThingsGraph, potentially breaking existing type annotations for complex input/output structures.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.9.0, mypy-boto3-iotthingsgraph >=1.38.0 (approx.)"},{"fix":"Always install both `boto3` and `mypy-boto3-iotthingsgraph` in your development environment: `pip install boto3 mypy-boto3-iotthingsgraph`.","message":"The `mypy-boto3-iotthingsgraph` package provides *only* type annotations. You must install `boto3` separately to have the actual runtime AWS SDK functionality.","severity":"gotcha","affected_versions":"All"},{"fix":"Use `from typing import TYPE_CHECKING` and enclose `from mypy_boto3_...` imports inside an `if TYPE_CHECKING:` block. Your production environment only needs `boto3`.","message":"To avoid adding `mypy-boto3-iotthingsgraph` as a runtime dependency to your deployed application, it is best practice to wrap all type stub imports within `if TYPE_CHECKING:` blocks.","severity":"gotcha","affected_versions":"All"},{"fix":"Uninstall any legacy `mypy-boto3` packages and install the appropriate `mypy-boto3-servicename` packages or `boto3-stubs` with extras for the services you use.","message":"The 'legacy `mypy-boto3`' packages were moved to a separate product and are no longer generated alongside `boto3-stubs` by the builder. If you were using the older `mypy-boto3` umbrella package, you should migrate to specific service packages like `mypy-boto3-iotthingsgraph` or the meta-package `boto3-stubs`.","severity":"deprecated","affected_versions":"mypy-boto3-builder >=8.9.0"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}