Starlette

1.0.0 · active · verified Wed Mar 25

Lightweight ASGI framework and toolkit. Foundation for FastAPI. Released version 1.0.0 on Mar 22, 2026 — first stable release after 8 years on ZeroVer (0.x). Now follows SemVer. 1.0 removed all features deprecated during the 0.x era. Directly used by the Python MCP SDK.

Warnings

Install

Imports

Quickstart

Minimal Starlette 1.0 app with lifespan and declarative routing.

from contextlib import asynccontextmanager
from starlette.applications import Starlette
from starlette.requests import Request
from starlette.responses import JSONResponse
from starlette.routing import Route

@asynccontextmanager
async def lifespan(app):
    # startup logic
    yield
    # shutdown logic

async def homepage(request: Request):
    return JSONResponse({'hello': 'world'})

app = Starlette(
    routes=[Route('/', homepage)],
    lifespan=lifespan,
)

# Run: uvicorn main:app

view raw JSON →