Single-file core
The framework lives in night.py with no required runtime dependencies on normal CPython.
Night is a tiny, single-file ASGI framework for Python 3.11+. Dependency-free at the core, with an optional standard profile for orjson, Uvicorn fast backends, Midnight, and Cloudflare development support.
pip install -U "all-night[standard]"from night import Night
app = Night().fast()
@app.get("/")
def index():
return {"hello": "night"}
@app.get("/users/<int:user_id>")
def user(user_id: int):
return {"id": user_id}
# night run app.pyKeep the framework simple without rebuilding the same web primitives for every project.
The framework lives in night.py with no required runtime dependencies on normal CPython.
Static routes use direct indexes while common dynamic routes compile into specialized fast paths.
Use Night().fast() to enable orjson; night run also selects uvloop, httptools and websockets when available.
Write either style. Night classifies handlers at registration time and builds route-specific invokers.
JSON, forms, multipart, cookies, sessions, CSRF, streaming, SSE, WebSocket, static files, hooks and middleware.
Validate nested dataclasses, optional values and list[T] request bodies without a heavy validation stack.
TestClient, CLI, named routes, OpenAPI generation, JSON-RPC, extensions and a lightweight SQLite ORM.
all-night[standard] installs the recommended server stack. Midnight is optional and ships separately as all-night-midnight.
Expose Night RPC methods as stateless MCP tools with discovery, tool listing and tool calls.
Use Night with Cloudflare Python Workers through the Workers-native request bridge and RPC / Service Bindings. Workers run on Pyodide, not Uvicorn.
Deploy the standard ASGI app directly on Vercel's Python runtime—no adapter layer required.
The docs viewer fetches Markdown live from 22552/all-night through the GitHub API. Links between documentation pages stay on this site.
/docs/ loads docs/README.md. Any /docs/*.md path maps to the same file under the official repository's docs/ directory.
Use a normal ASGI server, deploy to Python serverless platforms, or take Night to Cloudflare Python Workers.
Night is alpha software and moving quickly. Read the docs, try the current PyPI release, or follow development on GitHub.