Type annotations for boto3 DynamoDBStreams
mypy-boto3-dynamodbstreams provides comprehensive type annotations for the AWS boto3 DynamoDBStreams client, enhancing static analysis and developer experience for DynamoDB Streams operations. It is currently at version 1.42.3, generated by mypy-boto3-builder 8.12.0, with frequent releases aligning with boto3 updates and builder improvements.
Warnings
- breaking Python 3.8 support has been removed across all `mypy-boto3` packages starting with `mypy-boto3-builder` version 8.12.0. Users on Python 3.8 will need to upgrade to Python 3.9 or newer.
- breaking Type definition (TypeDef) names for packed method arguments may have changed for brevity (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`) and conflicting TypeDef postfixes moved to the end (e.g., `CreateDistributionExtraRequestTypeDef` -> `CreateDistributionRequestExtraTypeDef`). While the examples are not for DynamoDBStreams, this is a general breaking change in the builder that could affect specific TypeDefs in any generated service.
- gotcha This package only provides type annotations. You must install `boto3` separately for the actual AWS SDK functionality. The `mypy-boto3-dynamodbstreams` package is a `PEP 561` stub-only package.
- gotcha For optimal type checking, ensure your `mypy-boto3-*` package versions are compatible with your installed `boto3` version. Mismatched versions can lead to incorrect or missing type hints.
Install
-
pip install mypy-boto3-dynamodbstreams
Imports
- DynamoDBStreamsClient
from mypy_boto3_dynamodbstreams.client import DynamoDBStreamsClient
- RecordTypeDef
from mypy_boto3_dynamodbstreams.type_defs import RecordTypeDef
Quickstart
import boto3
from mypy_boto3_dynamodbstreams.client import DynamoDBStreamsClient
from mypy_boto3_dynamodbstreams.type_defs import DescribeStreamOutputTypeDef, ListStreamsOutputTypeDef
def get_dynamodb_streams_client() -> DynamoDBStreamsClient:
"""Get a typed DynamoDBStreams client."""
client: DynamoDBStreamsClient = boto3.client("dynamodbstreams")
return client
if __name__ == "__main__":
# Example usage with type checking
ddb_streams_client = get_dynamodb_streams_client()
# List streams
list_response: ListStreamsOutputTypeDef = ddb_streams_client.list_streams(Limit=1)
print("DynamoDB Streams found:", list_response.get("Streams"))
# Describe a specific stream (replace with a real ARN if you have one)
if list_response.get("Streams"):
stream_arn = list_response["Streams"][0]["StreamArn"]
describe_response: DescribeStreamOutputTypeDef = ddb_streams_client.describe_stream(StreamArn=stream_arn)
print(f"Description for {stream_arn}:", describe_response.get("StreamDescription"))