mypy-boto3-kinesisanalytics Type Stubs
mypy-boto3-kinesisanalytics provides explicit type annotations for the `boto3` KinesisAnalytics service. It is currently at version 1.42.3 and is part of the `mypy-boto3-builder` project, which frequently releases updates to synchronize with `boto3` releases and improve type-checking capabilities.
Warnings
- breaking Python 3.8 support was removed for all `mypy-boto3` packages, including `mypy-boto3-kinesisanalytics`, starting with `mypy-boto3-builder` version 8.12.0. Users on Python 3.8 will need to use an older version of the stubs or upgrade their Python interpreter.
- breaking TypeDef naming conventions changed in `mypy-boto3-builder` version 8.9.0. This affects how generated TypedDicts are named, for example, `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef` and `CreateDistributionExtraRequestTypeDef` became `CreateDistributionRequestExtraTypeDef`. This may break explicit imports of these TypedDicts.
- gotcha The `mypy-boto3-kinesisanalytics` package only provides type annotations. The `boto3` library itself must be installed and available in your environment for the code to run and interact with AWS services.
- gotcha To ensure accurate type checking, it's crucial to keep your `boto3` and `mypy-boto3-kinesisanalytics` versions synchronized. Mismatched versions can lead to incorrect type hints or missed errors.
- gotcha As of `mypy-boto3-builder` version 8.12.0, all packages migrated to PEP 561. This means packages now include a `py.typed` file. While this generally improves type discovery, specific configurations for `mypy` or IDEs might need adjustments if issues arise with stub discovery.
Install
-
pip install mypy-boto3-kinesisanalytics boto3
Imports
- KinesisAnalyticsClient
from mypy_boto3_kinesisanalytics.client import KinesisAnalyticsClient
- ApplicationSummaryTypeDef
from mypy_boto3_kinesisanalytics.type_defs import ApplicationSummaryTypeDef
- ApplicationStatusType
from mypy_boto3_kinesisanalytics.literals import ApplicationStatusType
Quickstart
import boto3
from mypy_boto3_kinesisanalytics.client import KinesisAnalyticsClient
from typing import TYPE_CHECKING
# The actual boto3 client is untyped by default
client = boto3.client('kinesisanalytics')
# For type checking, assert the client type if not using session.client overloads
# Most modern IDEs and mypy should infer correctly if boto3-stubs is installed,
# but explicit typing ensures maximum compatibility and clarity.
if TYPE_CHECKING:
kinesisanalytics_client: KinesisAnalyticsClient = client
else:
kinesisanalytics_client = client
try:
# Example: List Kinesis Analytics applications
response = kinesisanalytics_client.list_applications()
print(f"Found {len(response.get('ApplicationSummaries', []))} Kinesis Analytics applications:")
for app in response.get('ApplicationSummaries', []):
print(f" - Name: {app['ApplicationName']}, Status: {app['ApplicationStatus']}")
except Exception as e:
print(f"Error listing applications: {e}")