Skip to main content

Add a short description here!

Project description

Project generated with PyScaffold

kafka-python-dataclasses

Structured messages for your kafka projects

Kafka is a really complex library and dealing with bytes can be taxing. Use these wonderful structured Kafka classes instead!

Basic consuming:

from dataclasses import dataclass
from kafka_dataclasses import StructuredKafkaConsumer


@dataclass
class MyKafkaMessage:
   value: str


for message in StructuredKafkaConsumer(['my_topic']):
   assert type(message) == MyKafkaMessage

Basic producing:

from dataclasses import dataclass
from kafka_dataclasses import StructuredKafkaProducer


@dataclass
class MyKafkaMessage:
   value: str


StructuredKafkaProducer().send('my_topic', MyKafkaMessage("Hello, world!"))

This works on deeply nested dataclasses as well! In theory it will also work on attrs classes, since the unstructuring library, cattrs, supports attrs out of the box.

Note

This project has been set up using PyScaffold 4.2.1. For details and usage information on PyScaffold see https://pyscaffold.org/.

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-python-dataclasses-2022.4.22.2.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file kafka-python-dataclasses-2022.4.22.2.tar.gz.

File metadata

File hashes

Hashes for kafka-python-dataclasses-2022.4.22.2.tar.gz
Algorithm Hash digest
SHA256 c7f140feb605b84f233a83452baffa9163a2c34885b589841656975575ac1797
MD5 6e2db88eb32b444bc7e48bc1906a423f
BLAKE2b-256 da0da03952bd32b1e2b2565909bd3a1dc3f5ed4bdb84d7049e21f93b4a885cc5

See more details on using hashes here.

File details

Details for the file kafka_python_dataclasses-2022.4.22.2-py3-none-any.whl.

File metadata

File hashes

Hashes for kafka_python_dataclasses-2022.4.22.2-py3-none-any.whl
Algorithm Hash digest
SHA256 610640164d742faa4dfc18803e27f95a24bbb40ef831590a5b3ba39feea070dc
MD5 8924923aab59c147f2ae9b79723ac37f
BLAKE2b-256 5ae8dfd819f7ed3085c9ea4b38371a2a3b7745d7c795bb657461d188a6b48111

See more details on using hashes here.

Supported by

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