/aionn

aionn - asyncio messaging library based on nanomsg and nnpy

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

===========================================================================
This project is deprecated. You might try any future nng Python bindings or
simply use PyZMQ since version 0.17 gets rid of custom event loop.
===========================================================================

Aionn is Python asyncio messaging library based on `nanomsg` and `nnpy`.

Features

- simple API consistent with `nnpy` Python library
- no custom event loop

The `aionn` API follows API of the `nnpy` Python library. The only
difference is that the `aionn.Socket.recv` and `aionn.Socket.send` methods
are coroutines.

Example of pull socket::

    import asyncio
    import aionn

    socket = aionn.Socket(aionn.AF_SP, aionn.PULL)
    socket.bind('tcp://*:5555')

    loop = asyncio.get_event_loop()
    value = loop.run_until_complete(socket.recv())
    print(value)

Example of push socket::

    import asyncio
    import aionn

    socket = aionn.Socket(aionn.AF_SP, aionn.PUSH)
    socket.connect('tcp://localhost:5555')

    loop = asyncio.get_event_loop()
    loop.run_until_complete(socket.send('some data'))

See also `examples` directory.

Requirements

- `nnpy` ver. 1.3
- `nanomsg` ver. 1.0
- Python ver. 3.5

The `aionn` library is licensed under terms of GPL license, version 3, see
`COPYING <http://git.savannah.gnu.org/cgit/decotengu.git/plain/COPYING>`_
file for details.