Metadata-Version: 2.4
Name: fastpysgi
Version: 0.4
Summary: An ultra fast WSGI/ASGI server for Python
Author: James Roberts, remittor
License: MIT License
        
        Copyright (c) 2021 James Roberts
        Copyright (c) 2022 remittor
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/remittor/fastpysgi
Project-URL: Issues, https://github.com/remittor/fastpysgi/issues
Project-URL: Repository, https://github.com/remittor/fastpysgi
Project-URL: Donate, https://github.com/remittor/donate
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Operating System :: OS Independent
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Server
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Dynamic: license-file

<p align="center"><img src="./logo.png"></p>

--------------------------------------------------------------------
[![Pypi](https://img.shields.io/pypi/v/fastpysgi.svg?style=flat)](https://pypi.python.org/pypi/fastpysgi)


# FastPySGI

FastPySGI is an ultra fast WSGI/ASGI server for Python 3.

Its written in C and uses [libuv](https://github.com/libuv/libuv) and [llhttp](https://github.com/nodejs/llhttp) under the hood for blazing fast performance.


## Dependencies

None


## Supported Platforms

| Platform       | Linux | MacOs | Windows |
| :------------: | :---: | :---: | :-----: |
| <b>Support</b> | ✅    |  ✅  |  ✅     |


## Performance

FastPySGI is one of the fastest general use WSGI servers out there!

For a comparison against other popular WSGI servers, see [PERFORMANCE.md](./performance_benchmarks/PERFORMANCE.md)


## Installation

Install using the [pip](https://pip.pypa.io/en/stable/) package manager.

```bash
pip install fastpysgi
```


## Quick start

Create a new file `example.py` with the following:

```python
import fastpysgi

def app(environ, start_response):
    headers = [('Content-Type', 'text/plain')]
    start_response('200 OK', headers)
    return [b'Hello, World!']

if __name__ == '__main__':
    fastpysgi.run(app, host='0.0.0.0', port=5000)
```

Run the server using:

```bash
python3 example.py
```

Or, by using the `fastpysgi` command:

```bash
fastpysgi example:app
```


## Example usage with Flask

```python
import fastpysgi
from flask import Flask

app = Flask(__name__)

@app.get('/')
def hello_world():
    return 'Hello, World!', 200

if __name__ == '__main__':
    fastpysgi.run(app, host='127.0.0.1', port=5000)
```


## Example usage with FastAPI

```python
import fastpysgi
import fastapi

app = fastapi.FastAPI()

@app.get("/")
async def hello_world():
    return fastapi.responses.PlainTextResponse(b"Hello, World!\n")

if __name__ == '__main__':
    fastpysgi.run(app, host='127.0.0.1', port=5000)
```


## Testing

To run the test suite using [pytest](https://docs.pytest.org/en/latest/getting-started.html), run the following command:

```bash
python3 -m pytest
```
