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 building reactive applications. Python owns the routes, typed state, actions and interface; the browser stays synchronized without a separate JavaScript application or an npm pipeline to operate in production.

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

Quickstart

Requires Python 3.12 or 3.13.

python -m pip install "bretzel @ git+https://github.com/JeanHoccart/bretzel.git"
bretzel new hello
cd hello
python -m pip install -e .
bretzel dev

Until the first PyPI release, the package is installed directly from GitHub. After publication, the first command becomes python -m pip install bretzel.

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.

Architecture

Bretzel is the framework application developers program against—not a React generator or a JavaScript build tool. Its implementation deliberately relies on proven lower-level components:

  • FastAPI and Starlette provide the ASGI and HTTP foundation;
  • HTMX transports navigation, actions and targeted HTML updates;
  • Idiomorph reconciles returned fragments with the current DOM;
  • Bretzel's integrated runtime handles client state, directives, reconnection and the framework protocol.

These components are implementation infrastructure. A Bretzel application is written, structured and deployed as a Python application; it does not require a separate frontend repository or an npm toolchain.

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.

From a repository checkout, launch that documentation with:

python -m examples.docs.main

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.

Release files for bretzel 0.1.0a1

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.0a1
File Size Uploaded
bretzel-0.1.0a1.tar.gz 6.5 MB Details

Built distribution (wheel)

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

Total release size:9.4 MB

Release files / bretzel-0.1.0a1.tar.gz

Download URL bretzel-0.1.0a1.tar.gz
Size 6.5 MB
Tags Source
SHA-256 checksum
How to use checksums
6bed9d05a3d55d9b1bd69c477176d823b68000f8c71091eebbb53044600f052a
BLAKE2b-256 checksum
How to use checksums
c1398ab18fa547588347fc131db4ba356529419444e4ed8f17582dadfff05948
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 Sep 15, 2026.

Transparency log

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

Download URL bretzel-0.1.0a1-py3-none-any.whl
Size 3.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
15c438f626ebec5498d5d44efc35b82e802afe31212c300696a1dc7b8067bcec
BLAKE2b-256 checksum
How to use checksums
3f8149c3b40763ea11f5202c74e183664ad3bfa7b21ddfccb8390bf8049dc147
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 Sep 15, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0a1 This release

2 release files

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