Skip to main content

tempestweb

📚 Documentation: Português (Brasil) · English (US) — bilingual docs site (PT-BR default + EN-US), deployed to GitHub Pages.

Build web apps in typed Python. One declarative widget tree, a DOM renderer, and three execution modes that share 100% of the application code: Mode A (WASM) runs your Python in the browser via Pyodide; Mode B (server) runs it on the server (FastAPI) and talks to a thin JS client over WebSocket or SSE; Mode C (transpile, experimental) transcribes your Python to native JavaScript — zero Python runtime, static hosting, great first-paint/SEO. Installable PWA, offline-first (service worker + IndexedDB), and WebPush are first-class — parity with tempest-react-sdk.

Sister project to tempestroid — same "one tree, multiple renderers" architecture. The renderer-agnostic engine (IR, reconciler, state, style, widgets) is shared; tempestweb adds a DOM leaf renderer (pure JavaScript, no framework, no build step, no TypeScript) and two patch transports.

Status

🚧 Early construction. See the design docs:

Want runnable apps? Browse the Example Gallery (PT-BR) — 41 single-concept demos (stopwatch, forms, data table/grid, kanban, chat, theming, i18n, canvas charts, app shells, native capabilities, observability, PWA/WebPush, and a server-mode walkthrough), each running unchanged in both modes.

Building something real? Read the App architecture & best practices guide (EN) — the ideal layered structure (routes · pages · components · styles · controllers · services · storages · schemas · utils · core), mirroring tempest-fastapi-sdk, so your app doesn't rot into garbage code.

How it works

   view(app) ──build──▶ Node tree (IR)        ← shared core (vendored from tempestroid)
                            │
                          diff
                            ▼
                        [ Patch ]              insert / remove / update / reorder / replace
                       ╱          ╲
              Mode A transport   Mode B transport
              (pyodide.ffi)       (WebSocket | SSE)
                       ╲          ╱
                  client/ (pure JS): apply patches to the DOM
                  + Style→CSS + event capture                  ← same code in both modes

The application's view() never names a transport — the same examples/counter/app.py runs under --mode wasm and --mode server unchanged. Capabilities (native/: http, audio, share, geolocation, clipboard, storage, camera) are typed awaitables with the same Python API in both modes — Mode A calls the Web API in-process, Mode B proxies it over a round-trip (see docs/contract.md).

Static SSR — render_to_html

A third render target, alongside the two interactive modes: the same typed tree renders to a static HTML string on the server — no JavaScript, no DOM, no runtime. HTML is just another leaf renderer.

from tempest_core import Column, Text, Button, Style
from tempest_core.style import Edge
from tempestweb.html import render_to_html, render_document

tree: Column = Column(
    style=Style(gap=8.0, padding=Edge.all(16)),
    children=[Text(content="Hello"), Button(label="Click")],
)

fragment: str = render_to_html(tree)                 # an HTML fragment
page: str = render_document(tree, title="Home", htmx=True)  # a full document

The CSS is byte-identical to what the DOM client emits (the style_to_css port mirrors client/style.js), and the new tempest-core 0.9.0 Widget.tag / Widget.attrs fields let you emit semantic, htmx-ready markup (Container(tag="nav", attrs={"hx-get": "/x"})). All text/attributes are escaped. See the Static SSR guide (EN).

Mode C — transpile to native JS (experimental) 🧪

The "TypeScript story" for Python: you write the typed-Python app; a compiler transcribes the app layer (state, view(), handlers) to native JavaScript, reusing the whole shared JS renderer. Zero Python runtime in the browser — static hosting, small bundle, great first-paint/SEO.

# examples/counter/app.py  (unchanged from Modes A/B)
@dataclass
class CounterState:
    value: int = 0

def view(app: App[CounterState]) -> Widget:
    def increment() -> None:
        app.set_state(lambda s: setattr(s, "value", s.value + 1))
    return Column(children=[
        Text(content=f"Count: {app.state.value}", key="label"),
        Button(label="+", on_click=increment, key="inc"),
    ])
from tempestweb.transpile import transpile_file

js: str = transpile_file("examples/counter/app.py")  # -> native ES module

The generated module runs on the native runtime (client/transpile/runtime.js) with a JS diff locked against a core-derived golden. Coverage is now 100% of tempest_core: all ~64 widgets, MD3 styling, state-with-methods, navigation (routes + URL), i18n, theme + responsiveness, native capabilities (http/storage/ cookies/…), field validators and both declarative and imperative animation. The tempestweb build/dev --mode transpile CLI emits a static, CDN-servable bundle.

See the canonical examples/transpile-tour — one app exercising the whole surface — and the guide (PT · EN). Still experimental: the typed subset is deliberately restricted (out-of-subset constructs fail loud with file:line) and the API may change.

Develop

uv venv && uv pip install -e ".[dev,server,cli]"
make check          # ruff + mypy + pytest + JS (jsdom) tests

Layout

