Skip to main content

Stario

Stario
Craft realtime hypermedia apps that are a joy to write and ship.

Documentation · Source


Stario is a small Python framework for enjoyable realtime hypermedia apps. It helps you build web apps where HTTP, HTML, and streaming stay visible in your code. Handlers are plain async functions; routes are registered explicitly; responses go through a dedicated writer. When the UI needs live updates, you can add Datastar and Relay without throwing away the same request/response mental model. The realtime tiles tutorial walks through the full pattern end to end.

Full guides, API reference, and tutorials live at stario.dev. This page is a short orientation for people landing on the repository.

Where Stario fits

Stario is an asyncio-native HTTP stack: you write async handlers and register routes on an App, and the stario CLI runs a built-in HTTP server (TCP or a Unix domain socket). It is not an ASGI application you mount in Uvicorn or Hypercorn; wiring goes through the bootstrap hook, Context, and Writer instead.

Requirements

Python 3.14 or newer is required. The package tracks current Python and the standard library (including APIs the framework builds on) rather than supporting older runtimes.

uvloop (optional): Stario defaults to the stdlib asyncio loop. For a faster event loop on Linux/macOS, install the optional extra and set STARIO_LOOP=uvloop:

uv add "stario[uvloop]"
# or: pip install "stario[uvloop]"

Then run with STARIO_LOOP=uvloop stario serve main:bootstrap (or stario watch). uvloop is not supported on Windows.

Quick start

From an example

Clone the repo (or copy an example directory) and run:

git clone https://github.com/bobowski/stario.git
cd stario/examples/tiles
uv sync
uv run stario watch main:bootstrap

See examples/ for tiles (recommended), hello-world, and chat-room (multi-file layout).

Manual setup

uv init my-app   # creates a new uv project (pyproject, layout)
cd my-app
uv add stario

Put this in main.py:

import stario.responses as responses
from stario import App, Context, Route, Span, Writer


async def home(c: Context, w: Writer) -> None:
    responses.text(w, "Hello from Stario")


HOME = Route.get("/")

async def bootstrap(app: App, span: Span):
    span.attr("app.name", "example")
    app.add(HOME, home)
    yield
uv run stario watch main:bootstrap

Install with pip install stario if you are not using uv. During startup, bootstrap runs until its single yield: register routes and attach attributes to span before yield; put teardown after yield when needed. Use stario watch in development so the process reloads when files change; use stario serve for a normal long-running server without reload. Server runtime policy (STARIO_HOST, STARIO_PORT, STARIO_TRACER, and related vars) is configured through environment variables — see stario serve --help (Stario does not load .env files; export vars in your shell or use your own dotenv tooling). See Getting started for project layout. For containers, TLS, and production-oriented setup, see Deployment: Containers, TLS, and safe releases.

What you get

  • Explicit wiring: async-generator bootstrap(app, span) with a single yield, Route endpoints, no hidden registration.
  • Sharp primitives: Context for the request, Writer for the response, HTML/SVG trees via stario.markup, telemetry via span.
  • Static assets: AssetManifest for fingerprinted URLs, StaticAssets(manifest).register(app) in bootstrap.
  • Hypermedia by default: HTML and SSE are first-class; realtime layers are optional when the product needs them.
  • Observable runs: spans for startup and requests are part of how you structure apps, not an afterthought.

What Stario is not

No bundled ORM, admin UI, or plugin discovery system. Databases, auth, and brokers stay in your code or thin adapters; the framework stays a focused HTTP and hypermedia core.

Releases

Version history and upgrade notes live in CHANGELOG.md.

Contributing

From stario/:

uv sync
uv run ruff check .
uv run ruff format --check .
uv run pyright
uv run pytest

Before committing:

uv run ruff check . --fix
uv run ruff format .

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stario-4.1.0.tar.gz (132.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stario-4.1.0-py3-none-any.whl (166.2 kB view details)

Uploaded Python 3

File details

Details for the file stario-4.1.0.tar.gz.

File metadata

  • Download URL: stario-4.1.0.tar.gz
  • Upload date:
  • Size: 132.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for stario-4.1.0.tar.gz
Algorithm Hash digest
SHA256 1fada742c0ec685953bbb8ef79f8b03cd3c050711321ffc63d236e90f0ebec46
MD5 b4f29decaf6fc5977f65de3029de6c37
BLAKE2b-256 259f0f0adb06d9215f92864adb4a188648500c52f00f4cae5c9d8e021d538130

See more details on using hashes here.

File details

Details for the file stario-4.1.0-py3-none-any.whl.

File metadata

  • Download URL: stario-4.1.0-py3-none-any.whl
  • Upload date:
  • Size: 166.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for stario-4.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5661e10239bb2c9c3ecc1e4773ed79fb620b0c7b8775a58bad5d374328a0a653
MD5 8b449ab19b911190463c2c6d7209f478
BLAKE2b-256 a8bad93dd3bdebd138bfe41f75f8bea8aa5d200f8b73dccdb01d4c6b1d0c53da

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

4.1.0 This release

2 files

4.0.1

2 files

4.0.0

2 files

3.4.0

2 files

3.3.0

2 files

3.2.0

2 files

3.1.0

2 files

3.0.1

2 files

3.0.0

3 files

2.3.0

2 files

2.2.1

2 files

2.2.0

2 files

2.1.0

2 files

2.0.5

2 files

2.0.4

2 files

2.0.3

2 files

2.0.2

2 files

2.0.1

2 files

2.0.0

2 files

1.6.0

2 files

1.5.0

2 files

1.4.0

2 files

1.3.0

2 files

1.2.0

2 files

1.1.0

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

0.2.0

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page