All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Added support for Python 3.12, 3.13, and 3.14.
- Added type hints to
reactpy.htmlattributes. - Added support for nested components in web modules
- Added support for inline JavaScript as event handlers or other attributes that expect a callable via
reactpy.types.InlineJavaScript - Event functions can now call
event.preventDefault()andevent.stopPropagation()methods directly on the event data object, rather than using the@eventdecorator. - Event data now supports accessing properties via dot notation (ex.
event.target.value). - Added support for partial functions in EventHandler
- Added
reactpy.types.Eventto provide type hints for the standarddatafunction argument (for exampledef on_click(event: Event): ...). - Added
asgiandjinjainstallation extras (for examplepip install reactpy[asgi, jinja]). - Added
reactpy.executors.asgi.ReactPythat can be used to run ReactPy in standalone mode via ASGI. - Added
reactpy.executors.asgi.ReactPyCsrthat can be used to run ReactPy in standalone mode via ASGI, but rendered entirely client-sided. - Added
reactpy.executors.asgi.ReactPyMiddlewarethat can be used to utilize ReactPy within any ASGI compatible framework. - Added
reactpy.templatetags.ReactPyJinjathat can be used alongsideReactPyMiddlewareto embed several ReactPy components into your existing application. This includes the following template tags:{% component %},{% pyscript_component %}, and{% pyscript_setup %}. - Added
reactpy.pyscript_componentthat can be used to embed ReactPy components into your existing application. - Added
reactpy.use_async_effecthook. - Added
reactpy.Vdomprimitive interface for creating VDOM dictionaries. - Added
reactpy.reactjs.component_from_fileto import ReactJS components from a file. - Added
reactpy.reactjs.component_from_urlto import ReactJS components from a URL. - Added
reactpy.reactjs.component_from_stringto import ReactJS components from a string. - Added
reactpy.reactjs.component_from_npmto import ReactJS components from NPM. - Added
reactpy.has a shorthand alias forreactpy.html.
- The
keyattribute is now stored withinattributesin the VDOM spec. - Substitute client-side usage of
reactwithpreact. - Script elements no longer support behaving like effects. They now strictly behave like plain HTML scripts.
- The
reactpy.htmlmodule has been modified to allow for auto-creation of any HTML nodes. For example, you can create a<data-table>element by callinghtml.data_table(). - Change
set_statecomparison method to check equality with==more consistently. - Add support for rendering
@componentchildren withinvdom_to_html. - Renamed the
use_locationhook'ssearchattribute toquery_string. - Renamed the
use_locationhook'spathnameattribute topath. - Renamed
reactpy.config.REACTPY_DEBUG_MODEtoreactpy.config.REACTPY_DEBUG. - ReactPy no longer auto-converts
snake_caseprops tocamelCase. It is now the responsibility of the user to ensure that props are in the correct format. - Rewrite the
event-to-objectpackage to be more robust at handling properties on events. - Custom JS components will now automatically assume you are using ReactJS in the absence of a
bindfunction. - Refactor layout rendering logic to improve readability and maintainability.
- The JavaScript package
@reactpy/clientnow exportsReactandReactDOM, which allows third-party components to re-use the same React instance as ReactPy. reactpy.htmlwill now automatically flatten lists recursively (ex.reactpy.html(["child1", ["child2"]]))reactpy.utils.reactpy_to_stringwill now retain the user's original casing fordata-*andaria-*attributes.reactpy.utils.string_to_reactpyhas been upgraded to handle more complex scenarios without causing ReactJS rendering errors.reactpy.core.vdom._CustomVdomDictConstructorhas been moved toreactpy.types.CustomVdomConstructor.reactpy.core.vdom._EllipsisReprhas been moved toreactpy.types.EllipsisRepr.reactpy.types.VdomDictConstructorhas been renamed toreactpy.types.VdomConstructor.REACTPY_ASYNC_RENDERINGcan now de-duplicate and cascade renders where necessary.REACTPY_ASYNC_RENDERINGis now defaulted toTruefor up to 40x performance improvements in environments with high concurrency.
reactpy.web.module_from_fileis deprecated. Usereactpy.reactjs.component_from_fileinstead.reactpy.web.module_from_urlis deprecated. Usereactpy.reactjs.component_from_urlinstead.reactpy.web.module_from_stringis deprecated. Usereactpy.reactjs.component_from_stringinstead.reactpy.web.exportis deprecated. Usereactpy.reactjs.component_from_*instead.reactpy.web.*is deprecated. Usereactpy.reactjs.*instead.
- Removed support for Python 3.9 and 3.10.
- Removed the ability to import
reactpy.html.*elements directly. You must now callhtml.*to access the elements. - Removed backend specific installation extras (such as
pip install reactpy[starlette]). - Removed support for async functions within
reactpy.use_effecthook. Usereactpy.use_async_effectinstead. - Removed deprecated function
module_from_template. - Removed deprecated exception type
reactpy.core.serve.Stop. - Removed deprecated component
reactpy.widgets.hotswap. - Removed
reactpy.samplemodule. - Removed
reactpy.svgmodule. Contents previously withinreactpy.svg.*can now be accessed viareactpy.html.svg.*. - Removed
reactpy.html._function. Usereactpy.html(...)orreactpy.html.fragment(...)instead. - Removed
reactpy.run. See the documentation for the new method to run ReactPy applications. - Removed
reactpy.backend.*. See the documentation for the new method to run ReactPy applications. - Removed
reactpy.core.typesmodule. Usereactpy.typesinstead. - Removed
reactpy.utils.html_to_vdom. Usereactpy.utils.string_to_reactpyinstead. - Removed
reactpy.utils.vdom_to_html. Usereactpy.utils.reactpy_to_stringinstead. - Removed
reactpy.vdom. Usereactpy.Vdominstead. - Removed
reactpy.core.make_vdom_constructor. Usereactpy.Vdominstead. - Removed
reactpy.core.custom_vdom_constructor. Usereactpy.Vdominstead. - Removed
reactpy.Layouttop-level re-export. Usereactpy.core.layout.Layoutinstead. - Removed
reactpy.types.LayoutType. Usereactpy.types.BaseLayoutinstead. - Removed
reactpy.types.ContextProviderType. Usereactpy.types.ContextProviderinstead. - Removed
reactpy.core.hooks._ContextProvider. Usereactpy.types.ContextProviderinstead. - Removed
reactpy.web.utils. Usereactpy.reactjs.utilsinstead.
- Fixed a bug where script elements would not render to the DOM as plain text.
- Fixed a bug where the
keyproperty provided within server-side ReactPy code was failing to propagate to the front-end JavaScript components. - Fixed a bug where
RuntimeError("Hook stack is in an invalid state")errors could be generated when using a webserver that reuses threads. - Allow for ReactPy and ReactJS components to be arbitrarily inserted onto the page with any possible hierarchy.
1.1.0 - 2024-11-24
- Fixed broken
module_from_templatedue to a recent release ofrequests. - Fixed
module_from_templatenot working when using Flask backend. - Fixed
UnicodeDecodeErrorwhen usingreactpy.web.export. - Fixed needless unmounting of JavaScript components during each ReactPy render.
- Fixed missing
event["target"]["checked"]on checkbox inputs. - Fixed missing static files on
sdistPython distribution.
- Allow concurrently rendering discrete component trees - enable this experimental feature by setting
REACTPY_ASYNC_RENDERING=true. This improves the overall responsiveness of your app in situations where larger renders would otherwise block smaller renders from executing.
- Previously
None, when present in an HTML element, would render as the string"None". NowNonewill not render at all. This is now equivalent to howNoneis handled when returned from components. - Move hooks from
reactpy.backend.hooksintoreactpy.core.hooks.
- The
Stopexception. Recent releases ofanyiohave made this exception difficult to use since it now raises anExceptionGroup. This exception was primarily used for internal testing purposes and so is now deprecated. - Deprecate
reactpy.backend.hookssince the hooks have been moved intoreactpy.core.hooks.
1.0.2 - 2023-07-03
- Fix rendering bug when children change positions.
1.0.1 - 2023-06-16
- Warn and attempt to fix missing mime types, which can result in
reactpy.runnot working as expected. - Rename
reactpy.backend.BackendImplementationtoreactpy.backend.BackendType. - Allow
reactpy.runto fail in more predictable ways.
- Better traceback for JSON serialization errors.
- Explain that JS component attributes must be JSON.
- Fix
reactpy.runport assignment sometimes attaching to in-use ports on Windows. - Fix
reactpy.runnot recognizingfastapi.
1.0.0 - 2023-03-14
- Reverts PR 841 as per the conclusion in discussion 916, but preserves the ability to declare attributes with snake_case.
- Reverts PR 886 due to issue 896.
- Revamped element constructor interface. Now instead of passing a dictionary of attributes to element constructors, attributes are declared using keyword arguments. For example, instead of writing:
- Declaration of keys via keyword arguments in standard elements. A script has been added to automatically convert old usages where possible.
- Accidental import of reactpy.testing.
- Minor issues with camelCase rewrite CLI utility.
- Minor type hint issue with
VdomDictConstructor. - Stale event handlers after disconnect/reconnect cycle.
- Fixed CLI not registered as entry point.
- Unification of component and VDOM constructor interfaces.