Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Event dispatch in Python 3.5 using asyncio

Project Description

Event dispatch in Python 3.5 using asyncio


pip install accordian

Getting Started

import asyncio
import accordian
import random

loop = asyncio.new_event_loop()

dispatch = accordian.Dispatch(loop=loop)
dispatch.register("my_event", ["id", "value"])

async def handle(id, value):
    sleep = 5.0 * random.random()
    print("Handling `my_event(id={})` in {} seconds.".format(id, sleep))
    await asyncio.sleep(sleep, loop=loop)
    print("`Completed my_event(id={})`!".format(id))

ids = range(4)
values = [random.random() for _ in ids]
for id, value in zip(ids, values):
    params = {"id": id, "value": value}
    dispatch.trigger("my_event", params)

loop.run_until_complete(asyncio.sleep(0.01, loop=loop))


Contributions welcome! Please make sure tox passes (including flake8) before submitting a PR.


accordian uses tox, pytest and flake8. To get everything set up:

# RECOMMENDED: create a virtualenv with:
#     mkvirtualenv accordian
git clone
pip install tox

Release History

This version
History Node


History Node


History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(3.8 kB) Copy SHA256 Hash SHA256
Source None Jan 1, 2016

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers