Type Annotations for Boto3 Kinesis Analytics V2
This library provides PEP 561 compliant type annotations for the `boto3` AWS SDK, specifically for the Kinesis Analytics V2 service. Generated by `mypy-boto3-builder`, it ensures `mypy`, `pyright`, and popular IDEs like VSCode and PyCharm offer accurate type checking and autocomplete for `boto3` clients. It's actively maintained, with new releases frequently, often mirroring `boto3` updates, and is currently at version 1.42.80.
Warnings
- breaking Support for Python 3.8 has been removed in `mypy-boto3-builder` version 8.12.0. Users on Python 3.8 should update their Python version or pin to an older `mypy-boto3-kinesisanalyticsv2` release.
- breaking Type definition names (TypedDicts) were changed in `mypy-boto3-builder` version 8.9.0 for brevity and consistency. For example, `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`, and `Extra` postfixes were moved to the end of names.
- gotcha Explicit type annotations (e.g., `client: KinesisAnalyticsV2Client`) are highly recommended for optimal type checking and IDE auto-completion, especially when using standalone service packages or `boto3-stubs-lite`. Some IDEs (like PyCharm) may also have performance issues with extensive Literal overloads found in the `boto3-stubs` full package.
- gotcha The `mypy-boto3` project underwent a significant change in builder version 8.9.0, moving the 'legacy' `mypy-boto3` package to a separate product. Users migrating from older, monolithic `mypy-boto3` installations might need to adjust their dependency management and import paths to the new `types-boto3` or individual `mypy-boto3-service` packages.
Install
-
pip install mypy-boto3-kinesisanalyticsv2 boto3 -
pip install 'boto3-stubs[kinesisanalyticsv2]' boto3
Imports
- KinesisAnalyticsV2Client
from mypy_boto3_kinesisanalyticsv2 import KinesisAnalyticsV2Client
Quickstart
import boto3
from mypy_boto3_kinesisanalyticsv2 import KinesisAnalyticsV2Client
from typing import TYPE_CHECKING
import os
# Best practice: use explicit type annotation for the client
# The TYPE_CHECKING block ensures mypy_boto3 is only a dev dependency.
if TYPE_CHECKING:
client: KinesisAnalyticsV2Client
else:
client = boto3.client(
"kinesisanalyticsv2",
region_name=os.environ.get("AWS_REGION", "us-east-1"),
aws_access_key_id=os.environ.get("AWS_ACCESS_KEY_ID", ""),
aws_secret_access_key=os.environ.get("AWS_SECRET_ACCESS_KEY", ""),
)
print(f"KinesisAnalyticsV2 Client: {client}")
# Example operation: List applications
# The type stubs provide auto-completion and type checking for methods and response shapes.
try:
response = client.list_applications()
# Accessing response elements will now be type-checked
print("Applications found:", [app["ApplicationName"] for app in response.get("ApplicationSummaries", [])])
except Exception as e:
print(f"Error listing Kinesis Analytics V2 applications: {e}")