A well-documented, fully type-hinted Kafka client for Python
Project description
typedkafka
A well-documented, fully type-hinted Kafka client for Python.
Overview
typedkafka provides a modern Python interface to Apache Kafka with comprehensive documentation, full type hints, and developer-friendly features. Built on confluent-kafka for performance and reliability.
Key Features:
- Full type hints and comprehensive docstrings
- JSON, string, and bytes message helpers
- Transaction support with context managers
- Async producer and consumer (
asyncio) - Retry utilities with exponential backoff
- Pluggable serializer framework (JSON, String, Avro/Schema Registry)
- Testing utilities (MockProducer/MockConsumer)
- Type-safe configuration builders with validation
- Admin client for topic management
Installation
pip install typedkafka
# With Avro/Schema Registry support
pip install typedkafka[avro]
Requires Python 3.9+.
Quick Start
from typedkafka import KafkaProducer
with KafkaProducer({"bootstrap.servers": "localhost:9092"}) as producer:
producer.send("my-topic", b"Hello, Kafka!")
producer.send_json("events", {"user_id": 123, "action": "click"})
producer.flush()
from typedkafka import KafkaConsumer
with KafkaConsumer({"bootstrap.servers": "localhost:9092", "group.id": "my-group"}) as consumer:
consumer.subscribe(["my-topic"])
for msg in consumer:
print(msg.value_as_json())
consumer.commit(msg)
See the examples/ directory for more: transactions, async, retry, serializers, batch send, testing mocks, and config builders.
Development
git clone https://github.com/Jgprog117/typedkafka.git
cd typedkafka
pip install -e ".[dev]"
pytest
ruff check .
mypy src
License
MIT License - see LICENSE file for details.
Changelog
See CHANGELOG.md for the full release history.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file typedkafka-0.3.3.tar.gz.
File metadata
- Download URL: typedkafka-0.3.3.tar.gz
- Upload date:
- Size: 37.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ee3fc821c9c0c135dd1c79d5281439ee1c7f6aac300677097324460d14ab76c
|
|
| MD5 |
988262a4b910df3976bd63eda8bf9915
|
|
| BLAKE2b-256 |
51510adb11a55808b1e31ed381f776b70ba706147b8ac9aef54fd9092b803a02
|
Provenance
The following attestation bundles were made for typedkafka-0.3.3.tar.gz:
Publisher:
publish.yml on Jgprog117/typedkafka
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
typedkafka-0.3.3.tar.gz -
Subject digest:
2ee3fc821c9c0c135dd1c79d5281439ee1c7f6aac300677097324460d14ab76c - Sigstore transparency entry: 885328319
- Sigstore integration time:
-
Permalink:
Jgprog117/typedkafka@bd2b3e5ccee8096197e837ecc66241ca2fa91585 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/Jgprog117
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bd2b3e5ccee8096197e837ecc66241ca2fa91585 -
Trigger Event:
release
-
Statement type:
File details
Details for the file typedkafka-0.3.3-py3-none-any.whl.
File metadata
- Download URL: typedkafka-0.3.3-py3-none-any.whl
- Upload date:
- Size: 27.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57db32737cd2be41f2fbf02cebc7b236088f76667da1ac265dcd891b42719b1f
|
|
| MD5 |
7d9d0003c38367b90eb0622cb9291eb6
|
|
| BLAKE2b-256 |
43dbbb262795e98faa91273731c3f0b53be289056c415df9d5dbee3d09b5dd5f
|
Provenance
The following attestation bundles were made for typedkafka-0.3.3-py3-none-any.whl:
Publisher:
publish.yml on Jgprog117/typedkafka
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
typedkafka-0.3.3-py3-none-any.whl -
Subject digest:
57db32737cd2be41f2fbf02cebc7b236088f76667da1ac265dcd891b42719b1f - Sigstore transparency entry: 885328378
- Sigstore integration time:
-
Permalink:
Jgprog117/typedkafka@bd2b3e5ccee8096197e837ecc66241ca2fa91585 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/Jgprog117
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bd2b3e5ccee8096197e837ecc66241ca2fa91585 -
Trigger Event:
release
-
Statement type: