Vibeleaderboard
Index / tool
Visit pypi.org
Category
Developer Tools
Rank
Pricing
Open Source
Type
TOOL
GitHub
122 stars
Latest release
1.5.6
Date

About

Production-ready Python event bus with async/sync handlers, FIFO/concurrency options, and WAL persistence. Powers the browser-use library.

What it does

Bubus coordinates work inside async Python applications through typed events and registered handlers. Events are validated as Pydantic models, can trigger child events, collect handler results, wait for matching responses, and move between linked buses while tracking their route and parentage.

Why it's ranked here

Bubus has unusual depth for an in-process event system. It combines runtime validation, typed return values, nested-event causality, configurable parallel handlers, forwarding loop prevention, timeouts, and readable execution trees. The supplied tests cover ordering, parallel execution, persistence, serialization, and failure behavior.

What's good

Nested work is a first-class concept, not an improvised callback chain. Parent and child relationships are tracked automatically, and awaiting a child inside a handler avoids deadlock by processing it immediately. Handler results remain attached to events and can be retrieved individually, grouped by handler, or flattened into lists and dictionaries.

Tradeoffs

It requires Python 3.11 or newer and dispatch needs a running event loop. Serial handler execution is the default; parallel handlers require explicit configuration. Awaited child events jump the normal queue order, so strict FIFO has a documented exception. Event history defaults to 50 entries. The library supplies no network transport between processes or services.

How to use it well

Use Bubus for typed orchestration inside an async Python process, especially when workflows spawn nested tasks, need correlated responses, or benefit from traceable handler results. Define narrow event models, set realistic timeouts, and choose serial or parallel handlers deliberately. Pair it with a message broker or RPC layer when events must cross process or service boundaries.

Technical notes+

bubus/service.py implements EventBus, a clean-shutdown asyncio queue, a process-global reentrant lock, FIFO dispatch, optional parallel handlers, bounded history, forwarding, and WAL configuration. bubus/models.py defines generic Pydantic BaseEvent and EventResult models, UUID validation, handler protocols, result typing, timestamps, route tracking, and await behavior that processes nested queued events to prevent deadlock. bubus/logging.py renders event, handler, timing, child, error, and timeout trees. bubus/helpers.py adds retry and semaphore machinery, including process-wide locking through portalocker with an asyncio fallback. tests/test_eventbus.py, tests/test_handler_timeout.py, and tests/test_semaphores.py exercise core dispatch, ordering, handler modes, nested timeouts, and multiprocess concurrency.

Observed

License
MIT License
Primary language
Python
Runtime support
Python 3.11 or newer, below Python 4
Install surface
Python package installed with pip
Interface
Importable Python library
Packaging
Hatchling build backend
Platform support
Classified as operating-system independent
Test structure
Repository includes pytest suites for the event bus, handler timeouts, and semaphores

Read from README.md, pyproject.toml, bubus/models.py, bubus/helpers.py, bubus/logging.py, bubus/service.py, bubus/__init__.py, tests/conftest.py, tests/test_eventbus.py, tests/test_semaphores.py, tests/test_handler_timeout.py.

What it can do

  • Process events asynchronously

    Event messages and async handlersProcessed events with async execution

  • Process events synchronously

    Event messages and sync handlersProcessed events with sync execution

  • Handle events in FIFO order

    Sequential event queueEvents processed in first-in-first-out order

  • Handle events with concurrent processing

    Multiple event messagesEvents processed simultaneously across multiple threads/workers

  • Persist events using Write-Ahead Log

    Event data and messagesDurable event storage with WAL persistence

  • Route events to registered handlers

    Event messages and handler registrationsEvents delivered to appropriate handler functions

Tags

pythonevent-busasyncpydantic

Tech Stack

Python

Comments (0)

No comments yet

Editorially curated, with community endorsements as a secondary signal. Corrections welcome.