Skip to main content

py-cheema-api

py-cheema-api 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)
  • Optional Pydantic v2 compatibility (request/response models + OpenAPI schema integration when installed)
  • 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-cheema-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)
  • Testing utilities: sync TestClient and async AsyncTestClient with WebSocket test sessions
  • OpenAPI at /openapi.json
  • Swagger UI at /docs and ReDoc at /redoc
  • Lifespan startup/shutdown handlers
  • Lifespan state resources with cleanup guarantees (app.add_state_resource(...))
  • App-state dependency helpers (app.state_dependency(...), app_state_dependency(...), get_app_state(...))
  • Custom exception handlers with @app.exception_handler(...)
  • Reliability defaults: request timeout, max body size, max concurrency
  • Runtime settings model (CheemaSettings) + Cheema.from_env() for env-driven deploy config
  • Graceful shutdown request draining (shutdown_drain_timeout)
  • Background job primitives: InMemoryJobQueue with retries, delay/schedule, and idempotency keys
  • Queue adapters: CeleryQueueAdapter, RQQueueAdapter, RedisQueueAdapter
  • 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-cheema-api

Optional: Pydantic v2 compatibility

pip install "py-cheema-api[pydantic]"

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

Run example

uvicorn app:app --reload

Open:

Documentation Tracks

  • Docs home (GitHub Pages entry): docs/index.md
  • Complete API reference: docs/api-reference.md
  • Tutorial: docs/tutorial.md
  • Advanced: docs/advanced.md
  • Deployment: docs/deployment.md
  • Security recipes: docs/security-recipes.md
  • Why py-cheema-api + benchmark method: docs/why-py-cheema-api.md

Benchmarks

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

License

Apache-2.0 (see LICENSE).

Download files

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

Source Distribution

py_cheema_api-1.0.0.tar.gz (89.6 kB view details)

Uploaded Source

Built Distribution

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

py_cheema_api-1.0.0-py3-none-any.whl (73.2 kB view details)

Uploaded Python 3

File details

Details for the file py_cheema_api-1.0.0.tar.gz.

File metadata

  • Download URL: py_cheema_api-1.0.0.tar.gz
  • Upload date:
  • Size: 89.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for py_cheema_api-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9c79a1d2833509f0a139e9c7b10566d2dcd3e0c7ebac8263fb1be8c4d50b1758
MD5 74ea2dfaa246aaf13ca3fb3e858954ec
BLAKE2b-256 c9ef8395c574af87efdb6e8dc03695d9101f09879f4d9aba84a5872b1b8ebe76

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_cheema_api-1.0.0.tar.gz:

Publisher: publish.yml on pareshpanat/py-cheema-api

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_cheema_api-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: py_cheema_api-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 73.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for py_cheema_api-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8d54f58c9c418ac7f2b5027ec9bafc07762c75b8f31a6d2e3e152f068d80a9cd
MD5 cb120fc440e793403e8bc55ae63c5dfb
BLAKE2b-256 7b77f1bd6e5465363a10931afd25cf57e71f1fd06f7caeb26ece57540569b971

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_cheema_api-1.0.0-py3-none-any.whl:

Publisher: publish.yml on pareshpanat/py-cheema-api

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

Release history Release notifications | RSS feed

1.0.1

2 files

This release

1.0.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page