WSGI server written in Rust.
Reason this release was yanked:
outdated release - please use the latest version
Project description
Pyruvate WSGI server
Pyruvate is a WSGI server written in Rust.
Features
Asynchronous event loop using mio
Request parsing using httparse
rust-cpython based Python interface
Worker pool based on threadpool
PasteDeploy entry point
Development Installation
Install Rust
Install and activate a Python 3 (> 3.5) virtualenv
Install setuptools_rust using pip:
$ pip install setuptools_rust
Install pyruvate, e.g. using pip:
$ pip install -e git+https://gitlab.com/tschorr/pyruvate.git#egg=pyruvate[test]
Using Pyruvate in your WSGI application
From Python
A hello world WSGI application using pyruvate listening on 127.0.0.1:7878 and using 2 worker threads looks like this:
import pyruvate def application(environ, start_response): """Simplest possible application object""" status = '200 OK' response_headers = [('Content-type', 'text/plain')] start_response(status, response_headers, None) return [b"Hello world!\n"] pyruvate.serve(application, "127.0.0.1:7878", 2)
Using PasteDeploy
Again listening on 127.0.0.1:7878 and using 2 worker threads:
[server:main] use = egg:pyruvate#main socket = 127.0.0.1:7878 workers = 2
Example Configurations
Django 2
After installing Pyruvate in your Django virtualenv, create or modify your wsgi.py file (1 worker listening on 127.0.0.1:8000):
import os import pyruvate from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTINGS_MODULE", "your_django_application.settings") application = get_wsgi_application() pyruvate.serve(application, "127.0.0.1:8000", 1)
You can now start Django + Pyruvate with:
$ python wsgi.py
Override settings by using the DJANGO_SETTINGS_MODULE environment variable when appropriate. Tested with Django 2.2.x.
Mapproxy
Create or modify config.py (2 workers listening on 127.0.0.1:8005):
from logging.config import fileConfig import os.path import pyruvate fileConfig(r'/path/to/mapproxy/log.ini', {'here': os.path.dirname(__file__)}) from mapproxy.wsgiapp import make_wsgi_app application = make_wsgi_app(r'/path/to/mapproxy/mapproxy.yml') pyruvate.serve(application, "127.0.0.1:8005", 2)
Start from your virtualenv:
$ python config.py
Tested with Mapproxy 1.12.x.
Plone 5.2
Using zc.buildout and plone.recipe.zope2instance you can define an instance part using Pyruvate’s PasteDeploy <https://pastedeploy.readthedocs.io/en/latest/> _entry point:
[instance] recipe = plone.recipe.zope2instance http-address = 127.0.0.1:8080 eggs = Plone pyruvate wsgi-ini-template = ${buildout:directory}/templates/pyruvate.ini.in
The server section of the template provided with the wsgi-ini-template option should look like this (3 workers listening on http-address as specified in the buildout [instance] part):
[server:main] use = egg:pyruvate#main socket = %(http_address)s workers = 3
Tested with Plone 5.2.x.
Nginx settings
Like other WSGI servers pyruvate should be used behind a reverse proxy, e.g. Nginx:
.... location / { proxy_pass http://localhost:7878; ... } ...
0.3.0 (2020-06-16)
Switch to rust-cpython
Fix passing of tcp connections to worker threads
0.2.0 (2020-03-10)
Added some Python tests (using py.test and tox)
Improve handling of HTTP headers
respect content length header when using sendfile
0.1.0 (2020-02-10)
Initial release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for pyruvate-0.3.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6a6bf6f90aa8c03291ef637662f2ee909ed7e5a958539d4bef4297db6856e8b |
|
MD5 | add2ec1bfa748c51d13d52df9b0de819 |
|
BLAKE2b-256 | b685e7498e1d0b448857013610d2a0a767f3d7558ebf2a0a396b93d74b7c4a0e |
Hashes for pyruvate-0.3.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01abd8dbc27c45d52ba8cb9e109101c97c87101fd54cffadcc62e73c10454f22 |
|
MD5 | 69f396df83019f666f1842e7e12285d9 |
|
BLAKE2b-256 | 1f5da03412120cb9bb8179b9d33b86c32fa487fc0c5bd87b6bd434383ef53df8 |
Hashes for pyruvate-0.3.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7719fbb3c7844388fbdbb11e25c86812ce479696df4257e45b5a7d9255a8804 |
|
MD5 | 300aef90cb7c7ad261bbab54bf3400a8 |
|
BLAKE2b-256 | 25b5c879bd7853994a8e01b03b44723f6f62ad747fc4bd6014e9d537c087b9df |