Metadata-Version: 2.4
Name: turboweb
Version: 26.3
Summary: High-performance Python web framework with C extension
Home-page: https://github.com/ScadeBlock/turboweb
Author: ScadeBlock
Author-email: ScadeBlock <scadeblock@github.com>
License: MIT
Project-URL: Homepage, https://github.com/ScadeBlock/turboweb
Project-URL: Repository, https://github.com/ScadeBlock/turboweb
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 :: 3.12
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: fastpysgi
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

<div align="center">
  <img src="./icon.png" alt="TurboWeb Logo" width="120"/>

# TurboWeb

**Lightning-fast Python web framework — ranked #1 in performance benchmarks.**

[![Python](https://img.shields.io/badge/python-3.7+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
[![PyPI](https://img.shields.io/pypi/v/turboweb.svg)](https://pypi.org/project/turboweb/)

</div>

---

## Benchmark Results

> Tested on **October 11, 2026** · Higher RPS = better · Lower latency & error rate = better

| Framework | RPS | Avg Latency | Error % |
|-----------|----:|------------:|--------:|
| Flask | 566.0 | 441ms | 1.4% |
| Django | 686.2 | 364ms | 8.5% |
| FastAPI | 946.5 | 264ms | 0.0% |
| Blacksheep | 1,657.6 | 150ms | 0.0% |
| Sanic | 4,708.9 | 53ms | 0.0% |
| **TurboWeb-ASGI** | **12,196.4** | **20ms** | **0.0%** |
| **TurboWeb-WSGI** | **22,553.5** | **11ms** | **0.0%** |

![Benchmark Overview](./benchmark_combined.png)

![Throughput Comparison](./benchmark_rps.png)

---

## Notes
> TurboWeb priortizes speed & performance and easy migration

## Installation

```bash
pip install turboweb
```

## Quick Start

```python
from turboweb import TurboWeb, response

app = TurboWeb()

@app.route("/")
def index(req):
    return response.json({"message": "Hello, TurboWeb!"})

@app.route("/user/<name>")
def greet(req, name):
    return response.text(f"Hello, {name}!")

@app.route("/api/data", methods=["POST"])
async def api_data(req):
    data = req.json
    return response.json({"received": data})

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=8000)
```

## ASGI

```python
from turboweb import TurboWeb

app = TurboWeb(mode="asgi") 

@app.route("/")
async def index(environ):
    return {"host": "TurboWeb-ASGI"}

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=8000, mode="asgi")
```

## Middleware

```python
@app.middleware("request")
def log_request(req):
    print(f"{req.method} {req.path}")

@app.middleware("response")
def add_header(req, resp):
    resp.headers.append(("X-Custom-Header", "TurboWeb"))
    return resp
```

## CORS

```python
app.cors(
    allow_origins=["https://example.com"],
    allow_methods=["GET", "POST"],
    allow_headers=["Content-Type"],
    allow_credentials=True
)
```

## Static Files

```python
app.static("/static", "./public")
```

## Running with Workers

```python
app.run(host="0.0.0.0", port=8000, workers=4)
```

## Requirements

- Python 3.7+
- fastpysgi (installed automatically)

## License

MIT License
