simple-event-bus
a simple python event bus
Install:
pip install simple_event_bus
Example:
import asyncio
from simple_event_bus import AsyncEventBus, Event, run_simple_event_source_async
app = AsyncEventBus()
tick_list = []
@app.listening("HeartBeat")
async def tick_collector(event: Event) -> None:
print(event.now)
tick_list.append(event)
if len(tick_list) > 5:
await app.publish_event("close_loop")
asyncio.get_event_loop().run_until_complete(run_simple_event_source_async(app))
Features
-
EventBus
-
AsyncEventBus
-
EventBus.run_forever function
-
EventBus.publish_event accept Event , EVENT_TYPE and str.
-
Event can get current_app
-
listening function args check
-
add remove method
-
allow no param method to listening
-
Independent event sources
-
add before event listener and after event listener
This project use black, please set
Continuation indent= 4
Pycharm - File - Settings - Editor - Code Style - Python - Tabs and Indents
Use flake8 to check your code style.
- This project is made by AngusWG/cookiecutter-py-package
simple_event_bus history
0.0.4
- fix error package
0.0.3
-
independent event sources
-
add remove method
-
allow no param method to listening
0.0.2
- fix publish_event can not accept str event.
0.0.1
- Basic functions completed
0.0.0
- first commit
Release files for simple-event-bus 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| simple_event_bus-0.0.4.tar.gz | 25.8 kB | Details |
Release files / simple_event_bus-0.0.4.tar.gz
| Download URL | simple_event_bus-0.0.4.tar.gz |
|---|---|
| Size | 25.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
109119196399e985b414b8c086ded1716f2fadafaaa1173780b450fea79af8af
|
|
BLAKE2b-256 checksum How to use checksums |
f6d8173747010b4be54b03c620617d10cc93e7681c149f58be3d39f647d2671e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.7.1 requests/2.25.1 setuptools/57.1.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.9.4
|