API reference
Generated from the docstrings. Every module has an index of its classes and functions at the top.
Core
The application object, routing, configuration and error handling.
ushka.core.app | This module defines the core Ushka application class, which serves as the central entry point for handling ASGI requests, managing… |
ushka.core.router | This module defines the Router class, which acts as the central route manager for the Ushka framework. |
ushka.core.config | Application configuration: defaults < ushka.toml < .env < environment. |
ushka.core.error_handler | This module provides centralized exception handling for the Ushka framework. |
ushka.core.settings | Every setting Ushka reads, in one place: its default and what it does. |
ushka.core.server | The production server: Uvicorn with an idle loop that does not burn CPU. |
ushka.core.log | Terminal output for Ushka: coloured, compact, standard-library only. |
HTTP
Requests, responses, typed parameters, validation, sessions, streaming and WebSockets.
ushka.http.request | This module defines the Request class for handling incoming HTTP requests. |
ushka.http.response | This module defines the Response class for handling HTTP responses. |
ushka.http.params | Declared handler parameters: typed path/query/header/cookie/body and Depends. |
ushka.http.validation | Type-driven validation of request data, with no dependencies. |
ushka.http.cookies | This module provides a full-stack cookie management utility, the Cookies class. |
ushka.http.redirect | This module provides a helper function for generating HTTP redirection responses. |
ushka.http.stream | Streaming responses and Server-Sent Events (SSE). |
ushka.http.websocket | WebSockets. A handler named websocket in routes/, or @app.websocket:: |
ushka.http.multipart | This module provides utilities for parsing multipart/form-data requests, commonly used for file uploads in web applications. |
ushka.http.error | This module provides a convenient helper function for raising HTTP errors within the Ushka framework. |
ushka.http.exceptions | This module defines custom HTTP exception classes for the Ushka framework. |
Sessions
The signed-cookie session and revocable server-side sessions.
ushka.sessions.session | This module provides the Session class, a secure client-side session manager for the Ushka framework. |
ushka.sessions.stores | Where server-side sessions live. |
ushka.sessions.forge | Forging a session for tests: the supported way to be "logged in" without a login. |
Security
The security middleware that is on by default: CSRF, headers, CORS and trusted hosts.
ushka.security.middleware | Security middleware, on by default. |
ushka.security.verify | ushka verify: attack your own app and report what got through. |
Encryption
Fernet encrypt and decrypt with key rotation (needs ushka[crypto]).
ushka.crypto.fernet | Fernet encryption: encrypt, decrypt, generate_key and key rotation. |
Sign in (OAuth)
Login with Google and GitHub: the helpers for your routes and the providers.
ushka.auth | Login with OAuth 2.0 / OpenID Connect: Google and GitHub, no extra dependency. |
ushka.auth.providers | OAuth 2.0 / OpenID Connect providers: Google and GitHub, on the standard library. |
ushka.auth.flow | The built-in login routes: /auth/<provider>/login and /auth/<provider>/callback. |
Guard
Ushka Guard: taint tracking for untrusted input, checked sinks and the safe helpers.
ushka.guard.untrusted | The Untrusted string type and its propagation rules. |
ushka.guard.safe | Explicit sanitisers: the only sanctioned way to turn Untrusted into trusted. |
ushka.guard.sinks | Checks run by dangerous sinks before they use a value. |
ushka.guard.templates | Safe-by-construction HTML and SQL from t-strings (PEP 750, Python 3.14+). |
ushka.guard.rewrite | Compile-time rewriting that keeps the Untrusted mark where CPython drops it. |
ushka.guard.errors | The error raised when an untrusted value reaches a dangerous sink. |
Guard integrations
Ushka Guard for Starlette, FastAPI and Django.
ushka.guard.integrations.starlette | Ushka Guard for Starlette and FastAPI. |
ushka.guard.integrations.fastapi | Ushka Guard for FastAPI. |
ushka.guard.integrations.django | Ushka Guard for Django. |
Data, templates and files
The ORM, the Jinja engine, static files and flash messages.
ushka.orm.database | This module provides an asynchronous Object-Relational Mapper (ORM) for the Ushka framework, built on top of SQLAlchemy 2.0. |
ushka.orm.reflect | Reads an existing database and writes Ushka models for it. |
ushka.templating.engine | This module provides advanced templating functionality using Jinja2. |
ushka.static.files | Static file serving: the [static] directory and any number of mounts. |
ushka.templating.flash | This module provides "flash messaging" functionality for the Ushka framework, allowing messages to be stored in the user's session and… |
Reading e-mail over IMAP, with everything from the message marked Untrusted.
ushka.mail.imap | ImapClient: read the inbox of a mailbox (support, leads, receipts) from an app. |
Web: SEO, PWA and i18n
What browsers and search engines see.
ushka.web.seo | SEO that ships ready: meta tags for your templates, robots.txt and sitemap.xml. |
ushka.web.pwa | Progressive Web App support, configured in [pwa] of ushka.toml. |
ushka.web.i18n | Internationalisation: translations from standard gettext catalogs, no extra packages. |
ushka.web.i18n.tools | Tools behind ushka i18n: find messages, write a .pot, compile .po to .mo. |
Agents and tooling
Routes as MCP tools, OpenAPI from signatures, and `ushka verify`.
ushka.api.openapi | OpenAPI 3.1 description of your app, generated from the handler signatures. |
ushka.api.mcp | Routes as agent tools, over MCP (Model Context Protocol). |
ushka.testing | A test client for Ushka apps, on the standard library only. |
CLI commands
The commands behind the `ushka` program.
ushka.cli.commands.new | ushka new: scaffolds a project that is secure and runnable from the start. |
ushka.cli.commands.dev | ushka dev: development server with reload and debug on. |
ushka.cli.commands.run | ushka run (production) and the server logic shared with ushka dev. |
ushka.cli.commands.routes | ushka routes: list, add, remove and move filesystem routes. |
ushka.cli.commands.check | ushka check: validates configuration and security settings. |
ushka.cli.commands.db | This module provides the Command Line Interface (CLI) commands for database migration management using Alembic. |