Skip to main content

WSGI server written in Rust.

Reason this release was yanked:

outdated release - please use the latest version

Project description

Pyruvate WSGI server

https://gitlab.com/tschorr/pyruvate/badges/master/pipeline.svg https://codecov.io/gl/tschorr/pyruvate/branch/master/graph/badge.svg http://img.shields.io/pypi/v/pyruvate.svg

Pyruvate is a WSGI server written in Rust. It’s not yet ready for production so use with caution.

Features

Development Installation

  • Install Rust

  • Install and activate Rust nightly (needed by PyO3)

  • 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

HTTP connection handling is still work in progress in Pyruvate, therefore you will see issues when using it behind a reverse proxy server. In any case if you want to try it with Nginx you might want to configure HTTP 1.1, e.g.:

....
location / {
    proxy_pass http://localhost:7878;
    proxy_http_version 1.1;
    proxy_set_header   Connection "";
    ...
}
...

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

pyruvate-0.2.0.tar.gz (24.4 kB view details)

Uploaded Source

Built Distributions

pyruvate-0.2.0-cp38-cp38-manylinux1_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.8

pyruvate-0.2.0-cp37-cp37m-manylinux1_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.7m

pyruvate-0.2.0-cp36-cp36m-manylinux1_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.6m

File details

Details for the file pyruvate-0.2.0.tar.gz.

File metadata

  • Download URL: pyruvate-0.2.0.tar.gz
  • Upload date:
  • Size: 24.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for pyruvate-0.2.0.tar.gz
Algorithm Hash digest
SHA256 45ae77ca01c02d2dae6b4b9c4881f9dad7f73b43a574a5198ab23b61322d6b1f
MD5 f4c131735f231924b964481361ae2478
BLAKE2b-256 4999687eaae8bfd5ec1ca902523fb82ab3526bf8cd852cd37097409059c26914

See more details on using hashes here.

File details

Details for the file pyruvate-0.2.0-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: pyruvate-0.2.0-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 4.4 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for pyruvate-0.2.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 7d96c1a37f5d7fa37f0e98af6479def11267affdc67b14de8279c1a1139bd92f
MD5 7f97ca229eb3bba68a8658f7701f2324
BLAKE2b-256 6631eae6286f997c0e6055d94068acdf3b85c2ae58014e2d86193df74e49e1e1

See more details on using hashes here.

File details

Details for the file pyruvate-0.2.0-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: pyruvate-0.2.0-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for pyruvate-0.2.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 17356d498e1f62195f19a1ad2118bc51fba0d1d3bf1733cfd41951442ab40227
MD5 e69626527e177c2ac9b4035165eec457
BLAKE2b-256 34755262e37448a583b3e50ce214e5de4b4d7816b9e715c21c567e4ae1b55d96

See more details on using hashes here.

File details

Details for the file pyruvate-0.2.0-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: pyruvate-0.2.0-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 2.9 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for pyruvate-0.2.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e40b1cf0d55d4d1550c95119e544249fdb03376c4e454664240b4ba2fb040ca7
MD5 61ec821f046e3444e5019c306d7c5c94
BLAKE2b-256 8c2fe0871fbda159ef345c877291ddae56c1cb9b08338432a40dd6ecbf573b0d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page