Skip to main content

A type-safe, sync/async Python messaging library.

Project description

Protobunny

[!WARNING] The project is in early development.

Protobunny is the open-source evolution of AM-Flow's internal messaging library. While the original was purpose-built for RabbitMQ, this version has been completely re-engineered to provide a unified, type-safe interface for several message brokers, including Redis, NATS, and MQTT.

It simplifies messaging for asynchronous message handling by providing:

  • A clean “message-first” API by using your protobuf definitions
  • Message publishing/subscribing with typed topics
  • Supports "task-like" queues (shared/competing consumers) vs. broadcast subscriptions
  • Generate and consume Result messages (success/failure + optional return payload)
  • Transparent messages serialization/deserialization
  • Transparently serialize/deserialize custom "JSON-like" payload fields (numpy-friendly)
  • Support async and sync contexts

Supported backends in the current version are:

  • RabbitMQ
  • Redis
  • NATS
  • Mosquitto
  • Python "backend" with Queue/asyncio.Queue for local in-processing testing

[!NOTE] Protobunny handles backend-specific logic internally to provide a consistent experience and a lean interface. Direct access to the internal NATS or Redis clients is intentionally restricted. If your project depends on specialized backend parameters not covered by our API, you may find the abstraction too restrictive.

Minimal requirements

  • Python >= 3.10 <=3.13
  • Core Dependencies: betterproto 2.0.0b7, grpcio-tools>=1.62.0
  • Backend Drivers (Optional based on your usage):
    • NATS: nats-py (Requires NATS Server v2.10+ for full JetStream support).
    • Redis: redis (Requires Redis Server v6.2+ for Stream support).
    • RabbitMQ: aio-pika
    • Mosquitto: aiomqtt

Project scope

Protobunny is designed for teams who use messaging to coordinate work between microservices or different python processes and want:

  • A small API surface, easy to learn and use, both async and sync
  • Typed messaging with protobuf messages as payloads
  • Supports various backends by simple configuration: RabbitMQ, Redis, Mosquitto, local in-process queues
  • Consistent topic naming and routing
  • Builtin task queue semantics and result messages
  • Transparent handling of JSON-like payload fields as plain dictionaries/lists
  • Optional validation of required fields
  • Builtin logging service

Why Protobunny?

While there are many messaging libraries for Python, Protobunny is built specifically for teams that treat Protobuf as the single source of truth.

  • Type-Safe by Design: Built natively for protobuf/betterproto.
  • Semantic Routing: Zero-config infrastructure. Protobunny uses your Protobuf package structure to decide if a message should be broadcast (Pub/Sub) or queued (Producer/Consumer).
  • Backend Agnostic: You can choose between RabbitMQ, Redis, NATS, and Mosquitto. Python for local testing.
  • Sync & Async: Support for both asyncio and traditional synchronous workloads.
  • Battle-Tested: Derived from internal libraries used in production systems at AM-Flow.

Feature Comparison with some existing libraries

Feature Protobunny FastStream Celery
Multi-Backend ✅ Yes ✅ Yes ⚠️ (Tasks only)
Typed Protobufs ✅ Native (Betterproto) ⚠️ Manual/Pydantic ❌ No
Sync + Async ✅ Yes ✅ Yes ❌ Sync focus
Pattern Routing ✅ Auto (tasks pkg) ❌ Manual Config ✅ Fixed
Framework Agnostic ✅ Yes ✅ Yes ❌ Heavyweight

Usage

See the Quick example on GitHub or on the docs site.

Documentation home page: https://am-flow.github.io/protobunny/.


Roadmap

  • Core Support: Redis, RabbitMQ, Mosquitto.
  • Semantic Patterns: Automatic tasks package routing.
  • Arbistrary dictionary parsing: Transparently parse JSON-like fields as dictionaries/lists by using protobunny JsonContent type.
  • Result workflow: Subscribe to results topics and receive protobunny Result messages produced by your callbacks.
  • Cloud-Native: NATS (Core & JetStream) integration.
  • Cloud Providers: AWS (SQS/SNS) and GCP Pub/Sub.
  • More backends: Kafka support.
  • gRPC Direct Call support

License

MIT Copyright (c) 2026 AM-Flow b.v.

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

protobunny-0.1.2a2.tar.gz (83.1 kB view details)

Uploaded Source

Built Distribution

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

protobunny-0.1.2a2-py3-none-any.whl (111.1 kB view details)

Uploaded Python 3

File details

Details for the file protobunny-0.1.2a2.tar.gz.

File metadata

  • Download URL: protobunny-0.1.2a2.tar.gz
  • Upload date:
  • Size: 83.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for protobunny-0.1.2a2.tar.gz
Algorithm Hash digest
SHA256 bfffe388997bb7c39cce1f25297ee1f45fa7c4f959ab69626c52caaa116e2238
MD5 c68264016de063e3584add47ea6a1c27
BLAKE2b-256 e158be3186213b8b6ffa6186dd6924e7d08cf4b48309f8bddb26cfa5dafb3141

See more details on using hashes here.

File details

Details for the file protobunny-0.1.2a2-py3-none-any.whl.

File metadata

  • Download URL: protobunny-0.1.2a2-py3-none-any.whl
  • Upload date:
  • Size: 111.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for protobunny-0.1.2a2-py3-none-any.whl
Algorithm Hash digest
SHA256 c7b8730ca5d33357c1447ed160a2d97473bc563c56892893f2a3be2c47805f7f
MD5 aff0197a5086206c53c7c5eaff2b63eb
BLAKE2b-256 e8c9704dbf35827e8ff35dde2df5bbbc4eca92c7a9174b0fffc1ebdb38b4549c

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