Skip to main content

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-light server 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 configuration
  • KafkaLightProducer: async producer adapter
  • KafkaLightConsumer: async consumer adapter
  • PublishAck, 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_reset currently supports committed offsets or "earliest".

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kafkalite_python-0.1.2.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kafkalite_python-0.1.2-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

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

Hashes for kafkalite_python-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e32e557e17e607ae149dfcbc19e25326203cc61ec0cf6f71dbc34e6bab3c817e
MD5 63e893db919fe10703f7946e1c3085b5
BLAKE2b-256 d8fe2fac2700f620415b32682071596c1eb4aff43be8c7e6ee0bce945c4f3f58

See more details on using hashes here.

File details

Details for the file kafkalite_python-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for kafkalite_python-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 98849ee0200498299a011f504f689a805964da60ddd19dd652dd446ddd3c1958
MD5 fa11035b301457ee8e12199eae9dd1df
BLAKE2b-256 f8a333cbc4dc4f75f43317f17ccbbf3aa4947f44c860cff6523030e8ff4bfdb1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page