{"id":8733,"library":"types-aiobotocore-kinesis","title":"Type Annotations for aiobotocore Kinesis","description":"This library provides PEP 561 compatible type annotations for the `aiobotocore` Kinesis service. It enhances development with static type checking, auto-completion, and improved code readability when working with the asynchronous AWS client. The `types-aiobotocore` project, generated by `mypy-boto3-builder`, has a rapid release cadence, ensuring type definitions are kept up-to-date with `aiobotocore` versions.","status":"active","version":"3.4.0","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["typing","aws","aiobotocore","kinesis","stubs","mypy","type-hints"],"install":[{"cmd":"pip install types-aiobotocore-kinesis aiobotocore","lang":"bash","label":"Install type stubs and runtime library"}],"dependencies":[{"reason":"This package provides type stubs for the 'aiobotocore' library; the runtime library must be installed for code execution.","package":"aiobotocore"},{"reason":"Commonly used type checker to leverage these type annotations, though pyright or other type checkers also work.","package":"mypy","optional":true}],"imports":[{"note":"Type stubs are imported from their dedicated `types-` package, not directly from the runtime library.","wrong":"from aiobotocore.kinesis.client import KinesisClient","symbol":"KinesisClient","correct":"from types_aiobotocore_kinesis.client import KinesisClient"},{"note":"TypedDicts and other type definitions are also imported from the `types-` package.","wrong":"from aiobotocore.kinesis.type_defs import PutRecordRequestRequestTypeDef","symbol":"PutRecordRequestRequestTypeDef","correct":"from types_aiobotocore_kinesis.type_defs import PutRecordRequestRequestTypeDef"}],"quickstart":{"code":"import asyncio\nfrom aiobotocore.session import get_session\nfrom types_aiobotocore_kinesis.client import KinesisClient\nfrom types_aiobotocore_kinesis.type_defs import PutRecordRequestRequestTypeDef\nimport os\n\nasync def put_kinesis_record(stream_name: str, data: str, partition_key: str):\n    session = get_session()\n    async with session.create_client(\"kinesis\", region_name=os.environ.get('AWS_REGION', 'us-east-1')) as client:  # type: KinesisClient\n        request_params: PutRecordRequestRequestTypeDef = {\n            \"StreamName\": stream_name,\n            \"Data\": data.encode('utf-8'),\n            \"PartitionKey\": partition_key,\n        }\n        response = await client.put_record(**request_params)\n        print(f\"Shard ID: {response['ShardId']}, Sequence Number: {response['SequenceNumber']}\")\n\nasync def main():\n    # Example usage: Replace with your stream name, data, and partition key\n    # Ensure AWS_REGION environment variable is set or passed to create_client\n    # Also ensure AWS credentials are configured.\n    await put_kinesis_record(\"my-test-stream\", \"Hello Kinesis!\", \"my-partition-key\")\n\nif __name__ == \"__main__\":\n    # For demonstration, setting dummy env var if not present\n    if 'AWS_REGION' not in os.environ:\n        os.environ['AWS_REGION'] = 'us-east-1'\n    asyncio.run(main())\n","lang":"python","description":"This quickstart demonstrates how to use `types-aiobotocore-kinesis` with `aiobotocore` to put a record into an Amazon Kinesis stream. It shows how to explicitly type the Kinesis client and the request parameters using `TypedDicts` for improved type checking and IDE auto-completion. This example requires `aiobotocore` and valid AWS credentials configured for the specified region."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer. If stuck on Python 3.8, use an older version of `types-aiobotocore-kinesis` (e.g., <3.4.0) that was generated with `mypy-boto3-builder` <8.12.0.","message":"Support for Python 3.8 has been removed in `mypy-boto3-builder` version 8.12.0, which generates these type stubs. Packages generated with this builder version and later will only support Python 3.9 and higher.","severity":"breaking","affected_versions":">=3.4.0 (for types-aiobotocore-kinesis), >=8.12.0 (for mypy-boto3-builder)"},{"fix":"Ensure your type checker and IDE are updated to recent versions that fully support PEP 561 packages. No direct code change is typically required for end-users.","message":"The `mypy-boto3-builder` migrated to PEP 561 package format in version 8.12.0. While largely internal, this change might affect how some tools discover or interact with the stub packages.","severity":"breaking","affected_versions":">=3.4.0 (for types-aiobotocore-kinesis), >=8.12.0 (for mypy-boto3-builder)"},{"fix":"Always install both the type stubs and the runtime library: `pip install types-aiobotocore-kinesis aiobotocore`.","message":"This package provides *only* type annotations. The actual `aiobotocore` library must be installed separately for your code to run at runtime. Failure to install `aiobotocore` will result in a `ModuleNotFoundError`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Disable PyCharm's internal type checker and use an external tool like `mypy` or `pyright`. Alternatively, install `types-aiobotocore-lite` for the specific service (if available) which offers a lighter set of annotations.","message":"Users of PyCharm may experience slow performance or high CPU usage due to how PyCharm's type checker handles `Literal` overloads in these generated stubs. It is recommended to use `mypy` or `pyright` for type checking, or to consider `types-aiobotocore-lite` packages as a workaround if PyCharm's internal type checker is preferred.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Install the `aiobotocore` library: `pip install aiobotocore` (or `pip install types-aiobotocore-kinesis aiobotocore` to get both).","cause":"The `types-aiobotocore-kinesis` package only provides type hints. The actual `aiobotocore` library, which contains the runtime code, is not installed.","error":"ModuleNotFoundError: No module named 'aiobotocore'"},{"fix":"Install the Kinesis-specific type stubs: `pip install types-aiobotocore-kinesis`. If you need stubs for other services, consider `types-aiobotocore[essential]` or specific service packages.","cause":"You have installed `aiobotocore` but not its corresponding type stubs, leading type checkers (like mypy) to report missing type information.","error":"error: Missing type stub for 'aiobotocore'"},{"fix":"Consult the `types-aiobotocore-kinesis` documentation or your IDE's auto-completion for the correct argument types (e.g., `StreamName` expects a string).","cause":"A Kinesis client method was called with an argument of the wrong type, detected by the type stubs.","error":"error: Argument \"StreamName\" to \"put_record\" of \"KinesisClient\" has incompatible type \"int\"; expected \"str\""}]}