Skip to main content
Help the Python Software Foundation raise $60,000 USD by December 31st!  Building the PSF Q4 Fundraiser

No project description provided

Project description


Simplified Asyncio Event Management


Asyncio offers a lot of utilities that provide thread-safe execution of coroutines and synchronous functions. However, there isn't any one "unified" way of emitting/catching events accross threads.


aioevt - After creating the manager, you can emit 'global' events in a thread-safe way. Callbacks can be both registered and emitted from any thread. This allows you to very easily share objects through multithreaded HTTP servers such as Sanic or Vibora.


Create a manager

Register an event

def register(self, name: str, func: Callable, loop: asyncio.AbstractEventLoop=None, recurring: bool=True):
    Register a global event to be triggered from a provided event loop when a named event is emitted.

    :param name: event name.
    :param func: callable function to be called when an event is emitted
    :param loop: the loop from which you want the callback to be executed
    :param recurring: whether or not the event should be re-registered after it is

Emitting an event

def emit(self, name: str, *args):
    Non-blocking function to emit a signal with arbitrary parameters. This can execute both
    synchronous or asynchronous callbacks.

    :param name: event name
    :param args: additional event arguments

    :return None

Waiting for an event

def wait(self, name: str, timeout: float=None):
    Wait until an event fures and return the emit parameters

    :param name: Event Name
    :param loop: the event loop
    :param timeout: the maximum time (in seconds) to wait before it raises an exception
    :return the parameters passed to `emit`
    :raises asyncio.TimeoutError when necessary

Unregistering an event

def unregister(self, name=None, func=None):
    Unregister an event
    NOTE: by name is significantly faster than by function since it just needs to do a single lookup.
    Unregistering an event via callback means it needs to iterate through ALL events.

    :param name: Event name
    :param func: callback function
    :return None

Project details

Download files

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

Files for aioevt, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size aioevt-0.1.1-py3-none-any.whl (17.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size aioevt-0.1.1.tar.gz (3.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page