Skip to main content

TurboAPI - a high-performance ASGI framework with compiled routing, DI, validation, and OpenAPI.

Project description

py-turbo-api

TurboAPI is a small, fast ASGI web framework built from scratch (stdlib-only) with a focus on predictable performance.

Features

  • Trie router with {param} path params
  • APIRouter composition with prefixes/tags via include_router()
  • Compiled route plans (signature inspection happens at route registration, not per request)
  • Dependency injection with Depends() including nested and yield-based dependencies
  • Parameter source markers: Query, Header, Cookie, Form, File
  • Built-in validation with Model + field() (supports Annotated, Literal, Enum, datetime, UUID, Decimal)
  • Multipart/form-data parsing with UploadFile
  • Multipart hardening: per-file/part/field limits + upload spooling to disk
  • StreamingResponse, FileResponse, BackgroundTask, and static file mounting
  • Response primitives: RedirectResponse, NegotiatedResponse, cache header helpers, and EventSourceResponse for SSE
  • File hardening: ETag/If-None-Match + byte range (206/416) support
  • WebSocket route support via @app.websocket(...)
  • Sub-app mounting via app.mount("/prefix", sub_app) and host routing via app.mount_host("*.example.com", app)
  • WebSocket auth helpers (websocket_token_auth, websocket_jwt_auth) and OpenAPI WS extension docs (x-turbo-websockets)
  • Security primitives: api_key_auth(), bearer_auth(), jwt_auth(), OAuth2 password/auth-code/client-credentials helpers with OpenAPI security schemas
  • Session + CSRF protection primitives (SessionMiddleware, CSRFMiddleware, CSRF helpers)
  • OpenAPI at /openapi.json
  • Swagger UI at /docs and ReDoc at /redoc
  • Lifespan startup/shutdown handlers
  • Custom exception handlers with @app.exception_handler(...)
  • Reliability defaults: request timeout, max body size, max concurrency
  • Runtime settings model (TurboSettings) + Turbo.from_env() for env-driven deploy config
  • Graceful shutdown request draining (shutdown_drain_timeout)
  • CI release gates: Python matrix tests/lint + package build and twine check, with trusted publishing workflow
  • Benchmark suite + perf regression gates in CI (benchmarks/bench_runtime.py)

Stability

  • Compatibility policy: API_COMPATIBILITY.md
  • Current status: pre-1.0 (public API is stabilizing toward v1.0.0)

Install

From PyPI

pip install py-turbo-api

PyPI: https://pypi.org/project/py-turbo-api/

Run example

uvicorn app:app --reload

Open:

Documentation Tracks

  • Tutorial: docs/tutorial.md
  • Advanced: docs/advanced.md
  • Deployment: docs/deployment.md
  • Security recipes: docs/security-recipes.md
  • Why TurboAPI + benchmark method: docs/why-turboapi.md

Benchmarks

python benchmarks/bench_runtime.py --baseline benchmarks/baseline.json --tolerance 1.20 --gate

License

Apache-2.0 (see LICENSE).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_turbo_api-1.0.1.tar.gz (67.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_turbo_api-1.0.1-py3-none-any.whl (56.5 kB view details)

Uploaded Python 3

File details

Details for the file py_turbo_api-1.0.1.tar.gz.

File metadata

  • Download URL: py_turbo_api-1.0.1.tar.gz
  • Upload date:
  • Size: 67.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for py_turbo_api-1.0.1.tar.gz
Algorithm Hash digest
SHA256 6719de92fb96351b3989b1322fb023442cbdb0bf7cde3dcb417dc59b291f206b
MD5 504def4ae56d750e735d27187e0ceff2
BLAKE2b-256 3e8e267506aa0c1a00c92fae3296d9220a7af342afa9d53ed939a99881253e29

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_turbo_api-1.0.1.tar.gz:

Publisher: publish.yml on pareshpanat/turboapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file py_turbo_api-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: py_turbo_api-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 56.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for py_turbo_api-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1a797a69fb09bc5804b75471e50f79b344d1cb4db1a572f6038464c40341311f
MD5 a9f64125d5ea99d1be6557da48a0f442
BLAKE2b-256 4d167ae966ffc1105507312729cbf8a1343ad0afbbc405bf66d946b4bb9f8d41

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_turbo_api-1.0.1-py3-none-any.whl:

Publisher: publish.yml on pareshpanat/turboapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page