Releases: reactive-python/reactpy
Releases · reactive-python/reactpy
reactpy v2.0.0b2
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.ReactPythat can be used to run ReactPy in standalone mode via ASGI. - Added
reactpy.executors.asgi.ReactPyPyodidethat 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.Jinjathat 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
uvicornandjinjainstallation extras (for examplepip install reactpy[jinja]). - Added support for Python 3.12 and 3.13.
- Added
reactpy.use_async_effecthook. - Added
shutdown_timeoutparameter to thereactpy.use_async_effecthook. reactpy.htmlwill now automatically flatten lists recursively (ex.reactpy.html(["child1", ["child2"]]))- Added
reactpy.Vdomprimitive interface for creating VDOM dictionaries. - 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
Changed
- Substitute client-side usage of
reactwithpreact. - Script elements no longer support behaving like effects. They now strictly behave like plain HTML script elements.
- 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/clientnow exportsReactandReactDOM.- 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. 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.
Removed
- Removed the ability to import
reactpy.html.*elements directly. You must now callhtml.*to access the elements. - Removed
reactpy.samplemodule. - Removed
reactpy.svgmodule. Contents previously withinreactpy.svg.*can now be accessed viahtml.svg.*. - Removed
reactpy.html._function. Usehtml.fragmentinstead. - 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. - 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_effecthook. Usereactpy.use_async_effectinstead. - Removed
reactpy.vdom. Usereactpy.Vdominstead. - Removed
reactpy.core.make_vdom_constructor. Usereactpy.Vdominstead. - Removed
reactpy.core.custom_vdom_constructor. Usereactpy.Vdominstead.
Fixed
- Fixed a bug where script elements would not render to the DOM as plain text.
- Fixed a bug where the
keyproperty 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
What's Changed
reactpy.runandconfigure(...)refactoring by @Archmonger in #1051- Fix flask backend mimetype for modules by @elro444 in #1131
- Concurrent Renders by @rmorshea in #1165
- Skip rendering None in all situations by @rmorshea in #1171
- Use
utf-8for reading files by @Archmonger in #1200 - Move
reactpy.backend.hooksmodule intoreactpy.core.hooksby @joshbmair in #1210 - Fixes needless custom component recreation (#1195) by @shawncrawley in #1224
- Added checked: element.checked to INPUT in elementConverters by @DennisHC in #1126
New Contributors
- @elro444 made their first contribution in #1131
- @joshbmair made their first contribution in #1210
- @shawncrawley made their first contribution in #1224
- @DennisHC made their first contribution in #1126
Full Changelog: reactpy-v1.0.2...reactpy-v1.1.0
@reactpy/client v0.3.2
Fixes needless JavaScript component recreation
reactpy v1.0.2
reactpy v1.0.1
What's Changed
- Fix Tornado Backend by @rmorshea in #971
- added warning for html.script by @ZEUS-03 in #970
- Use span instead of div by @rmorshea in #974
- fix js template links by @rmorshea in #979
- doc improvements by @rmorshea in #984
- docstrings for backend hooks by @rmorshea in #994
- Clean up readme by @Archmonger in #1000
- Poetry+Hatch Monorepo by @rmorshea in #1002
- fix poetry docs by @rmorshea in #1003
- Fix typos by @kianmeng in #1007
- Update README.md by @Iddorot in #1009
- Create CODEOWNERS by @rmorshea in #1011
- Emphasize that
pip install reactpydoes not include a backend by @rmorshea in #1012 - Remove HR from readme by @Archmonger in #1013
- fix noqas by @rmorshea in #1016
- Fix the Django project URL by @jensenbox in #1015
- avoid importing backend-specific dependencies by @rmorshea in #1006
- Fixed FileNotFound error while running hatch run lint-py by @cyborg7898 in #1023
- Unpin reactpy client version by @Archmonger in #1027
- Update index.rst by @Not-Sarthak in #1026
- docs: fix typo in distributing-javascript.rst by @eltociear in #1028
- Update parameter name in starlette.py by @mrjunos in #1031
- docs:fixed two typos inside Dangers of mutability by @danish-mehmood in #1038
- Fixed Error while running hatch run lint-js --fix by @cyborg7898 in #1030
- docs fixes by @rmorshea in #1039
- Better Error message if no backend installed #1042 by @geckguy in #1045
- Added pre-commit hook by @cyborg7898 in #1024
- Bump vite from 3.2.5 to 3.2.7 in /src/js/app by @dependabot in #1005
- report better error for attrs that cannot be serialized by @rmorshea in #1008
- Warn and fix missing mime types by @Archmonger in #1050
- Typos in Docs by @Daemo00 in #1061
- prep for 1.0.1 release by @rmorshea in #1062
- fix how we collect tags on current commit by @rmorshea in #1063
New Contributors
- @ZEUS-03 made their first contribution in #970
- @kianmeng made their first contribution in #1007
- @Iddorot made their first contribution in #1009
- @jensenbox made their first contribution in #1015
- @cyborg7898 made their first contribution in #1023
- @Not-Sarthak made their first contribution in #1026
- @eltociear made their first contribution in #1028
- @mrjunos made their first contribution in #1031
- @danish-mehmood made their first contribution in #1038
- @geckguy made their first contribution in #1045
- @Daemo00 made their first contribution in #1061
Full Changelog: https://github.com/reactive-python/reactpy/compare/@reactpy/client-v0.3.1...reactpy-v1.0.1
@reactpy/client v0.3.1
use abstract class (#968) * use abstract class * include source map in dist
@reactpy/client v0.3.0
@reactpy/client-v0.3.0 define a better client interface (#967)
event-to-object v0.1.1
fix event-to-object + fix npm release (#962) * fix event-to-object + fix npm release * fix sanic error
@reactpy/client v0.2.1 and event-to-object v0.1.2
fix JS dist artifacts (#963) * fix reactpy client dist * bump event to object too
event-to-object v0.1.0
rewrite the client in typescript (#951) * initial work to rewrite the client in typescript * minor fixes * fix js tests * misc fixes * rewrite event-to-object * rewrite event-to-object tests * finish tests * improve typescript configuration * show npm version * workspace order * minor fixes * rework docs extension + misc changes * build before check types * fix typos * move client under namespace dir * fix types in noxfile