GitHub - geertj/gruvi: Async IO for Python, Simplified (original) (raw)

Gruvi: Async IO for Python, Simplified

https://secure.travis-ci.org/geertj/gruvi.png https://coveralls.io/repos/geertj/gruvi/badge.png?branch=master https://badge.fury.io/py/gruvi.png

Improved ergonomics for Python programmers wanting to use asynchronous IO.

Gruvi is an asynchronous IO library for Python. It focuses on the following desirable properties:

Gruvi uses libuv (via pyuv) as the underlying high-performance event-based I/O layer, and coroutines based on fibers to create a traditional sequential programming model on top of the libuv completion/callback model.

Gruvi is similar in concept existing async IO frameworks like asyncio,gevent, and eventlet. For a comparison, see Rationale.

Features

Gruvi has the following features:

Example

An simple echo server, using a StreamServer:

import gruvi

def echo_handler(stream, transport, protocol): while True: buf = stream.read1() if not buf: break stream.write(buf)

server = gruvi.StreamServer(echo_handler) server.listen(('localhost', 7777)) server.run()

Requirements

You need Python 2.7 or 3.3+.

The following operating systems are currently supported:

Installation

Development install in a virtualenv:

$ git clone https://github.com/geertj/gruvi $ cd gruvi $ pip install -r requirements.txt $ python setup.py build $ python setup.py install

To run the test suite:

$ python runtests.py unit

For other installation options, see the Installation section in the manual.

Documentation

The documentation is available on readthedocs.

License

Gruvi is free software, provided under the MIT license.

Contact

Feel free to contact the author at geertj@gmail.com. You can also submit tickets or suggestions for improvements on Github.