Metadata-Version: 2.1
Name: granian
Version: 0.2.6
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Programming Language :: Python
Classifier: Programming Language :: Rust
Classifier: Topic :: Internet :: WWW/HTTP
Requires-Dist: typer~=0.4.1
Requires-Dist: uvloop~=0.17.0; sys_platform != 'win32' and platform_python_implementation == 'CPython'
Requires-Dist: description; extra == 'dynamic'
Requires-Dist: keywords; extra == 'dynamic'
Requires-Dist: license; extra == 'dynamic'
Requires-Dist: readme; extra == 'dynamic'
Requires-Dist: version; extra == 'dynamic'
Requires-Dist: httpx~=0.23.0; extra == 'test'
Requires-Dist: pytest~=7.1.2; extra == 'test'
Requires-Dist: pytest-asyncio~=0.18.3; extra == 'test'
Requires-Dist: websockets~=10.3; extra == 'test'
Provides-Extra: dynamic
Provides-Extra: test
License-File: LICENSE
Summary: A Rust HTTP server for Python applications
Keywords: web,asyncio
Home-Page: https://github.com/emmett-framework/granian
Author: Giovanni Barillari <g@baro.dev>
Author-email: Giovanni Barillari <g@baro.dev>
License: BSD-3-Clause
Requires-Python: >=3.7
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Source, https://github.com/emmett-framework/granian
Project-URL: Homepage, https://github.com/emmett-framework/granian
Project-URL: Funding, https://github.com/sponsors/gi0baro

# Granian

A Rust HTTP server for Python applications.

## Rationale

The main reasons behind Granian design are:

- Have a single, correct HTTP implementation, supporting versions 1, 2 (and eventually 3)
- Provide a single package for several platforms 
- Avoid the usual Gunicorn + uvicorn + http-tools dependency composition on unix systems
- Provide stable performance when compared to existing alternatives

## Features

- Supports ASGI/3, [RSGI](https://github.com/emmett-framework/granian/blob/master/docs/spec/RSGI.md) and WSGI interface applications
- Implements HTTP/1 and HTTP/2 protocols
- Supports HTTPS
- Supports Websockets over HTTP/1 and HTTP/2

## Quickstart

You can install Granian using pip:

    $ pip install granian

Create an ASGI application in your `main.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!',
    })
```

and serve it:

    $ granian --interface asgi main:app

You can also create an app using the [RSGI](https://github.com/emmett-framework/granian/blob/master/docs/spec/RSGI.md) specification:

```python
async def app(scope, proto):
    assert scope.proto == 'http'

    proto.response_str(
        status=200,
        headers=[
            ('content-type', 'text/plain')
        ],
        body="Hello, world!"
    )
```

and serve it using:

    $ granian --interface rsgi main:app

## Project status

Granian is currently under active development.

Granian is compatible with Python 3.7 and above versions on unix platforms and 3.8 and above on Windows.

## License

Granian is released under the BSD License.

