confluent-kafka-stubs
Stub files for confluent-kafka.
What it is and what it does
confluent-kafka-stubs is a type-stub-only package that adds Python type hints to the confluent-kafka library. It contains no runtime code—only .pyi stub files—and is designed to be installed alongside confluent-kafka so that type checkers like mypy and language servers can understand the types in confluent-kafka's API.
The package covers core classes and functions in the cimpl module (KafkaError, KafkaException, Message, Producer, Consumer, and others) but is explicitly incomplete. The maintainer notes it as a work in progress, and the project has not been updated since its initial release. It requires Python 3.11 or later and is not officially endorsed by Confluent.
Use it for:
- Enable mypy type checking on code that uses confluent-kafka producers and consumers
- Get IDE autocompletion and type hints for confluent-kafka classes like Producer and Consumer
- Catch type errors in Kafka client code during development rather than at runtime
- Improve code documentation and maintainability by making confluent-kafka's API types explicit
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides type hints and stubs for the confluent-kafka package to enable static type checking with mypy and IDE autocompletion.
Yes, if you need type checking for confluent-kafka and can tolerate incomplete coverage. The low install friction and permissive license make it a low-risk addition to a type-checking workflow. However, the abandoned status and 1159-day gap since the last release mean you should verify that the stubs remain compatible with your confluent-kafka version and accept that some modules and classes may lack type hints.
Install
confluent-kafka-stubs on PyPI
pip
pip install confluent-kafka-stubsuv
uv add confluent-kafka-stubspoetry
poetry add confluent-kafka-stubsInstalling confluent-kafka-stubs
Before you install
Installation is straightforward with no runtime dependencies. However, the package is abandoned—last release was 1159 days ago—and marked as a work in progress with incomplete type coverage.
License in practice
Licensed under Apache-2.0 (permissive), so you can use it freely in commercial and open-source projects without significant restrictions.
Quickstart
pip install confluent-kafka-stubs
# In your Python code with mypy enabled:
from confluent_kafka import Producer
producer: Producer = Producer({})
Requires Python 3.11 or later; confluent-kafka must be installed separately for the stubs to be useful.
Verify before relying
- Whether type coverage has improved or regressed since the last release
- Whether the stubs remain compatible with recent confluent-kafka versions
- Whether _AdminClientImpl and unlisted modules have been typed in practice by users
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.11,<4.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 1,159 days since the last release |
| First released | |
| Downloads | 1,173,132/month — #4,267 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: confluent_kafka_stubs-0.0.3-py3-none-any.whl
Keywords: kafka, stubs, types
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
types-confluent-kafkaProvides type hints and stub files for the…
permissive · top 5,000 on PyPI
mypy-boto3-kafkaProvides type annotations and IDE…
permissive · top 15,000 on PyPI
pyspark-stubsProvides type stubs for PySpark to enable…
permissive · top 15,000 on PyPI
ob-metaflow-stubsProvides type hints and stub files for the…
permissive · top 15,000 on PyPI
confluent-kafkaProvides a high-performance Python client for…
permissive · top 1,000 on PyPI
opentelemetry-instrumentation-confluent-kafkaAdds distributed tracing to confluent-kafka…
permissive · top 5,000 on PyPI
confluent_avroSerializes and deserializes Avro data according…
permissive · top 15,000 on PyPI
kafkaA pure-Python client library for Apache Kafka…
permissive · top 15,000 on PyPI
kafka-schema-registryIntegrates Kafka with Confluent Schema Registry…
permissive · top 15,000 on PyPI
kafka-python-ngA Python client library for Apache Kafka that…
permissive · top 5,000 on PyPI