diff --git a/README.md b/README.md index 2aeb7d8..d65dc24 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

- TurboAPI Architecture + Turbito - TurboAPI Mascot

TurboAPI

@@ -8,6 +8,10 @@ The FastAPI you know. The speed you deserve.

+

+ Meet Turbito — the tiny Rust-powered engine that makes your FastAPI fly. +

+

PyPI version License @@ -18,10 +22,10 @@

The ProblemThe Solution • + Meet TurbitoQuick Start • - Benchmarks • - Async Support • - Migration Guide + What's New • + Benchmarks

--- @@ -65,6 +69,46 @@ The result? Your existing FastAPI code runs faster without changing a single lin --- +## Meet Turbito + +

+ Turbito +

+ +Turbito is the little engine inside TurboAPI. + +While you write normal FastAPI code, Turbito is: +- Parsing HTTP in Rust (Hyper/Tokio) +- Serializing JSON with SIMD acceleration +- Scheduling async work with Tokio's work-stealing scheduler +- Dodging the GIL like a speed demon + +You never see Turbito. You just feel the speed. + +--- + +## What's New + +### v0.5.21 — Free-Threading Stability Release + +This release fixes critical issues when running with **free-threaded Python (3.13t)** and **Metal/MLX GPU frameworks**: + +| Fix | Description | +|-----|-------------| +| **Memory Corruption** | Fixed race condition where request body bytes were corrupted when using async handlers with MLX models loaded | +| **Response Serialization** | Response objects now properly serialize their content instead of string representation | +| **Async BaseModel** | Async handlers with BaseModel parameters now correctly receive the validated model instance | +| **JSON Parsing** | Added Python fallback for edge cases where simd-json is too strict | + +**Technical Deep Dive:** When running free-threaded Python with Metal GPU frameworks, memory can be accessed concurrently by the CPU and GPU. We now use defensive copying (`PyBytes::new()` in Rust, `bytes(bytearray())` in Python) to ensure request data is isolated before processing. + +```bash +# Upgrade to get the fixes +pip install --upgrade turboapi +``` + +--- + ## Quick Start ### Installation @@ -115,15 +159,15 @@ app.run() Async handlers are automatically detected and routed through Tokio's work-stealing scheduler for optimal concurrency. -### For Maximum Performance +### Let Turbito Off the Leash -Run with Python's free-threading mode: +For maximum performance, run with Python's free-threading mode: ```bash PYTHON_GIL=0 python app.py ``` -This unlocks the full power of TurboAPI's Rust core by removing the GIL bottleneck. +This unlocks Turbito's full power by removing the GIL bottleneck. True parallelism, finally. --- @@ -306,6 +350,7 @@ Everything you use in FastAPI works in TurboAPI: | GZip middleware | ✅ | Configurable | | Background tasks | ✅ | Async-compatible | | WebSocket | ✅ | HTTP upgrade support | +| HTTP/2 | ✅ | With server push | | APIRouter | ✅ | Prefixes and tags | | HTTPException | ✅ | With custom headers | | Custom responses | ✅ | JSON, HTML, Redirect, etc. | @@ -386,7 +431,7 @@ app.add_middleware(GZipMiddleware, minimum_size=1000) ## Architecture -TurboAPI's secret is a hybrid architecture: +TurboAPI's secret is a hybrid architecture where Python meets Rust: ``` ┌──────────────────────────────────────────────────────────┐ @@ -460,10 +505,10 @@ python tests/benchmark_comparison.py - [x] Handler classification for optimized fast paths - [x] **Async handler optimization (Tokio + pyo3-async-runtimes)** - [x] **WebSocket HTTP upgrade support** +- [x] **HTTP/2 with server push** ### In Progress 🚧 -- [ ] HTTP/2 with server push - [ ] OpenAPI/Swagger auto-generation ### Planned 📋 @@ -491,7 +536,8 @@ MIT License. Use it, modify it, ship it. ---

- Stop waiting for Python to be fast. Make it fast. + Built for developers who love FastAPI.
+ Powered by Turbito ⚡

diff --git a/assets/turbito.png b/assets/turbito.png new file mode 100644 index 0000000..8b68efc Binary files /dev/null and b/assets/turbito.png differ