Skip to content

Hello World tutorial examples don't match library API (v2.3.0) #9

@curtis-turner

Description

@curtis-turner

Thank you

First off, thank you for building Stario. The handler pattern is clean, the Datastar integration
is well thought out, and the HTML builder API is a pleasure to use. Excited to see where this goes.

The problem

Every code example in the Hello World tutorial uses an API that does not exist in stario 2.3.0.

The tutorial shows:

app = Stario(tracer)
app.get("/", home)
await app.serve()

But Stario.__init__() takes no arguments, and Stario has no serve() method. Running any
of the tutorial steps as written produces:

TypeError: Stario.__init__() takes 1 positional argument but 2 were given

What actually works

The bundled hello-world template (stario/cli/templates/hello-world/main.py) uses a different
pattern that does work:

from stario.http.server import Server

@asynccontextmanager
async def bootstrap(app: Stario, span: TraceSpan) -> AsyncIterator[None]:
    app.get("/", home)
    yield

async def main():
    tracer_factory = RichTracer if sys.stdout.isatty() else JsonTracer
    with tracer_factory() as tracer:
        server = Server(bootstrap, tracer)
        await server.run()

The template shipped with the package and the tutorial on stario.dev describe two different APIs.

Affected pages

  • /tutorials/hello-world (all 5 steps: Minimal App, HTML Serving, Datastar Reactivity,
    Server Interaction, and the final 50-line version)

Suggestion

Either update the tutorial to use the Server/bootstrap pattern, or (if the simpler API was the
intended direction) re-add Stario.__init__(tracer) and Stario.serve() to the library. The
simpler form reads well for a getting-started guide, so it might be worth keeping both paths
available.

Contributing

I would be happy to submit a PR to update the tutorial examples myself. Are the docs for
stario.dev hosted in the main repo, or is there a separate docs repo I should be looking at?
If there is a contributing guide or any preferred process for doc changes, please point me
in the right direction.

Environment

  • stario 2.3.0
  • Python 3.14 (free-threaded)
  • macOS (Apple Silicon)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions