Install & Compatibility
Where this runs
tested against v1.43.17 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.580s · 51.9MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 4.0s · import 0.548s · 52MB
50MB installed
● package 50MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
IoTDataPlaneClient
✓ from mypy_boto3_iot_data.client import IoTDataPlaneClient
This is the primary client type to annotate boto3.client('iot-data').
PublishRequestRequestTypeDef
✓ from mypy_boto3_iot_data.type_defs import PublishRequestRequestTypeDef
Type definitions for service requests and responses are found in `type_defs`.
TYPE_CHECKING
✓ from typing import TYPE_CHECKING
Recommended for avoiding runtime dependency on stubs by only importing them during type checking.
This quickstart demonstrates how to initialize a type-hinted `IoTDataPlaneClient` using `boto3` and perform a `publish` operation. The `TYPE_CHECKING` guard is used to ensure the stub imports are only active during static analysis, preventing runtime dependencies. Type definitions for request payloads (like `PublishRequestRequestTypeDef`) enhance type safety.
import boto3
from typing import TYPE_CHECKING
import os
if TYPE_CHECKING:
from mypy_boto3_iot_data.client import IoTDataPlaneClient
from mypy_boto3_iot_data.type_defs import PublishRequestRequestTypeDef
AWS_REGION = os.environ.get('AWS_REGION', 'us-east-1')
def get_iot_data_client() -> 'IoTDataPlaneClient':
"""Returns a type-hinted IoTDataPlane client."""
# Actual runtime client is from boto3
return boto3.client('iot-data', region_name=AWS_REGION)
client = get_iot_data_client()
# Example of a type-hinted request payload
publish_payload: 'PublishRequestRequestTypeDef' = {
'topic': 'my/test/topic',
'qos': 0,
'payload': b'Hello from mypy-boto3-iot-data!',
}
try:
# mypy will now provide type checking for 'publish' arguments
response = client.publish(**publish_payload)
print(f"Successfully published message. Response: {response}")
except Exception as e:
print(f"Error publishing message: {e}")
Debug
Known issues
breakingPython 3.8 support has been removed since `mypy-boto3-builder` version 8.12.0. Users on Python 3.8 or older must upgrade to Python 3.9+ to use newer versions of these stubs.fixUpgrade your Python environment to 3.9 or higher.
affects: >=8.12.0 (builder)
breakingBreaking changes were introduced in `mypy-boto3-builder` version 8.9.0 regarding `TypeDef` naming conventions. Request TypeDefs for packed arguments now use shorter names (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`). Conflicting `TypeDef` `Extra` postfixes were also moved. This may require updating existing type hints.fixReview and update `TypeDef` import paths and names in your codebase according to the new conventions.
affects: >=8.9.0 (builder)
gotchaThe `mypy-boto3` project migrated to PEP 561 compliant packages with `mypy-boto3-builder` version 8.12.0. While this generally improves compatibility with type checkers, ensure your `mypy` setup is configured to find installed stub packages, and you are running `mypy` in the same Python environment where `mypy-boto3-iot-data` is installed.fixTypically, `mypy` automatically finds PEP 561 packages if installed in the same environment. Verify your `mypy` configuration (e.g., no `--no-site-packages`) and ensure `mypy-boto3-iot-data` is correctly installed in your virtual environment.
affects: >=8.12.0 (builder)
gotchaWhen using `mypy-boto3` with `pylint`, you might encounter false positives regarding undefined variables if you use `TYPE_CHECKING` for conditional imports.fixTo fix this, set all types to `object` in the non-`TYPE_CHECKING` branch (as shown in the quickstart example) or configure `pylint` to ignore these specific warnings.
affects: All
Upgrade
Version history
1.43.17latest on PyPI · released May 28, 2026
Audit
Dependencies
boto3requiredProvides the underlying AWS SDK runtime functionality that these stubs type-hint.
pythonrequiredRequires Python 3.9 or higher.