bubus
Advanced Pydantic-powered event bus with async support
What it is and what it does
Bubus is an event bus library that lets you build event-driven applications in Python using Pydantic models for type-safe event definitions. It handles both async and sync handlers, maintains strict FIFO processing order, and supports nested event dispatch—so handlers can emit child events that are tracked as part of the causality tree. You define events as Pydantic BaseEvent subclasses, register handlers with bus.on(), and dispatch events with bus.dispatch(). The library manages concurrency, result aggregation from multiple handlers, and can forward events between separate bus instances (useful for microservice-like architectures) while preventing infinite loops.
The main dependencies are pydantic (for validation), anyio and aiofiles (for async I/O), portalocker (for file-based locking), and uuid7 (for event IDs). It's designed to feel familiar to developers coming from JavaScript's EventTarget API, bringing that simplicity to Python with full type checking. The library is actively maintained, has no known vulnerabilities, and sits in the top 5000 packages by download volume.
Use it for:
- Build microservice architectures where different services communicate via event buses that forward events between each other.
- Implement real-time notification systems where multiple handlers subscribe to the same event and aggregate results.
- Create async workflows where handlers dispatch child events and wait for completion, maintaining a causality tree.
- Design type-safe domain event systems where Pydantic validation ensures all events conform to their schema.
- Handle concurrent async operations with guaranteed FIFO ordering, even when handlers spawn nested events.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Bubus is a Pydantic-powered event bus library that implements publish-subscribe patterns with type-safe event definitions, async/sync handler support, and nested event dispatch for building event-driven Python applications.
Yes. Bubus is actively maintained, has no security vulnerabilities, and offers a clean, Pydantic-integrated API for event-driven async Python. Install it if you're building event-driven applications and want type safety, nested event support, and FIFO ordering out of the box. The low install friction and permissive MIT license make it a low-risk addition. Consider it essential if you're already using Pydantic and need pub-sub patterns.
Install
bubus on PyPI
pip
pip install bubusuv
uv add bubuspoetry
poetry add bubusInstalling bubus
Before you install
Installation is low-friction—a pure Python wheel with six runtime dependencies (aiofiles, anyio, portalocker, pydantic, typing-extensions, uuid7). The package is actively maintained with a recent commit history and has been in active development since June 2025.
License in practice
Licensed under MIT (permissive), so you can use, modify, and distribute it freely in commercial and open-source projects without restriction.
Quickstart
pip install bubus
from bubus import EventBus, BaseEvent
class UserLoginEvent(BaseEvent):
username: str
async def handle_login(event: UserLoginEvent) -> str:
return f"User {event.username} logged in"
bus = EventBus()
bus.on(UserLoginEvent, handle_login)
event = bus.dispatch(UserLoginEvent(username="alice"))
result = await event.event_result()
Requires Python 3.11 or later; all handlers and event dispatch are async-first, so you must run within an async context.
Verify before relying
- Whether the library's performance characteristics (latency, throughput) are documented or tested at scale.
- Production deployment examples or case studies beyond the quickstart.
- Exact behavior of loop prevention when events are forwarded between buses with circular references.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (<4.0,>=3.11) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — aiofiles, anyio, portalocker, pydantic, typing-extensions, uuid7 |
| Maintenance | actively maintained — 349 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 11,213,399/month — #1,409 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: bubus-1.5.6-py3-none-any.whl
Tags
More Application Frameworks packages
FastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
textualTextual is a Python framework for building…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
mcpBuild and connect to Model Context Protocol…
permissive · top 1,000 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
abxbusAn in-memory event bus for async Python that…
permissive · top 15,000 on PyPI
pyventusPyventus is a Python library for building…
permissive · top 15,000 on PyPI
azure-servicebusAzure Service Bus client library for Python…
unclear · top 1,000 on PyPI
observableObservable provides a lightweight event system…
permissive · top 15,000 on PyPI
fastapi-eventsFastapi-events is an event dispatching and…
permissive · top 15,000 on PyPI
aws-cdk.aws-eventsProvides AWS CDK constructs for defining Amazon…
permissive · top 15,000 on PyPI
queuelibQueuelib provides in-memory and disk-persisted…
permissive · top 5,000 on PyPI
ovos-bus-clientProvides a Python client to connect to…
permissive · top 15,000 on PyPI
PypubsubProvides a publish-subscribe messaging system…
permissive · top 15,000 on PyPI
PyDispatcherPyDispatcher implements a signal-dispatch…
permissive · top 5,000 on PyPI