Metadata-Version: 2.1
Name: aioevents-ng
Version: 0.0.5
Summary: A simple library for managing events through an asynchronous queue
Home-page: https://github.com/mpyatishev/aioevents
Author: Maxim Pyatishev
Author-email: mpyatishev@gmail.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Topic :: Software Development :: Libraries
Classifier: Framework :: AsyncIO
Requires-Python: >=3.7
Description-Content-Type: text/x-rst
Requires-Dist: janus

=========
aioevents
=========

.. image:: https://travis-ci.com/mpyatishev/aioevents.svg?branch=master
    :target: https://travis-ci.com/mpyatishev/aioevents
.. image:: https://codecov.io/gh/mpyatishev/aioevents/branch/master/graph/badge.svg
    :target: https://codecov.io/gh/mpyatishev/aioevents
.. image:: https://img.shields.io/pypi/v/aioevents-ng.svg
    :target: https://pypi.python.org/pypi/aioevents-ng


A simple library for managing events through an asynchronous queue


Installation
============

.. code:: bash

   pip install aioevents-ng


Usage example
=============

.. code:: python

   import asyncio

   from dataclasses import dataclass

   import aioevents


   @dataclass
   class MyEvent(aioevents.Event):
      payload: str


   @aioevents.manager.register(MyEvent)
   async def event_hadler(event: aioevents.Event):
      print(f"recieved: {event}")


   async def produce():
      async with aioevents.events as events:
         await events.publish(MyEvent("Hello!"))


   async def main():
      aioevents.start(asyncio.get_event_loop())

      await produce()

      print('stopping worker')
      aioevents.stop()

      # wait for all coroutines
      await asyncio.sleep(1)


   if __name__ == "__main__":
      asyncio.run(main())


License
=======

``aioevents`` library is offered under Apache 2 license.


