Getting started¶
PyWeft is a UI framework for Python: you write components as .weft files — an XML template plus a Python code
block — and PyWeft renders them to HTML, updating the page with minimal diffs
whenever state changes.
Your component code runs in real CPython. In the browser it runs on
Pyodide (CPython compiled to WebAssembly), so there is no transpilation and no
JavaScript to write. The same render core drives desktop apps in a native
window (pyweft run --desktop), and
later mobile: only the transport differs.
.weft file ──parse──▶ template ──render──▶ virtual DOM ──diff──▶ patch ops ──▶ real DOM
▲ │
└────────────── state change ◀───── events ◀───────────┘
- Requirements: Python ≥ 3.10. The core has zero runtime dependencies.
- Status: working proof of concept. APIs may still move.
Install¶
With uv:
With pip, the equivalent is pip install pyweft, then pyweft new and
pyweft run directly.
To hack on the framework itself, clone it and install in editable mode:
git clone https://github.com/prassanthn/PyWeft.git && cd PyWeft
uv sync --extra dev # or: pip install -e ".[dev]"
uv run pytest # 920 tests should pass
To see it working immediately, run the bundled todo app from the clone:
Then open http://127.0.0.1:8642/ — a todo app written entirely in Python, running in your browser.