Pubsub system for aio framework
Project description
Pubsub system for the aio asyncio framework
Build status
Installation
Requires python >= 3.4 to work
Install with:
pip install aio.signals
Quickstart
The listen function is called synchronously, but the callback listener will be called as a coroutine if it isnt one
The callback listener takes 2 arguments, the name of the signal, and the argument that was emitted
The emit function is a coroutine
Add the following code to a file my_signals.py
import asyncio
from aio.signals import Signals
@asyncio.coroutine
def listener(signal, message):
print(message)
signals = Signals()
signals.listen("my-signal", listener)
loop = asyncio.get_event_loop()
loop.run_until_complete(
signals.emit("my-signal", 'BOOM!'))
Run with
python my_signals.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
aio.signals-0.0.6.tar.gz
(3.3 kB
view details)
File details
Details for the file aio.signals-0.0.6.tar.gz
.
File metadata
- Download URL: aio.signals-0.0.6.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 226a77f9ee6fd04cc7434b2dedd6d0816a8db11ef99308f83a2ecb3b8b993bbd |
|
MD5 | 5a643d6302749ae2accde8bc2a291e27 |
|
BLAKE2b-256 | 97b44bdfcff271c6db9f12a51e1f97e3ebee36e0a01fceb86738e5ee33b73e18 |