Skip to main content

Enhanced Service Gateway

Project description

Low latency ESGI server.


Build Status Package version PyVersions

Documentation: https://esg.mtag.dev

ESG is a lightning-fast ESGI server implementation, using uvloop and httptools.

Implements application server for low latency asynchronous Python Web-frameworks.

Please read ESGI specification

Supports HTTP/1.1 and WebSockets.

Quickstart

Install using pip:

$ pip install esg

This will install ESG with minimal (pure Python) dependencies.

$ pip install esg[standard]

This will install ESG with "Cython-based" dependencies (where possible) and other "optional extras".

In this context, "Cython-based" means the following:

  • the event loop uvloop will be installed and used if possible.
  • the http protocol will be handled by httptools if possible.

Moreover, "optional extras" means that:

  • the websocket protocol will be handled by websockets (should you want to use wsproto you'd need to install it manually) if possible.
  • the --reload flag in development mode will use watchgod.
  • windows users will have colorama installed for the colored logs.
  • python-dotenv will be installed should you want to use the --env-file option.
  • PyYAML will be installed to allow you to provide a .yaml file to --log-config, if desired.

ESGI application example

ASGI application example (Deprecated)

Put following code in example.py:

async def app(scope, receive, send):
    assert scope['type'] == 'http'

    await send({
        'type': 'http.response.start',
        'status': 200,
        'headers': [
            [b'content-type', b'text/plain'],
        ],
    })
    await send({
        'type': 'http.response.body',
        'body': b'Hello, world!',
    })

Run the server:

$ esg example:app

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

esg-0.1.9.tar.gz (43.4 kB view hashes)

Uploaded Source

Built Distribution

esg-0.1.9-py3-none-any.whl (56.2 kB view hashes)

Uploaded Python 3

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