Build web and desktop apps in Python¶
Write components as .weft files, an XML template plus a Python code block.
PyWeft runs them in the browser on real CPython compiled to WebAssembly, or in
a native window with Python on your machine. No JavaScript to write, no build
step.
Type in the box and the heading follows; click and the count goes up.
State is plain Python fields. After every event PyWeft renders the component again, works out what changed and updates only that part of the page. There are no signals or observables to learn, and your code is ordinary Python that you can test without a browser.
Quick start¶
You need Python 3.10 or newer. With uv:
Open http://127.0.0.1:8642/, then edit myapp/app.weft and save: the page
updates in place and keeps what you'd typed. With pip, pip install pyweft,
then pyweft new myapp and pyweft run myapp.
What you get¶
-
Components in one file
Template, Python code and a
<style>block that only applies to that component. Props, events, slots and@bindfor composing them. -
Web and desktop from one app
pyweft buildmakes a static site any host can serve.pyweft run --desktopopens it in a native window, andpyweft build --desktopmakes a program to hand out. -
Ready-made controls
pyweft-ui: buttons, menus, chips, sliders, form fields with validation, autocomplete and input masks, date and range pickers, an event calendar, charts, tabs, sortable tables, dialogs, toasts, layout, and light and dark themes. No HTML or CSS needed. -
Pages and shared state
A
pages/folder becomes your app's screens, with links, Back and Forward. AStoreholds what many components use. -
Async and background work
async defhandlers, andrun_in_background()to run heavy Python in a Web Worker so the page never freezes. -
A fast dev loop
Hot reload that keeps your app's state, readable errors that point to your
.weftfile and line, and a first screen that shows before Python has even started.
Where next¶
- New here? The tutorial builds a todo app step by step, in about fifteen minutes.
- Looking something up? The guide covers every part of PyWeft, and the controls guide the toolkit.
- Want to see it working first? Try the examples, running live in this browser.
- Working with an AI assistant? Every app comes with an
AGENTS.mdthat teaches it PyWeft, andpyweft checklets it find its own mistakes: see AI assistants.