Pubsub system for aio framework
Project description
Pubsub system for the aio asyncio framework
Build status
Installation
Requires python >= 3.4
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 receives a signal object that has the name of the signal and the object that the signal was emitted with
The emit function is a coroutine
Add the following code to a file my_signals.py
import asyncio
from aio.signals import Signals
def listener(signal):
yield from asyncio.sleep(1)
print(signal.data)
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.1.1.tar.gz
(3.5 kB
view details)
File details
Details for the file aio.signals-0.1.1.tar.gz
.
File metadata
- Download URL: aio.signals-0.1.1.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5746edc72fca85876def19b9e07e5e2508a80c7929a3e4d9fc472f0877c2a6da |
|
MD5 | edd0a501ad3f9325fa83adca3b8f5ff7 |
|
BLAKE2b-256 | 480667b605d871d242ed7394a231ec32fbf19d677ea03fa59b2859b2dab9d8ca |