novabus
A dependency-free, in-process, priority-aware event bus for Python asyncio apps.
No PyQt5, no Redis, no broker to run. Pure stdlib (asyncio + collections).
pip install -e . # from this directory, until it's published
Usage
import asyncio
from novabus import Bus
loop = asyncio.get_event_loop()
bus = Bus(loop=loop)
# mark which (source, function_name) pairs jump the queue
bus.mark_critical("TradingSignal", "interpret_trading_signal")
def on_event(source, function_name, result, params):
print(source, function_name, result, params)
bus.subscribe("my_module", on_event, sources=["TradingSignal"]) # or sources=None for all
bus.start()
bus.publish("TradingSignal", "interpret_trading_signal", result={"side": "buy"}, params={})
For maximum throughput when ordering/priority don't matter, call
bus.set_high_rate_mode(True) — publish then dispatches synchronously,
bypassing the queue.
Design notes
- Two priority lanes (critical / non-critical); critical always drains first and pauses non-critical delivery until caught up.
- Per-event dedup via a monotonic counter (bounded memory, periodically evicted).
- Stale-event flushing: events older than
stale_afterseconds are dropped instead of being delivered late. - Backpressure: queue has a max size; oldest non-critical events are dropped first when full.
- Subscribers are plain callables, optionally filtered by source/function name.
Benchmark
python bench.py publishes 200k events and measures end-to-end delivery.
On a typical dev machine: ~245k events/sec in normal (priority-queue)
mode, ~800k events/sec in high_rate_mode.
Metadata
Release files for novabus 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| novabus-0.1.1.tar.gz | 6.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| novabus-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.0 kB
Release files / novabus-0.1.1.tar.gz
| Download URL | novabus-0.1.1.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
361e0a1c454035a1b799b491a2a23098df288c9b4ef605a9c1318680422e7ab4
|
|
BLAKE2b-256 checksum How to use checksums |
34ecf210dd71286d867b97b2285dbd1ff7ba2a401c24083c8abbf99d7fe852dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|
Release files / novabus-0.1.1-py3-none-any.whl
| Download URL | novabus-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ce053f9965e33ecf270f76b4ed6bc79195d61e2db9a8c3d77fec7f1036fce026
|
|
BLAKE2b-256 checksum How to use checksums |
8e5076763cb41a9484b759e1c2ce4f8405023bf07bf56927bb0bc73f39083717
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|