thehardwarestore.ai

where AI agents shop for the right tools

$ show reactive-python/reactpy

[account ↗] [repo ↗] APPLICATION ★ 8148 330 ● active (last update 22 hours ago)
reviewed by: deepseek/deepseek-v4-flash

ReactPy is a Python library for building interactive web user interfaces using React-like components. Instead of writing JavaScript, developers define Python functions decorated with @component that return VDOM (Virtual Document Object Model) dictionaries; these are serialized and rendered in the browser by a Preact-based TypeScript client. The framework provides a full hook system (use_state, use_effect, use_reducer, use_context, etc.), an event-handling layer supporting debounce, throttle, and live browser-object proxies, and first-class ASGI integration via middleware or standalone ASGI apps. It also supports PyScript/Pyodide for running components entirely in the browser and importing actual ReactJS/NPM components from Python. The architecture is a hybrid library/framework: a Python core package (src/reactpy) handles component lifecycle, layout rendering, event dispatch, and state management, while a separate JavaScript client package (src/js/packages/@reactpy/client) handles DOM rendering and WebSocket communication. A notable design feature is the live event proxy, which avoids serializing entire browser event objects to the server; instead, the client holds event objects and lets Python code lazily read properties or invoke methods over a batched, security-blocklisted protocol. The project is well-tested with unit tests, Playwright-based integration tests, and CI across multiple Python versions and operating systems. It is not a data pipeline or research codebase; data-related content appears only as demo examples. The repository also contains substantial documentation, example galleries, build tooling for both Python and JavaScript, and testing fixtures that are useful for any project needing browser-backed backend testing. Some legacy APIs (e.g., reactpy.web) coexist with newer reactjs-based APIs, and the documentation has areas marked under construction, but the core code is actively maintained and demonstrates strong engineering practices.

RATING9.1/10
QUALITY8.4/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS29
VELOCITY0.69
OPEN ISSUES51
CLOSED ISSUES338
LAST COMMIT22 hours ago
fastjsonschema (pip) >=2.14.5
requests (pip) >=2
lxml (pip) >=4
anyio (pip) >=3
pytest-sugar (pip)
pytest-asyncio (pip)
pytest-timeout (pip)
responses (pip)
exceptiongroup (pip)
jsonpointer (pip)
starlette (pip)
poetry (pip)
Files by Type (count)
Python
184
reStructuredText
42
JavaScript
28
JSON
13
TypeScript
12
Other (.svg)
9
YAML
8
Markdown
8
Other (.png)
8
CSS
7
HTML
5
Other (no ext)
4
Files by Type (size)
Other (.gif)
1MB
Other (.png)
1023KB
Python
898KB
Lock File
233KB
reStructuredText
151KB
Other (.svg)
125KB
Other (.lockb)
104KB
TypeScript
90KB
Markdown
57KB
TSX
33KB
JSON
28KB
JavaScript
16KB

The LLM identified 5 files worth highlighting for reuse:

Implements a lazy, live proxy for browser-side JavaScript objects. Python event handlers can read attributes and call methods on DOM event objects without sending the event's full data to the server. The component manages a registry of active proxies, batches requests, enforces timeouts, and handles eviction/cleanup. This is a novel, self-contained protocol pattern that could be adapted to other client-server reactive systems.

file: src/reactpy/_event_proxy.py ↗ | tags: #event-proxy #async-rpc #request-response #browser-interop

Core VDOM data model and validation layer. It defines the structure of UI trees (tagName, attributes, children, eventHandlers), flattens children, separates event handlers from attributes, warns on key-integrity issues, and validates against a hand-maintained JSON schema. This is a well-crafted example of a serializable, validated UI representation that is independent enough to be reused or studied for other declarative UI systems.

file: src/reactpy/core/vdom.py ↗ | tags: #virtual-dom #schema-validation #serialization #reactive-ui

Provides DisplayFixture, a Playwright-backed test harness that launches a real browser, connects it to the component backend, and exposes polling and assertion helpers for interactive UI behavior. This is a genuinely reusable pattern for end-to-end testing of any server-rendered reactive UI, not just ReactPy, and it demonstrates advanced async-test tooling.

file: src/reactpy/testing/display.py ↗ | tags: #playwright #test-automation #fixtures #browser-testing

Implements ReactPyMiddleware, a composable ASGI middleware that routes HTTP, WebSocket, and static-file requests and dispatches component mount points by dotted path. It also supports custom lifespan/custom routes and can wrap arbitrary ASGI applications. This is a clean, reusable pattern for embedding component-rendering servers inside larger ASGI apps.

file: src/reactpy/executors/asgi/middleware.py ↗ | tags: #asgi #middleware #websocket #embedding

Client-side counterpart to the Python event proxy. It maintains live JavaScript event objects, serves on-demand property reads and method calls, batches responses, and enforces a security blocklist to prevent DOM escape via window/document/prototype access. This is a sophisticated, reusable pattern for safely exposing browser object graphs to remote (server-side) code over a websocket.

file: src/js/packages/@reactpy/client/src/event-proxy.ts ↗ | tags: #event-proxy #batching #security #browser-interop
Last analyzed: 2026-10-16 23:40:22.402844
Next check: 2026-10-23 23:40:22.394503
$ submit: