Kafka for the Pico ecosystem: @kafka_consumer methods and @kafka_producer clients over aiokafka.
Project description
pico-kafka
Kafka for the pico ecosystem: @kafka_consumer methods and declarative @kafka_producer clients over aiokafka.
Installation
pip install pico-kafka
Quick start
kafka:
bootstrap_servers: kafka.internal:9092
group_id: myapp
Consume — a component method per topic, JSON value decoded for you:
from pico_ioc import component
from pico_kafka import kafka_consumer
@component
class OrderProjection:
@kafka_consumer("orders")
async def on_order(self, message: dict):
...
@kafka_consumer("orders", group_id="analytics") # independent fan-out
def on_order_analytics(self, message: dict):
...
Produce — stubs, like a pico-httpx client:
from pico_kafka import kafka_producer, produce
@kafka_producer
class OrderEvents:
@produce("orders")
def order_created(self, message): ...
Semantics:
- Consumers and producers run on a dedicated background loop — works in sync scripts, FastAPI apps and workers alike, no lifespan wiring.
- Each record resolves its component through the container (prototype scope = fresh instance per record).
- A record whose handler raises is logged and skipped — offsets advance, a poison record cannot stall the partition.
- Sync produce stubs block until the broker acks; async stubs await it. Everything stops with the container.
Documentation
Full documentation: https://dperezcabrera.github.io/pico-kafka/
AI Coding Skills
Install Claude Code or OpenAI Codex skills for AI-assisted development with pico-kafka:
curl -sL https://raw.githubusercontent.com/dperezcabrera/pico-skills/main/install.sh | bash
The pico-conventions skill teaches the assistant this module's API surface and invariants; /add-component and /add-tests scaffold components and tests that use it.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pico_kafka-0.1.4.tar.gz.
File metadata
- Download URL: pico_kafka-0.1.4.tar.gz
- Upload date:
- Size: 25.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e047cee2a22598d138c0103e7b2e3d29c1d2366a3ada433e0740e81e5d32a8b3
|
|
| MD5 |
1e5d49da331ab251a495408034d37c7e
|
|
| BLAKE2b-256 |
10c8de5f5099109f848198595c30ab5476682bccdbd07005d25d4817fca4f45b
|
Provenance
The following attestation bundles were made for pico_kafka-0.1.4.tar.gz:
Publisher:
publish-to-pypi.yml on dperezcabrera/pico-kafka
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pico_kafka-0.1.4.tar.gz -
Subject digest:
e047cee2a22598d138c0103e7b2e3d29c1d2366a3ada433e0740e81e5d32a8b3 - Sigstore transparency entry: 2139297604
- Sigstore integration time:
-
Permalink:
dperezcabrera/pico-kafka@323cedf7a73be7c942d16ddc1eafcb1fdacacf25 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/dperezcabrera
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@323cedf7a73be7c942d16ddc1eafcb1fdacacf25 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pico_kafka-0.1.4-py3-none-any.whl.
File metadata
- Download URL: pico_kafka-0.1.4-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a722f79cd7021cb04ff639fd3ecf1c4a08c4c83006678303867e19719c0487b0
|
|
| MD5 |
87d71d49e19ec4fe608352c486b8ce30
|
|
| BLAKE2b-256 |
3899cada02eeca4977b8badf735b397886c31280fe0cb582625fbb5f5baaf816
|
Provenance
The following attestation bundles were made for pico_kafka-0.1.4-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on dperezcabrera/pico-kafka
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pico_kafka-0.1.4-py3-none-any.whl -
Subject digest:
a722f79cd7021cb04ff639fd3ecf1c4a08c4c83006678303867e19719c0487b0 - Sigstore transparency entry: 2139297614
- Sigstore integration time:
-
Permalink:
dperezcabrera/pico-kafka@323cedf7a73be7c942d16ddc1eafcb1fdacacf25 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/dperezcabrera
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@323cedf7a73be7c942d16ddc1eafcb1fdacacf25 -
Trigger Event:
release
-
Statement type: