{"id":3088,"library":"mypy-boto3-firehose","title":"mypy-boto3-firehose Type Annotations","description":"mypy-boto3-firehose provides comprehensive type annotations for the AWS Kinesis Data Firehose service client in `boto3`. It is part of the `mypy-boto3-builder` project, which generates stubs for all `boto3` and `aioboto3` services. The library closely tracks `boto3` versions, with frequent releases that align with AWS SDK updates, ensuring up-to-date type checking for development environments.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","mypy","typing","type-hints","firehose","stubs"],"install":[{"cmd":"pip install mypy-boto3-firehose","lang":"bash","label":"Install service-specific stubs"},{"cmd":"pip install boto3-stubs[firehose]","lang":"bash","label":"Install via boto3-stubs extras"}],"dependencies":[{"reason":"Provides type annotations for the `boto3` library.","package":"boto3","optional":false}],"imports":[{"note":"Directly importing from `boto3.client` will not provide specific type hints for Firehose; `mypy-boto3-firehose` provides the specialized `FirehoseClient`.","wrong":"from boto3.client import FirehoseClient","symbol":"FirehoseClient","correct":"from mypy_boto3_firehose import FirehoseClient"},{"note":"For precise type checking of request bodies, use the generated `_type_defs` for specific service operations instead of generic `Dict[str, Any]`.","wrong":"from typing import Dict, Any","symbol":"PutRecordInputRequestTypeDef","correct":"from mypy_boto3_firehose.type_defs import PutRecordInputRequestTypeDef"}],"quickstart":{"code":"import boto3\nimport os\nfrom typing import TYPE_CHECKING\n\nif TYPE_CHECKING:\n    from mypy_boto3_firehose import FirehoseClient\n    from mypy_boto3_firehose.type_defs import PutRecordInputRequestTypeDef\n\n# Configure AWS credentials (e.g., via environment variables or AWS CLI config)\n# For example, ensure AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION_NAME are set.\n\ndef send_to_firehose(delivery_stream_name: str, data: str) -> None:\n    \"\"\"Sends data to an AWS Kinesis Firehose delivery stream with type hints.\"\"\"\n    # Explicit type annotation for the client (recommended for some IDEs/type checkers)\n    client: FirehoseClient = boto3.client(\n        \"firehose\",\n        region_name=os.environ.get('AWS_REGION_NAME', 'us-east-1'),\n        aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', ''),\n        aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', ''),\n    )\n\n    # Use a TypedDict for the request payload for full type checking\n    record_data: PutRecordInputRequestTypeDef = {\n        \"DeliveryStreamName\": delivery_stream_name,\n        \"Record\": {\"Data\": data.encode('utf-8')},\n    }\n\n    try:\n        response = client.put_record(**record_data)\n        print(f\"Successfully sent record. RecordId: {response['RecordId']}\")\n    except Exception as e:\n        print(f\"Error sending record to Firehose: {e}\")\n\nif __name__ == \"__main__\":\n    # Example usage (replace with your actual stream name and data)\n    firehose_stream = \"YourFirehoseDeliveryStreamName\"\n    message = \"Hello, Firehose! This is a typed record.\"\n    send_to_firehose(firehose_stream, message)","lang":"python","description":"Demonstrates how to initialize a type-hinted Firehose client and send a record using a `TypedDict` for the request payload, leveraging the provided type annotations. It includes `TYPE_CHECKING` for conditional dependency."},"warnings":[{"fix":"Upgrade your project's Python interpreter to 3.9 or higher. (e.g., `python -m pip install --upgrade python` or update virtual environment/container base image).","message":"As of `mypy-boto3-builder` version 8.12.0 (November 8, 2025), Python 3.8 is no longer supported across all `mypy-boto3` packages. Projects must migrate to Python 3.9 or later to receive updates.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.12.0"},{"fix":"Ensure `mypy` is configured to automatically discover installed packages. If issues arise, check `mypy` documentation on `PEP 561` and installed packages. No manual `MYPYPATH` for stub-only packages is needed if installed via `pip`.","message":"The `mypy-boto3-builder` (version 8.12.0 onwards) migrated to PEP 561 compliant packages, which might change how type checkers locate and process stubs. This typically means stubs are automatically discovered, but old or custom `mypy` configurations might need adjustments.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.12.0"},{"fix":"Review and update `TypedDict` import paths and names in your codebase according to the new conventions. Consult the specific service's documentation for the correct generated `TypedDict` names.","message":"In `mypy-boto3-builder` version 8.9.0, there were changes to `TypedDict` naming conventions, including shortening names (e.g., `CreateDistributionRequestRequestTypeDef` to `CreateDistributionRequestTypeDef`) and moving the `Extra` postfix. This can break existing explicit `TypedDict` imports or usages.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.9.0"},{"fix":"Explicitly annotate the client variable with the correct `mypy-boto3-firehose` client type, e.g., `client: FirehoseClient = boto3.client(\"firehose\")`. This ensures consistent type inference across environments.","message":"While `mypy-boto3` stubs provide robust type checking, some IDEs (like VSCode) or older `mypy` versions might require explicit type annotations for `boto3.client()` calls to provide full autocomplete and type inference due to limitations in function overload support.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}