Skip to main content

Stario brings back the joy of building web apps

Reason this release was yanked:

Sunsetting in favour of 2.x

Project description

stario-logo

✨ Binging back joy and exploration to building web apps ✨


Documentation: Coming soon

Source Code: https://github.com/bobowski/stario


Stario

Stario is a lightweight ASGI framework built on top of Starlette that brings back the joy of building web apps. Focus on building apps rather than passing data between components.

Why Stario?

  • HTML-first - dropping intermediary data layers (e.g. JSON) and using HTML as the primary data format. "Just throw html at user and make them happy."
  • Rapid prototyping - a simple framework to build and test fullstack ideas with minimal setup. Build, see if it works, optimize later (if ever).
  • No-nonsense - no ceremony, no complexity, just build.
  • Learning experience - Learn about web, rather than X or Y language framework. I've learned a lot building this framework. I hope you will too.

It focuses on:

  • HTML-first DX: return strings or HTML providers, no ceremony.
  • Realtime by default: seamless Server-Sent Events (SSE) with DataStar patches/signals.
  • Great defaults: Brotli compression out of the box, fast dependency resolution, and caching.
  • Starlette compatibility: interop with routes, middleware, and tools you already know.

What you get:

  • A tiny, low-complexity HTTP framework powered by Starlette and DataStar.
  • SSE streaming by simply yielding patches, HTML, or signals (dicts).
  • Brotli compression middleware enabled by default (GZip fallback).
  • Simple DI via Annotated with request params (QueryParam, PathParam, Header, Cookie) and Inject.
  • Per-request/app/ttl caching and configurable run modes (auto, sync, thread).
  • Header-constrained routes and a lightweight StarRouter.
  • Few dependencies and a clear, typed codebase.

Installation

From PyPI (when available):

pip install stario

Or from source in this repository:

cd stario
pip install -e .

You'll also want an ASGI server such as uvicorn:

pip install uvicorn

Quick start

# main.py
import asyncio
from stario import Stario, Query, Command
from stario.toys import ToyPage


async def home():
    return ToyPage(
        """
        <h2>Realtime responses!</h2>
        <div data-on-load="@get('/online-counter')">
            This shows how long the connection has been open.
        </div>
        <div id="online-counter"></div>
        """
    )


async def online_counter():
    duration = 0
    interval = 0.01
    while True:
        # Yielding strings/patches streams as SSE with DataStar-compatible events
        yield f"<div id='online-counter'>Online since: {duration:.1f}s</div>"
        duration += interval
        await asyncio.sleep(interval)


# Building the app
app = Stario(
    Query("/", home),
    Query("/online-counter", online_counter),
)

Run with Uvicorn:

uvicorn main:app --reload

Open http://127.0.0.1:8000/ in your browser.


Stario code is designed & crafted for joy.
— ⭐️ —

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

stario-0.1.0.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

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

stario-0.1.0-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: stario-0.1.0.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.6

File hashes

Hashes for stario-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f1df438fcc088d5bc27d0c63a434b08d4561e3a9fa4607a29cff0fcc3d325535
MD5 7e73dd811d379036a274b09058d96f08
BLAKE2b-256 1159797b49ae6828701ea73c0ed9c84b74d4f6edd1a2dfe213880fa9da08b6cc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: stario-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.6

File hashes

Hashes for stario-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 66bec4bba23a3765b8c7b7543aebdda0a78df2c8d45333ca1f43f9025e763289
MD5 db5b0d0fb3acb6a8752124e8ef67a0f9
BLAKE2b-256 81f245c42604b6ee82e27f63e3d1323765230c8808ce61bf66983107f62e9185

See more details on using hashes here.

Supported by

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