Skip to main content

Local Python SDK for kafka-light

Project description

kafka-light-python

kafka-light-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 kafka-light-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

kafka_light_python-0.1.1.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

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

kafka_light_python-0.1.1-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file kafka_light_python-0.1.1.tar.gz.

File metadata

  • Download URL: kafka_light_python-0.1.1.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for kafka_light_python-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f515d4aeb97c031de86b4601edb10eaa3b878c81154f3457d7994be248ed618c
MD5 777441218b991e13c0ef0cd5b5c7c187
BLAKE2b-256 c43a104be7f9c3a1423acd28ef411ec426ae715ce79351906568247f0ef472f3

See more details on using hashes here.

File details

Details for the file kafka_light_python-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for kafka_light_python-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5244bb197bc15fd2886d341b5922e73bb00fb8d958bca58288c05c23db8beeee
MD5 467fc17c59f19db37e24ace19d4bf113
BLAKE2b-256 ec9ef6bdca72a85874dd91974c5cf8ae0e1c5cda2ee2220108b15fe35ff6572f

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