Local Python SDK for kafka-light
Project description
kafkalite-python
kafkalite-python is a small Python SDK for producing and consuming events through the kafka-light gRPC transport.
Requirements
- Python
3.13+ - A reachable
kafka-lightserver endpoint
Installation
pip install kafkalite-python
Quick Start
import asyncio
from kafka_light import KafkaLightConfig, KafkaLightConsumer, KafkaLightProducer, TopicPartition
async def main() -> None:
config = KafkaLightConfig(brokers=["127.0.0.1:7171"])
producer = KafkaLightProducer(config)
await producer.start()
await producer.send_and_wait("events", value={"message": "hello"})
await producer.stop()
consumer = KafkaLightConsumer(config, group_id="example-group", topics=["events"])
await consumer.start()
message = await consumer.__anext__()
print(message.value)
await consumer.commit({TopicPartition("events"): message.offset + 1})
await consumer.stop()
asyncio.run(main())
Public API
KafkaLightConfig: broker endpoint configurationKafkaLightProducer: async producer adapterKafkaLightConsumer: async consumer adapterPublishAck,ReceivedMessage,TopicPartition: shared transport models
Notes
- The current client uses only the first configured broker endpoint.
- Consumer support is currently limited to partition
0. auto_offset_resetcurrently supports committed offsets or"earliest".
License
MIT
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 kafkalite_python-0.1.2.tar.gz.
File metadata
- Download URL: kafkalite_python-0.1.2.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e32e557e17e607ae149dfcbc19e25326203cc61ec0cf6f71dbc34e6bab3c817e
|
|
| MD5 |
63e893db919fe10703f7946e1c3085b5
|
|
| BLAKE2b-256 |
d8fe2fac2700f620415b32682071596c1eb4aff43be8c7e6ee0bce945c4f3f58
|
File details
Details for the file kafkalite_python-0.1.2-py3-none-any.whl.
File metadata
- Download URL: kafkalite_python-0.1.2-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98849ee0200498299a011f504f689a805964da60ddd19dd652dd446ddd3c1958
|
|
| MD5 |
fa11035b301457ee8e12199eae9dd1df
|
|
| BLAKE2b-256 |
f8a333cbc4dc4f75f43317f17ccbbf3aa4947f44c860cff6523030e8ff4bfdb1
|