Yet another event bus - yaeb for short
A simple typed event bus written in pure python
Installation
Install yaeb with pip
pip install yaeb
Usage/Examples
from logging import info
from yaeb.base.bus import BaseEventBus
from yaeb.base.events import BaseEvent
from yaeb.base.handlers import BaseSyncEventHandler
from yaeb.bus import DictEventHandlerRegistry, EventBus
class UserCreated(BaseEvent):
user_id: int
def __init__(self, user_id: int) -> None:
self.user_id = user_id
class UserCreatedHandler(BaseSyncEventHandler[UserCreated]):
def handle_event(self, event: UserCreated, bus: BaseEventBus) -> None:
info('User with id=%d was created!', event.user_id)
if __name__ == '__main__':
bus = EventBus(event_handler_registry=DictEventHandlerRegistry())
bus.register(event_type=UserCreated, event_handler=UserCreatedHandler())
bus.emit(UserCreated(user_id=1)) # prints log message with created user id
Roadmap
- Add coroutines support - Added
BaseAsyncEventHandler - Add some kind of multithreading support. Though it can be implemented by handlers themselves 🤔 - Added
BaseExecutorEventHandler
Metadata
Release files for yaeb 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| yaeb-1.0.0.tar.gz | 4.7 kB | Without provenance | Details for yaeb-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yaeb-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for yaeb-1.0.0-py3-none-any.whl |
Total release size: 11.4 kB
Release files / yaeb-1.0.0.tar.gz
| Download URL | yaeb-1.0.0.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a00ce0bae4e9b9095c944bcad7b6bd394ec4e704b806f4fe6e2211f3ce86fa3a
|
|
BLAKE2b-256 checksum How to use checksums |
fcf5dcf161698b92a518c72f3aab2668126eab3fee017c6aaae7b3f30d38534f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.1 CPython/3.10.7 Linux/5.15.0-1020-azure
|
Release files / yaeb-1.0.0-py3-none-any.whl
| Download URL | yaeb-1.0.0-py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a28f1bc7e5c15c48b0da67448b4fe7a1a261bb66271b059a7f1e4bf413b16cae
|
|
BLAKE2b-256 checksum How to use checksums |
95b86bd0bbb63d8b5bb13b523743199b96f6972c53887fd63497f7951ac11f1e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.1 CPython/3.10.7 Linux/5.15.0-1020-azure
|
Security for yaeb 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.