Python frontend · React renderer · WebAssembly
Write your front end in Python.¶
PyReact Forge gives Python developers a component API and React hooks for building interactive browser interfaces. Python runs in the browser through Pyodide; React handles reconciliation, state slots and DOM rendering.
MIT framework 0.1.0a1 · alpha Python 3.11+ CLI
from pyreact_forge import component, html, use_state
@component
def App():
count, set_count = use_state(0)
return html.button(
f"Clicked {count} times",
on_click=lambda: set_count(lambda previous: previous + 1),
)
What you can build¶
Internal tools, interactive prototypes, browser utilities and data-oriented UIs that benefit from Python logic on the client. A static host can serve the exported app; browser callbacks do not need a Python application server.
An ordinary backend remains appropriate for private credentials, authorization, database access and trusted operations. Browser Python is client code.
-
Learn the component model
Compose Python functions with props, children, state and reusable hooks.
-
Handle real interaction
Build controlled forms, keyed lists, shared state and browser navigation.
-
Load data with Suspense
Use stable Python resources and async functions with React boundaries.
-
Understand the boundaries
Read the tested capability matrix before choosing the alpha for a project.
What runs where?¶
| Layer | Runs in | Responsibility |
|---|---|---|
| Python CLI | Your development computer | Create, build and serve files |
| Python components | Browser WebAssembly runtime | Render descriptions and event logic |
| React/React DOM | Browser JavaScript runtime | Hooks, scheduling and DOM reconciliation |
| Optional SSR renderer | Node + Pyodide | Initial HTML and hydration-compatible markup |
Alpha scope¶
Function/class components, the stable hook adapters, forms, refs, context, Suspense, portals, Activity and optional routing are implemented. Targeted tests also exercise server rendering and hydration. Some adapters have less coverage than others; the matrix records the distinction.
React Server Components/Flight, a Python compiler equivalent to React Compiler, state-preserving Fast Refresh and a production SSR service remain future work. The framework is built on React; it does not implement an independent renderer.
Choose your next step¶
- New to the project: install and run your first app.
- Familiar with React: map JSX and hooks to Python.
- Want an end-to-end example: build a small task app.