Welcome to Gruvi
Gruvi is an IO library for Python. It 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 based model.
Gruvi has the following features:
- Excellent platform support (mostly thanks to libuv). Linux, Mac OSX and Windows are all first-class citizens.
- PEP-3156 compatible transport/protocol interface.
- A traditional, sequential programming model based on green threads, where there is no distinction between asynchronous and normal functions.
- Great SSL/TLS support, also on Windows. The asynchronous SSL support in the Python standard library came from Gruvi before it was included into the stdlib.
- SSL backports module that makes certain 3.x SSL/TLS features available on Python 2.7.
- Small core and focus on low memory usage and fast performance. This makes Gruvi very suitable for mobile applications and embedded web servers.
- A full suite of synchronization primitives including locks, conditions and queues.
- Thread and fiber pools with a
- Batteries includes: built-in client/server support for HTTP, JSON-RPC and D-BUS.
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()
You need Python 2.7 or 3.3+.
The following operating systems are currently supported:
- Linux (might work on other Posix OSs)
- macOS (not currently tested via CI)
- Windows (not currently tested via CI)
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.
The documentation is available on readthedocs.
Gruvi is free software, provided under the MIT license.