mypy-boto3-kafkaconnect
mypy-boto3-kafkaconnect provides type annotations for the boto3 AWS KafkaConnect service, generated by mypy-boto3-builder. It aims to offer full type-hinting support for `boto3` clients, resources, and paginators. The current version is 1.42.47, and releases are frequent, typically in sync with `boto3` updates and `mypy-boto3-builder` enhancements.
Warnings
- breaking Support for Python 3.8 was removed in `mypy-boto3-builder` version 8.12.0. If you are using `mypy-boto3-kafkaconnect` with Python 3.8, you must upgrade your Python version to 3.9 or newer.
- gotcha `mypy-boto3-kafkaconnect` provides *type annotations* only. It is not a runtime replacement for `boto3`. You must install both `boto3` and the `mypy-boto3-kafkaconnect` package to use these type hints effectively.
- breaking Version 8.9.0 of `mypy-boto3-builder` introduced breaking changes in TypeDef naming conventions (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`). This affects specific TypeDef names across all generated service packages.
- gotcha For optimal type checking, keep your `mypy-boto3-kafkaconnect` version in sync with your `boto3` version. Discrepancies can lead to incorrect type hints if the underlying `boto3` API changes without a corresponding update in the stubs.
Install
-
pip install mypy-boto3-kafkaconnect -
pip install boto3
Imports
- KafkaConnectClient
from mypy_boto3_kafkaconnect import KafkaConnectClient
Quickstart
import boto3
from mypy_boto3_kafkaconnect import KafkaConnectClient
from typing import TYPE_CHECKING
if TYPE_CHECKING:
# This block is only for type checking, not for runtime
client: KafkaConnectClient = boto3.client("kafkaconnect")
# Example method call with type hints
response = client.list_custom_plugins()
print(f"Custom plugins: {response.get('customPlugins')}")
else:
# Runtime code without specific type hints
client = boto3.client("kafkaconnect")
response = client.list_custom_plugins()
print(f"Custom plugins: {response.get('customPlugins')}")
# To verify the type hints with mypy:
# 1. Save this code as 'app.py'
# 2. Run: mypy app.py