{"id":2130,"library":"mypy-boto3-kinesis","title":"Type Annotations for Boto3 Kinesis","description":"mypy-boto3-kinesis provides Mypy-compatible type annotations for the Boto3 Kinesis service. It enhances development with AWS Boto3 by offering static type checking, auto-completion, and improved code navigation for Kinesis clients, paginators, waiters, literals, and type definitions. The current version is 1.42.41, generated by mypy-boto3-builder 8.12.0, and new versions are released in sync with Boto3 updates.","status":"active","version":"1.42.41","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["AWS","Boto3","Kinesis","mypy","type-annotations","stubs","static-analysis"],"install":[{"cmd":"pip install boto3 mypy-boto3-kinesis","lang":"bash","label":"Standalone Kinesis type annotations"},{"cmd":"pip install boto3 'boto3-stubs[kinesis]'","lang":"bash","label":"Recommended: Boto3-stubs with Kinesis extra"}],"dependencies":[{"reason":"Provides the AWS SDK for Python, which this library annotates. This library only provides types, not runtime functionality.","package":"boto3","optional":false},{"reason":"The umbrella package for Boto3 type annotations, often installed with service-specific extras like `boto3-stubs[kinesis]`. This is the recommended installation method.","package":"boto3-stubs","optional":true}],"imports":[{"note":"Import for the Kinesis client type annotation.","symbol":"KinesisClient","correct":"from mypy_boto3_kinesis.client import KinesisClient"},{"note":"Import for Kinesis StreamExistsWaiter type annotation.","symbol":"StreamExistsWaiter","correct":"from mypy_boto3_kinesis.waiters import StreamExistsWaiter"},{"note":"Import for Kinesis literal types, useful for strict type checking of predefined string values.","symbol":"ConsumerStatusType","correct":"from mypy_boto3_kinesis.literals import ConsumerStatusType"},{"note":"Import for Kinesis TypedDict definitions, for type-hinting API response structures.","symbol":"ListStreamsOutputTypeDef","correct":"from mypy_boto3_kinesis.type_defs import ListStreamsOutputTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_kinesis.client import KinesisClient\nfrom mypy_boto3_kinesis.type_defs import ListStreamsOutputTypeDef\nimport os\n\ndef list_kinesis_streams() -> ListStreamsOutputTypeDef:\n    # Ensure boto3 is configured, e.g., via AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY,\n    # and AWS_REGION environment variables or ~/.aws/credentials\n    # The 'client' variable is explicitly type-hinted for mypy/IDE benefit\n    client: KinesisClient = boto3.client(\"kinesis\", region_name=os.environ.get('AWS_REGION', 'us-east-1'))\n    \n    response: ListStreamsOutputTypeDef = client.list_streams()\n    print(\"Kinesis Streams:\")\n    for stream_name in response.get(\"StreamNames\", []):\n        print(f\"- {stream_name}\")\n    return response\n\nif __name__ == \"__main__\":\n    # Example usage requires AWS credentials and region to be set up\n    # For demonstration, ensure environment variables are set or remove this check\n    if not os.environ.get('AWS_ACCESS_KEY_ID') or not os.environ.get('AWS_SECRET_ACCESS_KEY'):\n        print(\"Please set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables.\")\n        print(\"Also, optionally set AWS_REGION (defaults to 'us-east-1').\")\n    else:\n        try:\n            list_kinesis_streams()\n        except Exception as e:\n            print(f\"An error occurred: {e}\")","lang":"python","description":"This quickstart demonstrates how to initialize a Boto3 Kinesis client with type annotations and list available Kinesis streams. Explicit type hints for the client and response structures provide static analysis benefits. Ensure AWS credentials and region are configured in your environment for the code to run successfully."},"warnings":[{"fix":"Upgrade Python to 3.9 or higher.","message":"Support for Python 3.8 was removed in `mypy-boto3-builder` version 8.12.0 (and consequently affects `mypy-boto3-kinesis`). Users on Python 3.8 should upgrade their Python version.","severity":"breaking","affected_versions":">=8.12.0 (builder), >=1.42.41 (package)"},{"fix":"Review your code for any custom `TypeDef` imports from `mypy_boto3_kinesis.type_defs` and update names if they reflect the shortened pattern.","message":"In `mypy-boto3-builder` version 8.9.0, some `TypeDef` names were shortened (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`). While this example is for CloudFront, similar changes might affect Kinesis-specific `TypeDefs` if they followed the same pattern.","severity":"breaking","affected_versions":">=8.9.0 (builder)"},{"fix":"Always ensure `boto3` is installed alongside `mypy-boto3-kinesis` or `boto3-stubs[kinesis]`.","message":"This package provides *type annotations* for Boto3; it does not replace the actual `boto3` library, which must be installed separately and is required at runtime for your application to function.","severity":"gotcha","affected_versions":"All"},{"fix":"For best type inference without explicit annotations, install the full `boto3-stubs` package with the Kinesis extra: `pip install 'boto3-stubs[kinesis]'`.","message":"When using `boto3.client()` or `boto3.session.client()` without installing `boto3-stubs` (i.e., only `mypy-boto3-kinesis`), explicit type annotations are often necessary for optimal IDE auto-completion and static analysis. For example: `client: KinesisClient = boto3.client(\"kinesis\")`.","severity":"gotcha","affected_versions":"All"},{"fix":"Use `if TYPE_CHECKING: from mypy_boto3_kinesis.client import KinesisClient else: KinesisClient = object` in your code.","message":"For Pylint compatibility and to avoid `undefined-variable` warnings when using `TYPE_CHECKING` for conditional imports, you might need to assign `object` to your client types in the non-`TYPE_CHECKING` block.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}