kaflow is a simple framework that allows you to build Kafka streams processing aplications in Python with ease.
Some of the features offered by kaflow:
- Dependency Injection system inspired by FastAPI and xpresso, and backed by di.
- Automatic deserialization of incoming messages and serialization of outgoing messages. Supports popular formats like
JSON,AvroorProtobuf. - Message validation thanks to pydantic.
Requirements
Python 3.8+
Installation
pip install kaflow
Example
from kaflow import (
FromHeader,
FromKey,
FromValue,
Json,
Kaflow,
Message,
MessageOffset,
MessagePartition,
MessageTimestamp,
String,
)
from pydantic import BaseModel
class UserClick(BaseModel):
user_id: int
url: str
timestamp: int
class Key(BaseModel):
environment: str
app = Kaflow(name="AwesomeKakfaApp", brokers="localhost:9092")
@app.consume(topic="user_clicks", sink_topics=["user_clicks_json"])
async def consume_user_clicks(
message: FromValue[Json[UserClick]],
key: FromKey[Json[Key]],
x_correlation_id: FromHeader[String[str]],
x_request_id: FromHeader[String[str]],
partition: MessagePartition,
offset: MessageOffset,
timestamp: MessageTimestamp,
) -> Message:
# Do something with the message
...
# Publish to another topic
return Message(value=b'{"user_clicked": "true"}')
app.run()
Metadata
Release files for kaflow 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kaflow-0.2.2.tar.gz | 21.1 kB | Without provenance | Details for kaflow-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kaflow-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for kaflow-0.2.2-py3-none-any.whl |
Total release size: 43.9 kB
Release files / kaflow-0.2.2.tar.gz
| Download URL | kaflow-0.2.2.tar.gz |
|---|---|
| Size | 21.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a8dd0b54b3ef24260077d4a6509463a13cc5cd1ca14db91569dcde242035409c
|
|
BLAKE2b-256 checksum How to use checksums |
8c75da25045f7ff91faa5d52e7d94cdb522bb295bf7ae21d08a4c21557df065e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.3
|
Release files / kaflow-0.2.2-py3-none-any.whl
| Download URL | kaflow-0.2.2-py3-none-any.whl |
|---|---|
| Size | 22.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
57a21b8a7e25dbc81d5385f7292204afc05dd6399ff982d7926bfde0b57f3aec
|
|
BLAKE2b-256 checksum How to use checksums |
56423e50b98b19fda9b34cfe3eca666920e956fc0ef5710dbc5b3fee35043874
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.3
|
Security for kaflow 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.