kafka-python
Pure Python client for Apache Kafka
Decision gist · record as of 2026-08-14
Yes. kafka-python is a mature, actively maintained library (release 10 days old, 5901 GitHub stars) with no known vulnerabilities, low install friction, and permissive licensing. It is suitable for any Python project needing Kafka integration without JVM dependencies. Choose it if you need a pure-Python client; if maximum throughput is critical, verify performance characteristics for your workload.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.8 or later; requires a running Kafka broker accessible at the specified bootstrap_servers address.
- Low friction: pure Python with no external runtime dependencies, installs via wheel.
- Actively maintained with a release 10 days old and last commit on 2026-08-07.
License · maintenance · safety
Apache-2.0 (permissive) — Apache-2.0 permissive license allows commercial use, modification, and distribution with minimal restrictions; suitable for most projects.
last release 2026-08-04 (10 days) · last repo commit 2026-08-07 · 5,901 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 28,585,530 downloads/mo, #833 on PyPI
Alternatives
Verify before relying
pip install kafka-python
from kafka import KafkaConsumer
consumer = KafkaConsumer('my_topic', bootstrap_servers='localhost:9092')
for msg in consumer:
print(msg.value)
from kafka import KafkaProducer
producer = KafkaProducer(bootstrap_servers='localhost:9092')
producer.send('my_topic', b'hello')- Performance characteristics compared to official Java client under high-throughput scenarios.
- Behavior and compatibility with Kafka versions beyond those explicitly tested in CI.
- Overhead of pure-Python implementation vs. compiled alternatives for latency-sensitive use cases.
What it is and what it does
kafka-python is a pure-Python client library for Apache Kafka that implements the Kafka protocol without external compiled dependencies or C extensions. It provides high-level APIs for producing and consuming messages, managing consumer groups, and administering Kafka clusters, plus command-line interfaces for quick interactive tasks. The library is designed to mirror the behavior of the official Java client, making it familiar to developers already using Kafka.
Version 3.0 introduces a dynamically generated protocol stack from Apache Kafka JSON schemas, performance optimizations through compiled bytecode caching, and expanded support for Kafka Improvement Proposals (KIPs) including cooperative rebalancing, rack-aware fetching, and transactional producer features. It requires Python 3.8 or later. Optional compression support is available via python-lz4, python-snappy, or python-zstandard; gzip compression works out of the box via the standard library.
Use it for
- Build message-driven applications that produce or consume from Kafka topics without requiring a JVM or compiled dependencies.
- Automate Kafka cluster administration tasks via CLI (topic creation, cluster inspection) when Java tools are unavailable.
- Implement consumer groups with automatic partition assignment and offset management for scalable message processing.
- Send transactional messages with exactly-once semantics using the producer's transaction API.
- Deserialize and serialize messages in JSON or custom formats using configurable serializer/deserializer classes.
- Monitor Kafka client performance through built-in metrics APIs on consumer and producer instances.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
kafka-python is a mature, actively maintained library (release 10 days old, 5901 GitHub stars) with no known vulnerabilities, low install friction, and permissive licensing. It is suitable for any Python project needing Kafka integration without JVM dependencies. Choose it if you need a pure-Python client; if maximum throughput is critical, verify performance characteristics for your workload.
Install
kafka-python on PyPI
Before you install
Low friction: pure Python with no external runtime dependencies, installs via wheel. Actively maintained with a release 10 days old and last commit on 2026-08-07. Optional crc32c dependency available for CPU-intensive checksum offloading.
Requires Python 3.8 or later; requires a running Kafka broker accessible at the specified bootstrap_servers address.
License in practice
Apache-2.0 permissive license allows commercial use, modification, and distribution with minimal restrictions; suitable for most projects.
Quickstart
pip install kafka-python
from kafka import KafkaConsumer
consumer = KafkaConsumer('my_topic', bootstrap_servers='localhost:9092')
for msg in consumer:
print(msg.value)
from kafka import KafkaProducer
producer = KafkaProducer(bootstrap_servers='localhost:9092')
producer.send('my_topic', b'hello')
Verify before relying
- Performance characteristics compared to official Java client under high-throughput scenarios.
- Behavior and compatibility with Kafka versions beyond those explicitly tested in CI.
- Overhead of pure-Python implementation vs. compiled alternatives for latency-sensitive use cases.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 10 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 28,585,530 / month, #833 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries :: Python Modules |
Evidence: kafka_python-3.0.10-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “kafka client python”
- kafka-pythonPure-Python Apache Kafka client library providing high-level…
- kafkaA pure-Python client library for Apache Kafka that provides…
- confluent-kafkaProvides a high-performance Python client for Apache Kafka that wraps…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also kafka · aiokafka · kafka-python-ng · confluent-kafka · quixstreams · opentelemetry-instrumentation-kafka-python · opentelemetry-instrumentation-confluent-kafka · apache-airflow-providers-apache-kafka · kombu · opentelemetry-instrumentation-aiokafka