talira

Starlette

Lightweight ASGI framework and toolkit for async Python web services

open sourceBSD-3-Clausefree

Starlette is a lightweight ASGI framework and toolkit for building async web services in Python. It's a low-complexity HTTP framework with WebSocket support, in-process background tasks, startup and shutdown events, a test client, CORS, GZip, static files, streaming responses, and session and cookie support. It runs on asyncio or Trio, is fully type-annotated with few hard dependencies, and needs an ASGI server such as Uvicorn to run.

Problems it solves

  • build a small async web service in Python without a heavy framework
  • serve WebSockets and HTTP from the same Python async app
  • write an ASGI app I can run on Uvicorn

Features

  • lightweight HTTP web framework
  • WebSocket support
  • in-process background tasks
  • startup and shutdown events
  • test client
  • CORS, GZip, static files and streaming responses
  • session and cookie support
  • asyncio and Trio backends

Alternatives

The same job

These do what Starlette does.

  1. aiohttp Asynchronous HTTP client/server framework for asyncio and Python
  2. Tornado Python web framework and asynchronous networking library
  3. Sanic Fast asynchronous Python web framework with its own production server
  4. Falcon The minimal, fast, and secure web framework for Python
  5. FastAPI FastAPI framework, high performance, easy to learn, fast to code, ready for production
  6. Flask A lightweight WSGI web application framework for Python

Compare Starlette with the top 3