{"id":3596,"library":"mypy-boto3-iotevents-data","title":"mypy-boto3-iotevents-data type annotations","description":"mypy-boto3-iotevents-data provides type annotations for the `boto3` IoTEventsData service, ensuring type safety and improved autocompletion for Python developers. It is currently at version 1.42.3 and is part of the `mypy-boto3` family, with new releases frequently generated by `mypy-boto3-builder` to stay in sync with `boto3` updates.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","mypy","type-hints","iotevents-data","cloud","type-checking"],"install":[{"cmd":"pip install mypy-boto3-iotevents-data boto3 mypy","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Runtime dependency for AWS SDK functionality.","package":"boto3","optional":false},{"reason":"Type checker to utilize the provided annotations.","package":"mypy","optional":false},{"reason":"Implicitly required for older Python versions (prior to 3.9) by the builder for some type features.","package":"typing-extensions","optional":true}],"imports":[{"note":"Import the typed client for IoTEventsData service.","symbol":"IoTEventsDataClient","correct":"from mypy_boto3_iotevents_data.client import IoTEventsDataClient"},{"note":"Import the typed service resource if using resource interfaces.","symbol":"IoTEventsDataServiceResource","correct":"from mypy_boto3_iotevents_data.service_resource import IoTEventsDataServiceResource"},{"note":"Breaking change in builder v8.9.0 for TypeDef naming: packed method arguments use a 'Request' suffix. Always consult latest docs or use IDE autocompletion for TypeDef names.","wrong":"from mypy_boto3_iotevents_data.type_defs import PutMessageRequestTypeDef","symbol":"PutMessageRequestRequestTypeDef","correct":"from mypy_boto3_iotevents_data.type_defs import PutMessageRequestRequestTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_iotevents_data.client import IoTEventsDataClient\nfrom mypy_boto3_iotevents_data.type_defs import PutMessageRequestRequestTypeDef\nimport os\n\ndef send_iot_event_data(event_data: PutMessageRequestRequestTypeDef) -> dict:\n    session = boto3.Session(region_name=os.environ.get('AWS_REGION', 'us-east-1'))\n    client: IoTEventsDataClient = session.client('iotevents-data')\n    response = client.put_message(messages=[event_data])\n    print(f\"Sent IoT Event Data: {response}\")\n    return response\n\nif __name__ == \"__main__\":\n    # Example usage - replace with actual event data\n    # In a real scenario, you'd populate this with data for your detector model.\n    sample_event = {\n        \"messageId\": \"my-unique-message-id\",\n        \"inputName\": \"my-input\",\n        \"payload\": b'{\"temperature\": 25.5}' # Payload must be bytes\n    }\n    try:\n        # Ensure AWS_REGION is set in environment, or provide it directly\n        os.environ['AWS_REGION'] = os.environ.get('AWS_REGION', 'us-east-1')\n        send_iot_event_data(sample_event)\n    except Exception as e:\n        print(f\"Error sending IoT Event Data: {e}\")","lang":"python","description":"This quickstart demonstrates how to use `mypy-boto3-iotevents-data` to get a typed client and send data to AWS IoT Events. It explicitly annotates the `boto3` client to leverage the provided type hints. Remember that `mypy-boto3-iotevents-data` provides type annotations, so `boto3` itself must be installed for runtime functionality."},"warnings":[{"fix":"Upgrade your Python environment to version 3.9 or higher.","message":"Python 3.8 support was removed with `mypy-boto3-builder` version 8.12.0 for all generated packages, including `mypy-boto3-iotevents-data`. Ensure your project uses Python 3.9 or newer.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.12.0"},{"fix":"Update `TypeDef` imports and usage in your code to match the new naming conventions. Use IDE autocompletion for correct names.","message":"The underlying `mypy-boto3-builder` (v8.9.0) introduced breaking changes in `TypeDef` naming conventions. Packed method arguments now use shorter names (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`) and conflicting `TypeDef` postfixes were moved (e.g., `CreateDistributionExtraRequestTypeDef` -> `CreateDistributionRequestExtraTypeDef`).","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.9.0"},{"fix":"Ensure your `mypy` configuration is up-to-date and type checking environments are properly set up. Re-evaluate `mypy` errors if they appear unexpectedly after upgrading.","message":"The `mypy-boto3-builder` (v8.12.0) migrated to PEP 561 compliant packages. While this is generally beneficial, it might cause subtle changes in how type checkers discover or interact with the stubs, especially in complex project setups.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.12.0"},{"fix":"Always install `boto3` alongside `mypy-boto3-iotevents-data`: `pip install boto3 mypy-boto3-iotevents-data`.","message":"This library provides *type annotations* only. You must also install `boto3` (or `aiobotocore`/`aioboto3` for async variants) for the actual AWS SDK runtime functionality. Without `boto3` installed, your code will fail at runtime.","severity":"gotcha","affected_versions":"All"},{"fix":"Explicitly add type hints to your `boto3` clients, resources, paginators, and response types in your code.","message":"For standalone `mypy-boto3-*` packages like this one, explicit type annotations for clients (e.g., `client: IoTEventsDataClient = session.client(...)`) are generally required for full IDE autocompletion and `mypy` functionality. Implicit typing might not work as expected.","severity":"gotcha","affected_versions":"All"},{"fix":"Disable PyCharm's built-in type checker and use `mypy` or `pyright`, or install `boto3-stubs-lite` instead of the full stubs.","message":"PyCharm users might experience slow performance with `Literal` overloads due to a known IDE issue (PY-40997). For better performance, consider using `boto3-stubs-lite` or external type checkers like `mypy` or `pyright`.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}