Asynchronous named events with no dependencies
Project description
AsyncEv: asynchronous event objects
AsyncEv leverages asyncio to create events that can be subscribed to and waited for.
Usage
import asyncio
import asyncev
from dataclasses import dataclass
# Create an event
@dataclass
class MyEvent(asyncev.BaseEvent):
value: str
# Create a handler
async def on_myevent(ev: MyEvent):
print(f"Got a MyEvent with the value {ev.value}!")
asyncev.bind(MyEvent, on_myevent)
# Emit event (requires a running asyncio event loop)
async def main():
asyncev.emit(MyEvent(value="hello world"))
asyncio.run(main())
Testing
$ python -m unittest
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
asyncev-1.0.tar.gz
(15.2 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
asyncev-1.0-py3-none-any.whl
(4.4 kB
view details)
File details
Details for the file asyncev-1.0.tar.gz.
File metadata
- Download URL: asyncev-1.0.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a34616494a7051ffea26bdbdbce2766c69ec6938c0e78047b4d51cbdff84f3f6
|
|
| MD5 |
e14bfb936b3911706f1d4d95a7a72323
|
|
| BLAKE2b-256 |
a34b6efe509377f4083ac289a1a0aa52923985ee1c8381bf130d53017f958a99
|
File details
Details for the file asyncev-1.0-py3-none-any.whl.
File metadata
- Download URL: asyncev-1.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8afc7273c2af3ef7117367f0731b82ec3803fc98d4179cc40eecce06c84bf333
|
|
| MD5 |
d356bf35f15948e94f6dec2c77c82460
|
|
| BLAKE2b-256 |
af9626681c5572cd83dff4e2c8533807693bac716b486aed86d6fdcb9908ea13
|