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 novabus
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 tests/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.
Links
Metadata
Release files for novabus 0.1.2
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.2.tar.gz | 6.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| novabus-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.1 kB
Release files / novabus-0.1.2.tar.gz
| Download URL | novabus-0.1.2.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e893c87cd649c806027d0d62280fe70dcfa0431a099450228378f739375df4d7
|
|
BLAKE2b-256 checksum How to use checksums |
532083385572ff3fee4f2a96d52106f5ec864357a7156e76916c839c2f930b3b
|
| 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.2-py3-none-any.whl
| Download URL | novabus-0.1.2-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
79549fb7a3c6626c865bcccf7bc6a6fb49a54631842e9bf47d892a741028cc5c
|
|
BLAKE2b-256 checksum How to use checksums |
ab58172ee2847cd99a010478dd9be6521fbf73c4b7a6cdb6b7272f0c83f117f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|