mypy-boto3-keyspacesstreams Type Annotations
mypy-boto3-keyspacesstreams provides type annotations for the `boto3` library's KeyspacesStreams service, enabling static type checking with tools like MyPy. It is part of the `mypy-boto3` project, which generates stubs for all AWS services supported by `boto3`. The current version is 1.42.59, generated by `mypy-boto3-builder 8.12.0`, with frequent updates to align with `boto3` releases.
Warnings
- breaking As of `mypy-boto3-builder` version 8.12.0 (which generated `mypy-boto3-keyspacesstreams 1.42.59`), support for Python 3.8 has been removed. Users must use Python 3.9 or higher.
- breaking Starting with `mypy-boto3-builder` version 8.9.0, some `TypeDef` naming conventions changed (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`). This might break existing type annotations in your codebase if you've explicitly referenced such types.
- gotcha This package provides only type stubs. The actual `boto3` library must be installed separately for any runtime functionality. These stubs enhance development-time type checking but do not add runtime code.
- gotcha Type stubs are generated based on specific `boto3` versions. For the most accurate type checking, it is recommended to keep `mypy-boto3-keyspacesstreams` and `boto3` versions closely synchronized. Major `boto3` updates may introduce new features or changes not reflected in older stubs.
Install
-
pip install mypy-boto3-keyspacesstreams
Imports
- KeyspacesStreamsClient
from mypy_boto3_keyspacesstreams.client import KeyspacesStreamsClient
- ListStreamsOutputTypeDef
from mypy_boto3_keyspacesstreams.type_defs import ListStreamsOutputTypeDef
Quickstart
import boto3
from mypy_boto3_keyspacesstreams.client import KeyspacesStreamsClient
from typing import TYPE_CHECKING
# The actual boto3 client is not affected by the stub package at runtime.
# Type checking tools like MyPy will use the imported KeyspacesStreamsClient for analysis.
# It's good practice to guard stub imports if they might not be available at runtime
# in some environments, though mypy-boto3 stubs are typically installed alongside boto3.
if TYPE_CHECKING:
client: KeyspacesStreamsClient = boto3.client("keyspaces-streams")
else:
client = boto3.client("keyspaces-streams")
# Example operation: list streams (ensure your AWS credentials are configured)
try:
response = client.list_streams(MaxResults=1)
print("Successfully listed Keyspaces Streams (first entry if any):")
if response.get("streams"):
print(response["streams"][0])
else:
print("No streams found.")
except Exception as e:
print(f"An error occurred: {e}")