v0.1.5 · alpha

Python web apps,
after dark.

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]"
app.py
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.py
Why Night

Small core. Serious toolkit.

Keep the framework simple without rebuilding the same web primitives for every project.

1

Single-file core

The framework lives in night.py with no required runtime dependencies on normal CPython.

Fast routing

Static routes use direct indexes while common dynamic routes compile into specialized fast paths.

FAST

Fast mode

Use Night().fast() to enable orjson; night run also selects uvloop, httptools and websockets when available.

±

Sync + async

Write either style. Night classifies handlers at registration time and builds route-specific invokers.

HTTP

Batteries included

JSON, forms, multipart, cookies, sessions, CSRF, streaming, SSE, WebSocket, static files, hooks and middleware.

{ }

Typed validation

Validate nested dataclasses, optional values and list[T] request bodies without a heavy validation stack.

Built-in tooling

TestClient, CLI, named routes, OpenAPI generation, JSON-RPC, extensions and a lightweight SQLite ORM.

STD

Standard profile

all-night[standard] installs the recommended server stack. Midnight is optional and ships separately as all-night-midnight.

MCP

MCP tooling

Expose Night RPC methods as stateless MCP tools with discovery, tool listing and tool calls.

CF

Cloudflare Workers

Use Night with Cloudflare Python Workers through the Workers-native request bridge and RPC / Service Bindings. Workers run on Pyodide, not Uvicorn.

Vercel ASGI

Deploy the standard ASGI app directly on Vercel's Python runtime—no adapter layer required.

Documentation

Official docs, without leaving Night.

The docs viewer fetches Markdown live from 22552/all-night through the GitHub API. Links between documentation pages stay on this site.

/docs/getting-started/quickstart.md
GitHub-backed Markdown

/docs/ loads docs/README.md. Any /docs/*.md path maps to the same file under the official repository's docs/ directory.

Stay lightweight

One file when you want simplicity. More tools when you need them.

Night is alpha software and moving quickly. Read the docs, try the current PyPI release, or follow development on GitHub.