A simple python event bus for python3
Project description
async-event-bus
A simple event bus for python3
Quick Start
- install package with pip or any tools you like
pip install async-event-bus
- use example code under
import asyncio
import sys
from loguru import logger
from async_event_bus import EventBus
bus = EventBus()
logger.remove()
logger.add(sys.stdout, level="TRACE")
@bus.on("message")
async def message_handler(message: str, *args, **kwargs) -> None:
logger.info(f"message received: {message}")
async def main():
await asyncio.gather(
bus.emit("message", "Hello"),
bus.emit("message", "This is a test message"),
bus.emit("message", "Send from python"),
bus.emit("message", "This is also a test message")
)
if __name__ == "__main__":
loop = asyncio.new_event_loop()
loop.run_until_complete(main())
- Check out the examples under the 'examples' folder for more help
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
async_event_bus-0.5.0.tar.gz
(14.9 kB
view details)
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 async_event_bus-0.5.0.tar.gz.
File metadata
- Download URL: async_event_bus-0.5.0.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.27.0 CPython/3.10.9 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9045d67d3852bd725dccdc3f14ff46eaffddf526d834b4f984b06944e1aa6ac
|
|
| MD5 |
5a3a9b34c8b759f6395c6bfe5612732e
|
|
| BLAKE2b-256 |
c620d8548bdf7d53d09c85e0955518e2b909896d2d9806df29367ce729d1d6a1
|
File details
Details for the file async_event_bus-0.5.0-py3-none-any.whl.
File metadata
- Download URL: async_event_bus-0.5.0-py3-none-any.whl
- Upload date:
- Size: 19.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.27.0 CPython/3.10.9 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dabfc9095b43c779b40393a45068240245c93a3e202c15780a934f8cbaf670f2
|
|
| MD5 |
8e0c566a4863ccb7cf18c33edcd6be5a
|
|
| BLAKE2b-256 |
84214eaf7e982f9965332ee3b6dc58af80e5c1765215ea733b921c465be7a82a
|