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. - Added
reactpy.config.REACTPY_MAX_QUEUE_SIZEto configure the maximum size of all ReactPy asyncio queues (e.g. receive buffer, send buffer, event buffer) before ReactPy begins waiting until a slot frees up. This can be used to constraint memory usage. - Events now support
debounceandthrottle, configurable per event viaevent.debounce = <milliseconds>andEventHandler(fn, throttle=<milliseconds>)respectively.debouncewaits until activity stops, then fires once. Default is 200 ms oninput/select/textarea, 0 ms elsewhere.throttlecaps the rate how often an event is allowed to execute. No default; opt in per event.
- 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 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.str_to_bool. - 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. - Fixed a bug where events on controlled inputs (e.g.
html.input({"onChange": ...})) could be lost during rapid actions. - 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.
0.44.0 - 2023-01-27
reactpy.widgets.hotswap. The function has no clear uses outside of some internal applications.
- Ability to access element value from events via
event['value']key. Useevent['target']['value']instead. - Old misspelled option
REACTPY_WED_MODULES_DIR.
0.43.0 - 2023-01-09
ComponentType.(). This method was implemented based on reading the React/Preact source code.
- Nested context does not update value if outer context should not render.
- Detached model state on render of context consumer if unmounted and context value does not change.
0.42.0 - 2022-12-02
- Ability to customize the
<head>element of ReactPy's built-in client. vdom_to_htmlutility function.- Ability to subscribe to changes that are made to mutable options.
del_html_head_body_transformto remove<html>,<head>, and<body>while preserving children.- Support for form element serialization
REACTPY_DEBUG_MODEis now mutable and can be changed at runtime.- Fix
html_to_vdomimproperly removing<html>,<head>, and<body>nodes.
- Removed
reactpy.html.bodyas it is currently unusable due to technological limitations. - Removed
REACTPY_FEATURE_INDEX_AS_DEFAULT_KEYoption. - Removed
serve_static_filesoption from backend configuration.
module_from_template.
0.41.0 - 2022-11-01
- The hooks
use_locationanduse_scopeare no longer implementation specific and are now available as top-level imports. - Backend implementations now strip any URL prefix in the pathname for
use_location. use_statenow returns a named tuple withvalueandset_valuefields.
- New
use_connectionhook which returns aConnectionobject containinglocation,scope, andcarrier.
0.40.2 - 2022-09-13
- Avoid the use of JSON patch for diffing models.
0.40.1 - 2022-09-11
- Child models after a component fail to render.
0.40.0 - 2022-08-13
- Fix edge cases where
html_to_vdomcan fail to convert HTML. - Conditionally rendered components cannot use contexts.
- Use strict equality check for text, numeric, and binary types in hooks.
- Accidental mutation of old model causes invalid JSON Patch.
- Set default timeout on Playwright page for testing.
- Track contexts in hooks as state.
- Remove non-standard
nameargument fromcreate_context.
asgirefas a dependency.lxmlas a dependency.
0.39.0 - 2022-06-20
No module named 'reactpy.server'fromreactpy.run.- Setting appropriate MIME type for web modules in
sanicserver implementation.
- Renamed various:
reactpy.testing.servertoreactpy.testing.backend,ServerFixturetoBackendFixture,DisplayFixture.servertoDisplayFixture.backend. - Removed
exports_defaultparameter frommodule_from_template.
- Ability to specify versions with module templates (e.g.
module_from_template("react@^17.0.0", ...)).
0.38.1 - 2022-04-15
- Missing file extension was causing a problem with WebPack.
0.38.0 - 2022-04-15
No changes.
0.37.2 - 2022-03-27
- Renamed
protomodules totypesand added a top-levelreactpy.typesmodule.
- Fixed a typo that caused ReactPy to use the insecure
wsweb-socket protocol on pages loaded withhttpsinstead of the securewssprotocol.
0.37.1 - 2022-03-05
No changes.
0.37.0 - 2022-02-27
- Support for keys in HTML fragments.
- Use Context Hook.
- React warning about set state in unmounted component.
- Missing reset of schedule_render_later flag.
0.36.3 - 2022-02-18
- All child states wiped upon any child key change.
- Allow NoneType returns within components.
0.36.2 - 2022-02-02
- Hot fix for newly introduced
DeprecatedOption.
0.36.1 - 2022-02-02
- Fix Key Error when Cleaning Up Event Handlers.
- Update Script Tag Behavior.
- Renamed configuration option
REACTPY_WED_MODULES_DIRtoREACTPY_WEB_MODULES_DIR.
0.36.0 - 2022-01-30
- New
http.scriptelement which can behave similarly to a standard HTML<script>or, if no attributes are given, operate similarly to an effect.
- State mismatch during component update.
- Implement a script tag.
0.35.4 - 2022-01-27
- Keys for elements at the root of a component were not being tracked. Thus key changes for elements at the root did not trigger unmounts.
0.35.3 - 2022-01-27
- Elements which changed type are now always deeply unmounted.
0.35.2 - 2022-01-26
- Allow children with the same key to vary in type.
- Client always looks for server at "/".
- Web modules get double file extensions with v0.35.x.
0.35.1 - 2022-01-18
- Re-add accidentally deleted
py.typedfile to distribution.
0.35.0 - 2022-01-18
- Default key for all elements and components is now their index amongst their siblings.
use_linked_inputswidget.- Starlette server implementation.
REACTPY_FEATURE_INDEX_AS_DEFAULT_KEYnow defaults to1.
- Support Starlette Server.
- Fix unhandled case in module_from_template.
- Hide "Children" within REACTPY_DEBUG_MODE key warnings.
- Bug in Element Key Identity.
- Add iFrame to reactpy.html.
- React warning from module_from_template.
0.34.0 - 2021-12-16
- Element value must now be accessed via
event['target']['value']instead ofevent['value']. - Added
event["currentTarget"]andevent["relatedTarget"]keys to the event dictionary.
- Move target attributes to
event['target'].
0.33.3 - 2021-10-08
- Warning stating that
REACTPY_FEATURE_INDEX_AS_DEFAULT_KEY=1will become the default in a future release. - Ability to use the default export from a JavaScript module when calling
module_from_templateby specifyingexports_default=True.
- Memory leak in SharedClientStateServer.
- Cannot use default export in react template.
0.33.2 - 2021-09-05
- Memory leak caused by event handlers that were not being removed when components updated.
0.33.1 - 2021-09-02
- Regression where the root element of the layout could not be updated.
0.33.0 - 2021-09-02
- Client-side error in mount-01d35dc3.js.
- Style cannot be updated.
- Displaying error messages in the client via
__error__tag can leak secrets. - Examples broken in docs.
- Modified the Custom JavaScript Component interface to add a
create()function to thebind()interface.
0.32.0 - 2021-08-20
- Custom component interface now expects a single
bind()function that returns an object withrender()andunmount()functions.
- Docs broken on Firefox.
- URL resolution for web modules does not consider urls starting with /.
- Query params in package name for module_from_template not stripped.
- Search broken in docs.
- Move src/reactpy/client out of Python package.
0.31.0 - 2021-07-14
Layoutis now a prototype andLayout.updateis no longer a public API.- Refactored the relationship between
LifeCycleHookandLayout. ComponentTypesno longer needs a uniqueidattribute.
0.30.1 - 2021-07-13
- Warning if key is parameter of component render function.
0.30.0 - 2021-06-28
- Removed all runtime reliance on NPM.
reactpy.clientis removed in favor of a stripped downreactpy.webmodule.REACTPY_CLIENT_BUILD_DIRconfig option is replaced withREACTPY_WEB_MODULES_DIR.
0.29.0 - 2021-06-20
- Moved the runtime client build directory to a "user data" directory.
- Custom JS component interface has been reworked.
0.28.0 - 2021-06-01
- Support for
currentTimeattribute of audio/video elements. - Support for the
filesattribute from the target of input elements. - Model children are now passed to the JavaScript
mount()function. mountLayoutWithWebSocketfunction to@reactpy/client.
- Refactored existing server implementations as functions adhering to a protocol.
- Switched to a monorepo-style structure for JavaScript.
- Use a
loadImportSource()function instead of trying to infer the path to dynamic modules.
0.27.0 - 2021-05-14
mount(element, component, props)function which can be used to bind new elements to the DOM.
0.26.0 - 2021-05-07
- Fix for situations where a
Layoutcan raise an error when a component whose state has been deleted is rendered.
0.25.0 - 2021-04-30
- Refactored layout dispatcher by switching from a class-based approach to one that leverages pure functions.
0.24.0 - 2021-04-18
- Components and elements can now have "identity" - their state can be preserved across updates.
REACTPY_FEATURE_INDEX_AS_DEFAULT_KEYfeature flag.
0.23.1 - 2021-04-02
- Non-deterministic return order in install().
0.23.0 - 2021-04-01
- Changelog to docs.
- Automatically reconnect to server.
- Allow no reconnect in client.
- Cleaner way to specify import sources.
- FastAPI render server.
0.22.1 - 2021-01-02
- Fix missing find_available_port arg.
0.22.0 - 2020-12-24
- Fix doc build.
- Better server error capture in tests.
- Fix type annotations.
- Fix dark mode widget view.
- Use Nox to run tests.
- Add .nox to gitignore.
0.21.0 - 2020-12-16
- Tornado render server.
- Render server documentation.
- Renamed element to component.
0.20.1 - 2020-11-13
- Avoid sanic import.
0.20.0 - 2020-11-12
- Flask render server.
- Moved idom_client_react into separate repo.
- Removed mountLayoutWithWebSocket.
- Removed more client implementation docs.
- Fix missing server event.
0.19.0 - 2020-10-19
- No cover last server error.
- Refined test tooling.
- Added all to testing module.
0.18.1 - 2020-09-25
- Fix missing find_available_port arg.
0.18.0 - 2020-09-23
- Module components should be accessible as attrs.
- Fix doc import source URL.
- Minor JS fixes.
- Fix idom install.
- Better URL join logic in client.
- Strip down test tooling.
- Avoid issues with bundlers.
0.17.1 - 2020-08-14
- Fix idom install.
0.17.0 - 2020-08-08
- Import source base URL with vdom fallback.
- Fix types.
- Fix mypy testing.
- Bumped idom_client_react version.
- Use universal wheel.
0.16.0 - 2020-06-26
- Put setuptools_scm back in setup.py.
- Fix pyproject.toml.
- Remove framework classifier.
- Only check last error in display context.
- Refactor and cleanup tests.
- Add public test tooling.
0.15.0 - 2020-05-02
- More docs.
- pyproject.toml support.
- Fix coverage.
- Fix misc bugs.
- Fix mypy.
- Improve docs.
- Improve log messages.
- Rename config "item" to "entry".
- Upgrade snowpack to max possible.
- More tests for client management.
0.14.3 - 2020-04-10
- Fix JSON patch in-place (broke some components).
- Revert bad JSON patch usage.
0.14.2 - 2020-03-30
- Fix displayed version in docs.
0.14.1 - 2020-03-20
- Remove extra spaces in element children.
0.14.0 - 2020-03-20
- idom.run utility.
- Fix types.
- Fix doc examples.
- Simplify server constructor.
0.13.0 - 2020-02-15
- Well-defined client implementation layer.
- Fix types.
- Fix tests.
- Remove ability to install modules at runtime via idom.Module.
0.12.0 - 2020-01-27
- Utility methods for LayoutUpdate (start, stop).
- useStateRef hook.
- Move Jupyter out of base idom into idom-jupyter package.
0.11.3 - 2020-01-14
- Add utility method tests to LayoutUpdate.
0.11.2 - 2020-01-14
- Test dispatcher start and stop.
0.11.1 - 2019-12-20
- Bump JS to 0.4.2.
0.11.0 - 2019-12-18
- MountLayout utility function.
- Fix issues.
- Correct package.json for idom-client-react.
- Rename StateDispatcher to ViewDispatcher.
- Remove private=true from imports.
- Require anyio>=2.0.
- Rename static/ directory to app/.
0.10.4 - 2019-12-01
- Fix docs.
0.10.3 - 2019-12-01
- Publish package before docs.
0.10.2 - 2019-11-20
- Fix up tests.
- Material UI example.
- Concept of build cache.
0.10.1 - 2019-11-08
- Upgrade anyio (see agronholm/anyio#155).
0.10.0 - 2019-11-07
- Fallbacks to imported JS in examples.
- Fix doc updates.
- Better URL join logic.
- Removed async event handler.
- Renamed Renderer to Dispatcher.
- Removed AbstractElement.id.
0.9.2 - 2019-10-14
- Fix docs and improve doc example runner.
0.9.1 - 2019-10-10
- Add setuptools_scm as docs requirement.
0.9.0 - 2019-10-06
- Documentation for async effects.
- Fix effect cleanup timing.
- Test async effect.
- Fix layout test.
- Fix type annotations.
- Element render functions don't need to be async.
- Dropped Python 3.6 support.
0.7.0 - 2020-08-09
- use_reducer hook.
- use_effect tests.
- Tests for use_ref and use_callback.
- HookCatcher utility.
- Layout tests.
- Fix bug in use_memo.
- Fix types for render and layout.
- Fix flake8 ignore doc examples.
- Rename top level examples dir to notebooks.
- Remove unused test script.
- Effects run just before and after full render.
- Simplified rendering queue.
- Removed abstract layout (renamed to Layout.dispatch).
- Drag-drop example.
0.6.0 - 2020-06-20
- Various bug fixes from early development.
- Core infrastructure for component rendering.
0.5.1 - 2019-10-24
- Fix tests and event handlers.
0.5.0 - 2019-06-13
- use_effect hook.
- Initial idom-jupyter support.
- Basic client-side rendering.
- createContext support.
- useCallback and useMemo.
- Initial testing infrastructure.
- Fix various rendering and state management bugs.
- Legacy state management.
0.4.2 - 2019-03-20
- Revert "make vdom a simple dict".
0.4.1 - 2019-02-26
- Fix tests.
0.4.0 - 2019-02-02
- Core functionality for idom.
- Restructure around idom-core and idom-legacy.
0.3.0 - 2018-12-18
- Core functionality with hooks (useState, useEffect, etc.).
- Fix initial rendering issues.
0.2.0 - 2018-10-22
- Basic functionality.
- Initial bug fixes.
0.1.2 - 2018-08-03
- Fix import issues.
0.1.0 - 2018-07-30
- Initial release.