Lightweight, thread-safe publish-subscribe event bus
Project description
Avyra
v1.2.0 : Lightweight, thread-safe publish-subscribe event bus.
pip install avyra
from enum import Enum, auto
from avyra import EventBus
class Message(Enum):
SENT = auto()
READ = auto()
bus = EventBus()
bus.register(Message)
@bus.on(Message.SENT)
def handler(event, payload):
print(f"Sent: {payload}")
bus.emit(Message.SENT, "Hello!")
- Typed events :
Enummembers, not strings. - Thread-safe : RLock-protected mutations, snapshot dispatch.
- Priority : subscriber execution order via
priorityparameter. - Zero dependencies : pure Python.
Guide → | Documentation → | Changelog → | License →
Why Avyra?
Avyra provides a lightweight event system without external dependencies, designed for applications where components need to communicate without direct coupling.
Tests
python -m pytest tests/ -v
107 tests covering subscribe, unsubscribe, emit, once, has_subscriber, clear, register, priority, edge cases, and thread safety.
Examples
python example/chat.py
python example/downloader.py
python example/once_usage.py
python example/async_usage.py
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file avyra-1.2.0.tar.gz.
File metadata
- Download URL: avyra-1.2.0.tar.gz
- Upload date:
- Size: 18.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59180869758fe685514c72c8fde09019b54b03b5f4b784387356c10c7e7f4c87
|
|
| MD5 |
fb4c27ff22e2d99e53906ea46aa02a24
|
|
| BLAKE2b-256 |
0727f0730cd31ad39c9bab4146ef4e1043a39bbddcb6a95a3fb96d4df3146757
|
File details
Details for the file avyra-1.2.0-py3-none-any.whl.
File metadata
- Download URL: avyra-1.2.0-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fff06d1700694c78bb394444a27225c9df85640e07d65898bde8c49755a74f18
|
|
| MD5 |
b74dca580bb5068487391ae92ce9fad2
|
|
| BLAKE2b-256 |
8afda4e5ec81aace56f37566502fb3dc628b7e2052af258753998e03297f3881
|