Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Bretzel

Bretzel

Server-Driven UI for Python — typed state, zero npm, batteries included.

Bretzel is a full-stack Python web framework for reactive web apps. Python owns the application state and the interface that follows it. The browser receives targeted HTML updates through a small runtime built on HTMX and idiomorph: no React application, no duplicated client store and no npm pipeline to operate in production.

Alpha: the latest public alpha is 0.1.0a2. APIs may change between alpha releases; only the latest alpha receives fixes.

See it first: component gallery · documentation · live Kanban.

Quickstart

Requires Python 3.12 or 3.13.

python -m pip install bretzel
bretzel new hello
cd hello
python -m pip install -e .
bretzel dev

Open http://127.0.0.1:8000, then edit app/features/home.py.

For an existing application:

bretzel dev my_package.main:app --port 8010

The model

from bretzel import page, refreshable, ui
from bretzel.state import SessionState


class Counter(SessionState):
    value: int = 0


def increment() -> None:
    Counter().value += 1


@refreshable(deps=[Counter])
def count() -> None:
    ui.heading(str(Counter().value))


@page("/", title="Counter")
def home() -> None:
    count()
    ui.button("+1", on_click=increment)

deps= names the typed state read by a fragment. When that state changes, Bretzel renders and ships only that fragment. broadcast= can send the same mutation to other open windows without polling or subscription code.

What is included

  • typed server and client state;
  • more than 100 UI components;
  • partial navigation and refreshable fragments;
  • realtime updates over SSE;
  • signed actions, CSRF protection and security headers;
  • OAuth/OIDC doors and signed-cookie identity;
  • drag-and-drop with server arbitration;
  • server-rendered SVG charts;
  • bretzel describe, bretzel check and browser probes;
  • a production wheel containing the readable and minified runtime.

Start with examples/pomodoro for a small application, examples/kanban for realtime collaboration, examples/playground for the component catalogue and examples/docs for the live reference.

How it compares

NiceGUI keeps a live server-side UI object tree, Reflex compiles Python into a React application, and FastHTML stays deliberately close to HTML. Bretzel instead combines typed state and declared dependencies with targeted server-rendered fragments, multi-user updates and 100+ integrated components, without a Node or Bun build pipeline. Coming from Streamlit or Dash, you keep the Python-first workflow and gain explicit state with partial updates instead of reruns or callback wiring.

Repository

bretzel/             framework source
examples/            complete demonstration applications
tests/               unit, integration, consistency and browser suites
.claude/bretzel/     detailed framework reference checked against the code

A bare pytest runs the fast unit, integration and consistency suites. Heavy suites are explicit:

pytest -m e2e
pytest -m browser
pytest -m probes
pytest -m audit

The public repository contains 249 consistency-test modules. They pin API, rendering, accessibility and architecture invariants so that fixes cannot silently drift back.

Production

Run the generated application as a regular ASGI app and provide a private secret through the environment:

BRETZEL_MODE=prod BRETZEL_SECRET_KEY="replace-with-a-random-secret" \
  uvicorn app.main:app --host 0.0.0.0 --port 8000

See SECURITY.md for private vulnerability reports and CONTRIBUTING.md for the development workflow.

License

MIT — see LICENSE.

Metadata

Release files for bretzel 0.1.0a2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bretzel 0.1.0a2
File Size Uploaded Provenance
bretzel-0.1.0a2.tar.gz 6.5 MB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for bretzel 0.1.0a2
File Interpreter ABI Platform
bretzel-0.1.0a2-py3-none-any.whl Python 3 none any Details

Total release size: 9.4 MB

Release files / bretzel-0.1.0a2.tar.gz

Download URL bretzel-0.1.0a2.tar.gz
Size 6.5 MB
Tags Source
SHA-256 checksum
How to use checksums
1aaa0e5ce8bd0ff2e05e90b8b3fc132acd9a72f5c5f7bb253f4fa48a8c4138b5
BLAKE2b-256 checksum
How to use checksums
406365298ca157a08e994725231e117069f1df17ccc03655890fc6a8eaca6b38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.

Transparency log

Release files / bretzel-0.1.0a2-py3-none-any.whl

Download URL bretzel-0.1.0a2-py3-none-any.whl
Size 2.9 MB
Tags Python 3
SHA-256 checksum
How to use checksums
8ba89d0b9f8e4d29ce52793153c79465d893021486b75a49d1347e2cc145ce8b
BLAKE2b-256 checksum
How to use checksums
d23fc11f9d975be7e380b2eb33d0787fc6ef183885c4506e5a1bf8134eecb5c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.

Transparency log

Security for bretzel 0.1.0a2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for bretzel-0.1.0a2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page