mypy-boto3-iotthingsgraph Type Stubs

1.42.3 · active · verified Sat Apr 11

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

Install

Imports

Quickstart

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.

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())

view raw JSON →