Typed state
Choose the scope that matches the lifetime: page, session, user, app, or client-only.
Bretzel is a full-stack Python framework where the server owns the state and the browser follows—updating only the part of the page that changed.
class Counter(SessionState): value: int = 0 def increment() -> None: Counter().value += 1 @refreshable(deps=[Counter]) def count() -> None: ui.heading(str(Counter().value)) ui.button("+1", on_click=increment)
Declare what a region reads. Change typed state anywhere on the server. Bretzel finds the dependent region, renders it, and swaps that fragment in the browser.
Choose the scope that matches the lifetime: page, session, user, app, or client-only.
deps= makes the relationship explicit, so updates stay local instead of rerunning the app.
No manual refresh call. No second client store. Mutating state is enough.
Rich components and server-driven HTML, without turning your application into a JavaScript build project.
Add broadcast= when a mutation should reach other open windows. Bretzel sends the update over SSE—no polling and no subscription code. The Kanban example uses this for shared drag-and-drop and undo/redo.
Forms, overlays, navigation, data tables, server-rendered SVG charts, security headers, signed actions, OAuth/OIDC doors, and more.
bretzel describe exposes the exact API. bretzel check catches structural mistakes, including a deep application check.
It sits between script-style app tools and a hand-built frontend: a Python-native application model with explicit state and targeted rendering.
Bretzel does not keep a per-tab server-side UI object tree. Typed state and declared dependencies determine which HTML region is rendered and sent.
Bretzel serves HTML fragments directly instead of compiling your Python app into React. There is no Node or Bun build pipeline to operate.
Bretzel adds a typed state model, targeted reactive regions, and 100+ integrated components on top of the server-rendered approach.
Bretzel 0.1.0a1 is the first public alpha. APIs may change, and the project currently has one maintainer. It is ready for people willing to build a small internal tool, find the rough edges, and shape the model with real feedback.
Install the alpha, generate an app, and run it locally. Start small; bring back the confusing parts.
pip install bretzel