Skip to content

Releases: reactive-python/reactpy

reactpy v2.0.0b6

12 Dec 05:10
56c05e5

Choose a tag to compare

reactpy v2.0.0b6 Pre-release
Pre-release

All changes from v2.0.0b5 with a few additions:

  • Fix HOOK_STACK errors
  • Remove key attribute from VDOM spec (Fix #1284)
  • Add reactpy.html(...) shorthand notation for HTML fragments.
  • Add reactpy.h shorthand alias for reactpy.html.
  • Add reactpy.reactjs.component_from_npm
  • Deprecate reactpy.web.*
  • Move component_from_* functions into reactpy.reactjs.*
  • Allow for all ReactPy and ReactJS components to be arbitrarily inserted into each other (Fix #1262)

reactpy v2.0.0b5

10 Dec 22:30
87ec4a7

Choose a tag to compare

reactpy v2.0.0b5 Pre-release
Pre-release

All changes from v2.0.0b4 with a few additions:

  • Bump minimum Python version to 3.11
  • Support Python 3.14
  • Better error message if ASGI dependencies are missing
  • Removed reactpy.types.ContextProviderType top-level export. Use reactpy.types.ContextProvider instead.
  • Removed reactpy.types.LayoutType top-level export. Use reactpy.types.BaseLayout instead.
  • No longer require a package name within reactjs_component_from_*
  • Remove pip dependency
  • Convert orjson into an ASGI only dependency
  • Fix @reactpy/client's dependency path for event-to-object
  • Fix #1001 (Create a better custom JS interface)
  • Fix #624 (Refactor layout rendering)
  • Fix #1198 (use_effect's unmount method is not always called with dynamically rendered children)
  • Fix #1201 (de-duplicate async renders)

event-to-object v1.0.1

09 Dec 07:47
78c8f1a

Choose a tag to compare

Add warning if user provided input was not a JSON serializable root object. These non-serializable values are now passed through as-is.

@reactpy/client v1.0.1

09 Dec 07:51
78c8f1a

Choose a tag to compare

  • Fix error when a user provided JavaScript component transmits event data that isn't JSON structured.
  • Re-export preact within top-level module to assist with version synchronization.

reactpy v2.0.0b4

09 Dec 07:54
78c8f1a

Choose a tag to compare

reactpy v2.0.0b4 Pre-release
Pre-release

All changes from v2.0.0b3 with a few additions:

  • Improve type hints on reactjs_component_from_*
  • Remove jsonpointer dependency
  • use_effect will now generate an exception if attempting to use an async function. Use use_async_effect instead
  • Remove deprecated Stop exception type
  • Remove deprecated hotswap function
  • Remove top-level export of reactpy.Layout. Use reactpy.core.layout.Layout instead.

event-to-object v1.0.0

08 Dec 03:06
c5e8437

Choose a tag to compare

Complete re-write to add more robust translation of events to plain JSON objects.

@reactpy/client v1.0.0

08 Dec 03:32
ea40d18

Choose a tag to compare

Complete re-write to support ReactPy v2.

reactpy v2.0.0b3

08 Dec 02:58
c5e8437

Choose a tag to compare

reactpy v2.0.0b3 Pre-release
Pre-release

Summary

Welcome to the beta release of ReactPy v2, which brings ReactPy Standalone Mode, and ReactPy ASGI Middleware!

You can give this version a try by typing pip install reactpy[asgi]==2.0.0b3.

Here is a quick demo of the new ReactPy Standalone mode:

# FILENAME: example.py
from reactpy import component, html
from reactpy.executors.asgi import ReactPy

@component
def ExampleComponent():
    return html.div("Hello World")

app = ReactPy(ExampleComponent)

# Now you can run `uvicorn example:app --reload` to start ReactPy!

Here is a quick demo of the new ReactPy Middleware mode (using Starlette for demonstration purposes):

# FILENAME: example.py
from starlette.applications import Starlette
from starlette.routing import Route
from starlette.templating import Jinja2Templates
from reactpy.executors.asgi import ReactPyMiddleware

# You will need to follow your framework's guidelines on installing Jinja extensions
# When our new Jinja extension is installed, the `{% component "example.path" %}` tag will be available in any Jinja template.
# The template tag currently accepts a single argument, which is the dotted path to the component.
# For example {% component "my_package.ExampleComponent" %}
templates = Jinja2Templates(
    directory="templates",
    extensions=["reactpy.templatetags.Jinja"],
)


async def homepage(request):
    return templates.TemplateResponse(request, "index.html")


app = ReactPyMiddleware(
    Starlette(routes=[Route("/", homepage)]),
    # Register components with ReactPy to allow them to be used as a root component in your templates
    root_components=["my_package.ExampleComponent"],
)

# Now you can run `uvicorn example:app --reload` to start ReactPy!

Changelog

Added

  • Added reactpy.executors.asgi.ReactPy that can be used to run ReactPy in standalone mode via ASGI.
  • Added reactpy.executors.asgi.ReactPyCsr that can be used to run ReactPy in standalone mode via ASGI, but rendered entirely client-sided.
  • Added reactpy.executors.asgi.ReactPyMiddleware that can be used to utilize ReactPy within any ASGI compatible framework.
  • Added reactpy.templatetags.ReactPyJinja that can be used alongside ReactPyMiddleware to embed several ReactPy components into your existing application. This includes the following template tags: {% component %}, {% pyscript_component %}, and {% pyscript_setup %}.
  • Added reactpy.pyscript_component that can be used to embed ReactPy components into your existing application.
  • Added asgi and jinja installation extras (for example pip install reactpy[asgi, jinja]).
  • Added support for Python 3.12 and 3.13.
  • Added reactpy.use_async_effect hook.
  • Added shutdown_timeout parameter to the reactpy.use_async_effect hook.
  • reactpy.html will now automatically flatten lists recursively (ex. reactpy.html(["child1", ["child2"]]))
  • Added reactpy.Vdom primitive interface for creating VDOM dictionaries.
  • Added type hints to reactpy.html attributes.
  • 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
  • Added reactpy.web.reactjs_component_from_file to import ReactJS components from a file.
  • Added reactpy.web.reactjs_component_from_url to import ReactJS components from a URL.
  • Added reactpy.web.reactjs_component_from_string to import ReactJS components from a string.
  • Event functions can now call event.preventDefault() and event.stopPropagation() methods directly on the event data object, rather than using the @event decorator.
  • Event data now supports accessing properties via dot notation (ex. event.target.value).

Changed

  • Substitute client-side usage of react with preact.
  • Script elements no longer support behaving like effects. They now strictly behave like plain HTML script elements.
  • The reactpy.html module has been modified to allow for auto-creation of any HTML nodes. For example, you can create a <data-table> element by calling html.data_table().
  • Change set_state comparison method to check equality with == more consistently.
  • Add support for rendering @component children within vdom_to_html.
  • Renamed the use_location hook's search attribute to query_string.
  • Renamed the use_location hook's pathname attribute to path.
  • Renamed reactpy.config.REACTPY_DEBUG_MODE to reactpy.config.REACTPY_DEBUG.
  • @reactpy/client now exports React and ReactDOM.
  • ReactPy no longer auto-converts snake_case props to camelCase. It is now the responsibility of the user to ensure that props are in the correct format.
  • reactpy.utils.reactpy_to_string will now retain the user's original casing for data-* and aria-* attributes.
  • reactpy.utils.string_to_reactpy has been upgraded to handle more complex scenarios without causing ReactJS rendering errors.
  • reactpy.core.vdom._CustomVdomDictConstructor has been moved to reactpy.types.CustomVdomConstructor.
  • reactpy.core.vdom._EllipsisRepr has been moved to reactpy.types.EllipsisRepr.
  • reactpy.types.VdomDictConstructor has been renamed to reactpy.types.VdomConstructor.
  • Rewrite the event-to-object package to be more robust at handling properties on events.

Deprecated

  • reactpy.web.export is deprecated. Use reactpy.web.reactjs_component_from_* instead.
  • reactpy.web.module_from_file is deprecated. Use reactpy.web.reactjs_component_from_file instead.
  • reactpy.web.module_from_url is deprecated. Use reactpy.web.reactjs_component_from_url instead.
  • reactpy.web.module_from_string is deprecated. Use reactpy.web.reactjs_component_from_string instead.

Removed

  • Removed the ability to import reactpy.html.* elements directly. You must now call html.* to access the elements.
  • Removed reactpy.sample module.
  • Removed reactpy.svg module. Contents previously within reactpy.svg.* can now be accessed via html.svg.*.
  • Removed reactpy.html._ function. Use 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.types module. Use reactpy.types instead.
  • Removed reactpy.utils.html_to_vdom. Use reactpy.utils.string_to_reactpy instead.
  • Removed reactpy.utils.vdom_to_html. Use reactpy.utils.reactpy_to_string instead.
  • Removed backend specific installation extras (such as pip install reactpy[starlette]).
  • Removed deprecated function module_from_template.
  • Removed support for Python 3.9.
  • Removed support for async functions within reactpy.use_effect hook. Use reactpy.use_async_effect instead.
  • Removed reactpy.vdom. Use reactpy.Vdom instead.
  • Removed reactpy.core.make_vdom_constructor. Use reactpy.Vdom instead.
  • Removed reactpy.core.custom_vdom_constructor. Use reactpy.Vdom instead.

Fixed

  • Fixed a bug where script elements would not render to the DOM as plain text.
  • Fixed a bug where the key property 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.

reactpy v2.0.0b2

31 May 23:48

Choose a tag to compare

reactpy v2.0.0b2 Pre-release
Pre-release

Summary

Welcome to the first public beta release of ReactPy v2, which brings ReactPy Standalone Mode, and ReactPy ASGI Middleware! That's right, ReactPy is now fully compatible with all ASGI frameworks!

You can give this version a try by typing pip install reactpy[asgi]==2.0.0b2.

Here is a quick demo of the new ReactPy Standalone mode:

# FILENAME: example.py
from reactpy import component, html
from reactpy import ReactPy

@component
def ExampleComponent():
    return html.div("Hello World")

app = ReactPy(ExampleComponent)
# Now you can run `uvicorn example:app --reload` to start ReactPy!

Here is a quick demo of the new ReactPy Middleware mode (using Starlette for demonstration purposes):

# FILENAME: example.py
from starlette.applications import Starlette
from starlette.routing import Route
from starlette.templating import Jinja2Templates
from reactpy import ReactPyMiddleware

# You will need to follow your framework's guidelines on installing Jinja extensions
# When our new Jinja extension is installed, the `{% component "example.path" %}` tag will be available in any Jinja template.
# The template tag currently accepts a single argument, which is the dotted path to the component.
# For example {% component "my_package.ExampleComponent" %}
templates = Jinja2Templates(
    directory="templates",
    extensions=["reactpy.jinja.ReactPyTemplateTag"],
)

async def homepage(request):
    return templates.TemplateResponse(request, "index.html")

app = ReactPyMiddleware(
    Starlette(routes=[Route("/", homepage)]),
    # Register components with ReactPy to allow them to be used as a root component in your templates
    root_components=["my_package.ExampleComponent"],
)
# Now you can run `uvicorn example:app --reload` to start ReactPy!

Changelog

Added

  • Added reactpy.executors.asgi.ReactPy that can be used to run ReactPy in standalone mode via ASGI.
  • Added reactpy.executors.asgi.ReactPyPyodide that can be used to run ReactPy in standalone mode via ASGI, but rendered entirely client-sided.
  • Added reactpy.executors.asgi.ReactPyMiddleware that can be used to utilize ReactPy within any ASGI compatible framework.
  • Added reactpy.templatetags.Jinja that can be used alongside ReactPyMiddleware to embed several ReactPy components into your existing application. This includes the following template tags: {% component %}, {% pyscript_component %}, and {% pyscript_setup %}.
  • Added reactpy.pyscript_component that can be used to embed ReactPy components into your existing application.
  • Added uvicorn and jinja installation extras (for example pip install reactpy[jinja]).
  • Added support for Python 3.12 and 3.13.
  • Added reactpy.use_async_effect hook.
  • Added shutdown_timeout parameter to the reactpy.use_async_effect hook.
  • reactpy.html will now automatically flatten lists recursively (ex. reactpy.html(["child1", ["child2"]]))
  • Added reactpy.Vdom primitive interface for creating VDOM dictionaries.
  • Added type hints to reactpy.html attributes.
  • 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

Changed

  • Substitute client-side usage of react with preact.
  • Script elements no longer support behaving like effects. They now strictly behave like plain HTML script elements.
  • The reactpy.html module has been modified to allow for auto-creation of any HTML nodes. For example, you can create a <data-table> element by calling html.data_table().
  • Change set_state comparison method to check equality with == more consistently.
  • Add support for rendering @component children within vdom_to_html.
  • Renamed the use_location hook's search attribute to query_string.
  • Renamed the use_location hook's pathname attribute to path.
  • Renamed reactpy.config.REACTPY_DEBUG_MODE to reactpy.config.REACTPY_DEBUG.
  • @reactpy/client now exports React and ReactDOM.
  • ReactPy no longer auto-converts snake_case props to camelCase. It is now the responsibility of the user to ensure that props are in the correct format.
  • reactpy.utils.reactpy_to_string will now retain the user's original casing for data-* and aria-* attributes.
  • reactpy.utils.string_to_reactpy has been upgraded to handle more complex scenarios without causing ReactJS rendering errors.
  • reactpy.core.vdom._CustomVdomDictConstructor has been moved to reactpy.types.CustomVdomConstructor.
  • reactpy.core.vdom._EllipsisRepr has been moved to reactpy.types.EllipsisRepr.
  • reactpy.types.VdomDictConstructor has been renamed to reactpy.types.VdomConstructor.

Removed

  • Removed the ability to import reactpy.html.* elements directly. You must now call html.* to access the elements.
  • Removed reactpy.sample module.
  • Removed reactpy.svg module. Contents previously within reactpy.svg.* can now be accessed via html.svg.*.
  • Removed reactpy.html._ function. Use 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.types module. Use reactpy.types instead.
  • Removed reactpy.utils.html_to_vdom. Use reactpy.utils.string_to_reactpy instead.
  • Removed reactpy.utils.vdom_to_html. Use reactpy.utils.reactpy_to_string instead.
  • All backend related installation extras (such as pip install reactpy[starlette]) have been removed.
  • Removed deprecated function module_from_template.
  • Removed support for Python 3.9.
  • Removed support for async functions within reactpy.use_effect hook. Use reactpy.use_async_effect instead.
  • Removed reactpy.vdom. Use reactpy.Vdom instead.
  • Removed reactpy.core.make_vdom_constructor. Use reactpy.Vdom instead.
  • Removed reactpy.core.custom_vdom_constructor. Use reactpy.Vdom instead.

Fixed

  • Fixed a bug where script elements would not render to the DOM as plain text.
  • Fixed a bug where the key property provided via server-side ReactPy code was failing to propagate to the front-end JavaScript component.
  • Fixed a bug where RuntimeError("Hook stack is in an invalid state") errors would be provided when using a webserver that reuses threads.

reactpy v1.1.0

24 Nov 10:44
7a6c31e

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: reactpy-v1.0.2...reactpy-v1.1.0