Skip to main content

Local Python SDK for kafkalite

Project description

kafkalite-python

kafkalite-python is a small Python SDK for producing and consuming events through the kafkalite gRPC transport.

Requirements

  • Python 3.13+
  • A reachable kafkalite server endpoint

Installation

pip install kafkalite-python

Quick Start

import asyncio

from kafkalite import KafkaliteConfig, KafkaliteConsumer, KafkaliteProducer, TopicPartition


async def main() -> None:
    config = KafkaliteConfig(brokers=["127.0.0.1:7171"])

    producer = KafkaliteProducer(config)
    await producer.start()
    await producer.send_and_wait("events", value={"message": "hello"})
    await producer.stop()

    consumer = KafkaliteConsumer(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

  • KafkaliteConfig: broker endpoint configuration
  • KafkaliteProducer: async producer adapter
  • KafkaliteConsumer: 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.3.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.3-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file kafkalite_python-0.1.3.tar.gz.

File metadata

  • Download URL: kafkalite_python-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 45a6261d0d1f2c0f849fa26b532ad5f27e95f2825b8424383ef1b4d63fc95f3f
MD5 58f5dbb4ce48d0fc6913d92450ff47f6
BLAKE2b-256 2932ebadc8b69179557c4977f26a8d95bc6fbaeb68f138a07b08647e731a55fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kafkalite_python-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5ad8f1285de667205f474d8f9b2bebf2ffd8fd42b361386d6e1f445258bd7626
MD5 a61175644262e8167c4ea1a293083c2f
BLAKE2b-256 cec77341ed3220f9ecfde6b0d1d49694e6ad9e6a53ef6843ff957e6c9697ff20

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