Install

Python 3.12 or newer, one package, one command to run.

Stario needs Python 3.12 or newer. These docs use uv, but any tool that installs from PyPI works.

uv init --app my-app
cd my-app
uv add "stario>=5,<6"

Or, in an existing project, pip install "stario>=5,<6".

Run an app#

Stario has its own server. main.py ends with asyncio.run(serve(bootstrap)), so the file runs itself.

uv run python main.py                                # runs once
uvx watchfiles 'uv run python main.py' .             # restarts when a file changes

The server listens on http://127.0.0.1:8000. Set STARIO_PORT or STARIO_HOST to change that:

STARIO_PORT=8080 uv run python main.py

Optional: uvloop#

On Linux and macOS, uvloop is a faster event loop. Install the extra and run the app on it.

uv add "stario[uvloop]"
import uvloop
from stario import serve
 
uvloop.run(serve(bootstrap))

By the way#

  • Stario is not ASGI. It does not run under Uvicorn or Hypercorn. serve() is the server.

  • All settings are environment variables with a STARIO_ prefix. Configuration lists them.

  • Telemetry is on by default. In a terminal you see one tree per request. Telemetry design explains why.

Next: Hello world writes the first app.