Skip to main content

Enhanced Service Gateway

Project description

Low latency ASGI server.


Build Status Package version PyVersions

Documentation: https://esg.mtag.dev

ESG is a speed-oriented ASGI server implementation.

Implements application server for asynchronous Python Web-frameworks.

Please read ASGI 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.

ASGI application example

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.12.tar.gz (188.8 kB view hashes)

Uploaded Source

Built Distributions

esg-0.1.12-cp310-cp310-win_amd64.whl (300.1 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

esg-0.1.12-cp310-cp310-musllinux_1_1_x86_64.whl (892.0 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

esg-0.1.12-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (834.9 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.12+ x86-64 manylinux: glibc 2.5+ x86-64

esg-0.1.12-cp310-cp310-macosx_10_9_x86_64.whl (323.5 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

esg-0.1.12-cp310-cp310-macosx_10_9_universal2.whl (443.4 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64)

esg-0.1.12-cp39-cp39-win_amd64.whl (299.6 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

esg-0.1.12-cp39-cp39-musllinux_1_1_x86_64.whl (884.1 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

esg-0.1.12-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (830.4 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64 manylinux: glibc 2.5+ x86-64

esg-0.1.12-cp39-cp39-macosx_10_9_x86_64.whl (323.1 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

esg-0.1.12-cp39-cp39-macosx_10_9_universal2.whl (442.3 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64)

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