mypy-boto3-kafkaconnect

1.42.47 · active · verified Sat Apr 11

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

Install

Imports

Quickstart

This example demonstrates how to use `mypy-boto3-kafkaconnect` to provide type hints for your `boto3` KafkaConnect client. The `TYPE_CHECKING` block is crucial for mypy to apply the custom types without affecting runtime behavior. You still instantiate the client using `boto3.client('kafkaconnect')`.

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

view raw JSON →