mypy-boto3-iotthingsgraph Type Stubs
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.
Warnings
- breaking 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.
- breaking 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.
- breaking 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.
- gotcha The `mypy-boto3-iotthingsgraph` package provides *only* type annotations. You must install `boto3` separately to have the actual runtime AWS SDK functionality.
- gotcha 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.
- deprecated 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`.
Install
-
pip install mypy-boto3-iotthingsgraph boto3
Imports
- IoTThingsGraphClient
from mypy_boto3_iotthingsgraph.client import IoTThingsGraphClient
- ListFlowTemplatesResponseTypeDef
from mypy_boto3_iotthingsgraph.type_defs import ListFlowTemplatesResponseTypeDef
- TYPE_CHECKING
from typing import TYPE_CHECKING
Quickstart
import boto3
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from mypy_boto3_iotthingsgraph.client import IoTThingsGraphClient
from mypy_boto3_iotthingsgraph.type_defs import ListFlowTemplatesResponseTypeDef
def get_iotthingsgraph_flow_templates() -> list[str]:
client: IoTThingsGraphClient = boto3.client('iotthingsgraph')
response: ListFlowTemplatesResponseTypeDef = client.list_flow_templates()
template_names = [t['id'] for t in response.get('flowTemplates', [])]
return template_names
# Example usage (will not run without AWS credentials and actual resources)
# print(get_iotthingsgraph_flow_templates())