Metadata-Version: 2.1
Name: esg
Version: 0.1.9
Summary: Enhanced Service Gateway
Home-page: https://github.com/mtag-dev/esg
Author: Stanislav Dubrovskyi
Author-email: s.dubrovskyi@cleverdec.com
License: BSD
Project-URL: Source, https://github.com/mtag-dev/esg
Project-URL: Changelog, https://github.com/mtag-dev/esg/blob/master/CHANGELOG.md
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Description-Content-Type: text/markdown
Provides-Extra: standard
License-File: LICENSE.md

<p align="center">
<em>Low latency ESGI server.</em>
</p>

---

[![Build Status](https://github.com/mtag-dev/esg/workflows/Test%20Suite/badge.svg)](https://github.com/mtag-dev/esg/actions)
[![Package version](https://badge.fury.io/py/esg.svg)](https://pypi.python.org/pypi/esg)
[![PyVersions](https://img.shields.io/pypi/pyversions/python-squall.svg?color=%2334D058)](https://pypi.org/project/python-squall/)

**Documentation**: [https://esg.mtag.dev](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`:

```shell
$ pip install esg
```

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

```shell
$ 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`:

```python
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:

```shell
$ esg example:app
```

---

[uvloop]: https://github.com/MagicStack/uvloop
[httptools]: https://github.com/MagicStack/httptools
[ESGI specification]: https://esgi.mtag.dev