Path What
tempest-core (dependency) Renderer-agnostic engine — IR/reconciler/state/style/widgets (import tempest_core), extracted from tempestroid.
tempestweb/components/ Native fields + forms (EmailField, PasswordField, LoginForm, …) plus the re-exported tempest-core library — 54 Material 3 components (Card, DataTable, Tabs, Drawer, Alert, BarChart/LineChart, …).
tempestweb/transports/ The one seam between modes (base.py Protocol, wasm.py, websocket.py, sse.py).
tempestweb/html/ Static SSR leaf renderer — render_to_html / render_document / style_to_css (Python port of client/style.js).
tempestweb/transpile/ Mode C (experimental): ast-based Python→JS compiler for the app layer. Paired with the native runtime in client/transpile/ (diff.js · widgets.js · runtime.js).
tempestweb/server/ FastAPI + WebSocket/SSE host (Mode B).
tempestweb/native/ Web API capability adapters — http, audio, share, geo, clipboard, storage, camera (Track N).
tempestweb/observability/ Telemetry, logger, error boundary, feature flags, auth — adapter pattern (Track O).
tempestweb/pwa/ Web App Manifest + icon emitter (Track P).
tempestweb/cli/ tempestweb new/dev/build/run/sync.
client/ Pure-JS DOM renderer (incl. Canvas draw-command execution for charts), Style→CSS, event capture; pwa/ sw/ offline/ push/ native/ subdirs.
tests/fixtures/ Golden wire-format fixtures derived from the core.

Conventions

Python: double quotes, full typing (mypy --strict), Google docstrings in English, async-first. Client: plain JavaScript only — no TypeScript, no framework, no build step. See CLAUDE.md.

Download files

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

Source Distribution

tempestweb-0.26.0.tar.gz (284.6 kB view details)

Uploaded Source

Built Distribution

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

tempestweb-0.26.0-py3-none-any.whl (307.6 kB view details)

Uploaded Python 3

File details

Details for the file tempestweb-0.26.0.tar.gz.

File metadata

  • Download URL: tempestweb-0.26.0.tar.gz
  • Upload date:
  • Size: 284.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tempestweb-0.26.0.tar.gz
Algorithm Hash digest
SHA256 c545c474ab0d5484482fbdda56cbb13ef0b2d78ec07b27d88f1d18e35d59943b
MD5 972f2c7746e1a15ad764dca16ad32d88
BLAKE2b-256 7da36afeedb8fcab8822e333917122f3da5680ffa719becc6a475d0c97362b27

See more details on using hashes here.

Provenance

The following attestation bundles were made for tempestweb-0.26.0.tar.gz:

Publisher: publish.yml on mauriciobenjamin700/tempestweb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tempestweb-0.26.0-py3-none-any.whl.

File metadata

  • Download URL: tempestweb-0.26.0-py3-none-any.whl
  • Upload date:
  • Size: 307.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tempestweb-0.26.0-py3-none-any.whl
Algorithm Hash digest
SHA256 12d2afd6fe0aa5d8c8bed856563871aa6602d1df99a35ef618a2d5abab888088
MD5 8c547ea80432f51cab624d6a06bea50a
BLAKE2b-256 c91683a9af15587921d0600258007085be0b2b07cf2193e04235c5fe5f63200d

See more details on using hashes here.

Provenance

The following attestation bundles were made for tempestweb-0.26.0-py3-none-any.whl:

Publisher: publish.yml on mauriciobenjamin700/tempestweb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.121.0

2 files

0.120.0

2 files

0.113.0

2 files

0.111.0

2 files

0.108.0

2 files

0.98.0

2 files

0.78.1

2 files

0.78.0

2 files

0.67.0

2 files

0.66.0

2 files

0.65.0

2 files

0.64.0

2 files

0.63.0

2 files

0.62.0

2 files

0.61.2

2 files

0.61.1

2 files

0.61.0

2 files

0.60.0

2 files

0.59.0

2 files

0.58.0

2 files

0.57.0

2 files

0.56.0

2 files

0.55.1

2 files

0.55.0

2 files

0.54.0

2 files

0.53.2

2 files

0.53.1

2 files

0.53.0

2 files

0.52.0

2 files

0.51.0

2 files

0.50.0

2 files

0.49.0

2 files

0.48.0

2 files

0.47.0

2 files

0.46.0

2 files

0.45.0

2 files

0.44.0

2 files

0.43.0

2 files

0.42.0

2 files

0.41.0

2 files

0.40.0

2 files

0.39.0

2 files

0.38.0

2 files

0.37.0

2 files

0.36.0

2 files

0.35.0

2 files

0.34.0

2 files

0.33.0

2 files

0.32.0

2 files

0.31.0

2 files

0.30.0

2 files

0.29.0

2 files

0.28.0

2 files

0.27.0

2 files

This release

0.26.0 This release

2 files

0.25.0

2 files

0.24.0

2 files

0.23.0

2 files

0.22.0

2 files

0.21.0

2 files

0.20.0

2 files

0.19.0

2 files

0.18.0

2 files

0.17.0

2 files

0.16.0

2 files

0.15.0

2 files

0.14.0

2 files

0.13.0

2 files

0.12.0

2 files

0.11.0

2 files

0.10.0

2 files

0.9.0

2 files

0.8.1

2 files

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.3

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

2 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