Skip to main content

Synchronous evented IO with pyuv and fibers

Project description

Gruvi is an IO library for Python. It combines the efficiencies of event-based I/O with a sequential programming model. Gruvi uses libuv (via pyuv) as the underlying high-performance event-based I/O layer, and used coroutines based on fibers to create a traditional sequential programming model on top of the libuv event-based callback model.

Gruvi is similar in concept to asyncio, gevent, and eventlet. For a rationale on why I’ve created a new library, see the Rationale section in the manual.


Gruvi has the following features:

  • Excellent platform support (mostly thanks to libuv). Linux, Mac OSX and Windows are all first-class citizens. On Windows IOCP is used meaning that you don’t run into the scalability limitations of select() there.
  • Small core and focus on low memory usage and fast performance. This makes Gruvi very suitable for mobile applications and embedded web servers.
  • Great support for SSL, also on Windows. Includes an SSL backports module that makes certain 3.x features available on Python 2.x.
  • Built-in client/server support for HTTP, JSON-RPC and D-BUS.
  • PEP-3156 compatible transport/protocol interface.
  • Transparent concurrency support. Thanks to fibers, calling into a blocking function is just like calling into a regular function.
  • Thread synchronization primitives including locks, conditions and queues.
  • Thread and fiber pools with a concurrent.futures interface.

CI Status


An simple echo server, using a StreamServer:

import gruvi

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

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


You need Python 2.6, 2.7 or 3.3+.

The following operating systems are currently tested:

  • Posix (Only Linux is currently tested)
  • Mac OSX
  • Windows


Development install in a virtualenv:

$ git clone
$ cd gruvi
$ pip install -r requirements.txt
$ python build
$ python install

To run the test suite:

$ python unit

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


The documentation is available on readthedocs.


Gruvi is free software, available under the MIT license.


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

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 gruvi, version 0.10.0
Filename, size File type Python version Upload date Hashes
Filename, size gruvi-0.10.0.tar.gz (149.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page