Skip to content

Merge develop into main #1295

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
May 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/.hatch-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Install Python Dependencies
run: pip install --upgrade pip hatch uv
run: pip install --upgrade hatch uv
- name: Run Scripts
env:
NPM_CONFIG_TOKEN: ${{ secrets.node-auth-token }}
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main
pull_request:
branches:
- main
- "*"
schedule:
- cron: "0 0 * * 0"

Expand All @@ -27,14 +27,20 @@ jobs:
job-name: "python-{0} {1}"
run-cmd: "hatch test"
runs-on: '["ubuntu-latest", "macos-latest", "windows-latest"]'
python-version: '["3.9", "3.10", "3.11"]'
python-version: '["3.10", "3.11", "3.12", "3.13"]'
test-documentation:
# Temporarily disabled while we transition from Sphinx to MkDocs
# https://github.com/reactive-python/reactpy/pull/1052
if: 0
uses: ./.github/workflows/.hatch-run.yml
with:
job-name: "python-{0}"
run-cmd: "hatch run docs:check"
python-version: '["3.11"]'
test-javascript:
# Temporarily disabled while we rewrite the "event_to_object" package
# https://github.com/reactive-python/reactpy/issues/1196
if: 0
uses: ./.github/workflows/.hatch-run.yml
with:
job-name: "{1}"
Expand Down
29 changes: 0 additions & 29 deletions .github/workflows/deploy-docs.yml

This file was deleted.

8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# --- Build Artifacts ---
src/reactpy/static/**/index.js*
src/reactpy/static/index.js*
src/reactpy/static/morphdom/
src/reactpy/static/pyscript/

# --- Jupyter ---
*.ipynb_checkpoints
Expand All @@ -15,8 +17,8 @@ src/reactpy/static/**/index.js*

# --- Python ---
.hatch
.venv
venv
.venv*
venv*
MANIFEST
build
dist
Expand Down
2 changes: 1 addition & 1 deletion docs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ RUN sphinx-build -v -W -b html source build
# Define Entrypoint
# -----------------
ENV PORT=5000
ENV REACTPY_DEBUG_MODE=1
ENV REACTPY_DEBUG=1
ENV REACTPY_CHECK_VDOM_SPEC=0
CMD ["python", "main.py"]
2 changes: 1 addition & 1 deletion docs/docs_app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from docs_app.examples import get_normalized_example_name, load_examples
from reactpy import component
from reactpy.backend.sanic import Options, configure, use_request
from reactpy.core.types import ComponentConstructor
from reactpy.types import ComponentConstructor

THIS_DIR = Path(__file__).parent
DOCS_DIR = THIS_DIR.parent
Expand Down
41 changes: 41 additions & 0 deletions docs/source/about/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,65 @@ Changelog
Unreleased
----------

**Added**

- :pull:`1113` - Added ``reactpy.executors.asgi.ReactPy`` that can be used to run ReactPy in standalone mode via ASGI.
- :pull:`1269` - Added ``reactpy.executors.asgi.ReactPyPyodide`` that can be used to run ReactPy in standalone mode via ASGI, but rendered entirely client-sided.
- :pull:`1113` - Added ``reactpy.executors.asgi.ReactPyMiddleware`` that can be used to utilize ReactPy within any ASGI compatible framework.
- :pull:`1269` - 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 %}``.
- :pull:`1269` - Added ``reactpy.pyscript_component`` that can be used to embed ReactPy components into your existing application.
- :pull:`1113` - Added ``uvicorn`` and ``jinja`` installation extras (for example ``pip install reactpy[jinja]``).
- :pull:`1113` - Added support for Python 3.12 and 3.13.
- :pull:`1264` - Added ``reactpy.use_async_effect`` hook.
- :pull:`1267` - Added ``shutdown_timeout`` parameter to the ``reactpy.use_async_effect`` hook.
- :pull:`1281` - ``reactpy.html`` will now automatically flatten lists recursively (ex. ``reactpy.html(["child1", ["child2"]])``)
- :pull:`1281` - Added ``reactpy.Vdom`` primitive interface for creating VDOM dictionaries.
- :pull:`1281` - Added type hints to ``reactpy.html`` attributes.
- :pull:`1285` - Added support for nested components in web modules
- :pull:`1289` - Added support for inline JavaScript as event handlers or other attributes that expect a callable via ``reactpy.types.InlineJavaScript``

**Changed**

- :pull:`1251` - Substitute client-side usage of ``react`` with ``preact``.
- :pull:`1239` - Script elements no longer support behaving like effects. They now strictly behave like plain HTML script elements.
- :pull:`1255` - 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()``.
- :pull:`1256` - Change ``set_state`` comparison method to check equality with ``==`` more consistently.
- :pull:`1257` - Add support for rendering ``@component`` children within ``vdom_to_html``.
- :pull:`1113` - Renamed the ``use_location`` hook's ``search`` attribute to ``query_string``.
- :pull:`1113` - Renamed the ``use_location`` hook's ``pathname`` attribute to ``path``.
- :pull:`1113` - Renamed ``reactpy.config.REACTPY_DEBUG_MODE`` to ``reactpy.config.REACTPY_DEBUG``.
- :pull:`1113` - ``@reactpy/client`` now exports ``React`` and ``ReactDOM``.
- :pull:`1263` - 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.
- :pull:`1278` - ``reactpy.utils.reactpy_to_string`` will now retain the user's original casing for ``data-*`` and ``aria-*`` attributes.
- :pull:`1278` - ``reactpy.utils.string_to_reactpy`` has been upgraded to handle more complex scenarios without causing ReactJS rendering errors.
- :pull:`1281` - ``reactpy.core.vdom._CustomVdomDictConstructor`` has been moved to ``reactpy.types.CustomVdomConstructor``.
- :pull:`1281` - ``reactpy.core.vdom._EllipsisRepr`` has been moved to ``reactpy.types.EllipsisRepr``.
- :pull:`1281` - ``reactpy.types.VdomDictConstructor`` has been renamed to ``reactpy.types.VdomConstructor``.

**Removed**

- :pull:`1255` - Removed the ability to import ``reactpy.html.*`` elements directly. You must now call ``html.*`` to access the elements.
- :pull:`1255` - Removed ``reactpy.sample`` module.
- :pull:`1255` - Removed ``reactpy.svg`` module. Contents previously within ``reactpy.svg.*`` can now be accessed via ``html.svg.*``.
- :pull:`1255` - Removed ``reactpy.html._`` function. Use ``html.fragment`` instead.
- :pull:`1113` - Removed ``reactpy.run``. See the documentation for the new method to run ReactPy applications.
- :pull:`1113` - Removed ``reactpy.backend.*``. See the documentation for the new method to run ReactPy applications.
- :pull:`1113` - Removed ``reactpy.core.types`` module. Use ``reactpy.types`` instead.
- :pull:`1278` - Removed ``reactpy.utils.html_to_vdom``. Use ``reactpy.utils.string_to_reactpy`` instead.
- :pull:`1278` - Removed ``reactpy.utils.vdom_to_html``. Use ``reactpy.utils.reactpy_to_string`` instead.
- :pull:`1113` - All backend related installation extras (such as ``pip install reactpy[starlette]``) have been removed.
- :pull:`1113` - Removed deprecated function ``module_from_template``.
- :pull:`1113` - Removed support for Python 3.9.
- :pull:`1264` - Removed support for async functions within ``reactpy.use_effect`` hook. Use ``reactpy.use_async_effect`` instead.
- :pull:`1281` - Removed ``reactpy.vdom``. Use ``reactpy.Vdom`` instead.
- :pull:`1281` - Removed ``reactpy.core.make_vdom_constructor``. Use ``reactpy.Vdom`` instead.
- :pull:`1281` - Removed ``reactpy.core.custom_vdom_constructor``. Use ``reactpy.Vdom`` instead.

**Fixed**

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

v1.1.0
------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ loaded with :func:`~reactpy.web.module.export`.

.. note::

When :data:`reactpy.config.REACTPY_DEBUG_MODE` is active, named exports will be validated.
When :data:`reactpy.config.REACTPY_DEBUG` is active, named exports will be validated.

The remaining files that we need to create are concerned with creating a Python package.
We won't cover all the details here, so refer to the Setuptools_ documentation for
Expand Down
8 changes: 4 additions & 4 deletions docs/source/guides/getting-started/running-reactpy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,29 +103,29 @@ Running ReactPy in Debug Mode
-----------------------------

ReactPy provides a debug mode that is turned off by default. This can be enabled when you
run your application by setting the ``REACTPY_DEBUG_MODE`` environment variable.
run your application by setting the ``REACTPY_DEBUG`` environment variable.

.. tab-set::

.. tab-item:: Unix Shell

.. code-block::

export REACTPY_DEBUG_MODE=1
export REACTPY_DEBUG=1
python my_reactpy_app.py

.. tab-item:: Command Prompt

.. code-block:: text

set REACTPY_DEBUG_MODE=1
set REACTPY_DEBUG=1
python my_reactpy_app.py

.. tab-item:: PowerShell

.. code-block:: powershell

$env:REACTPY_DEBUG_MODE = "1"
$env:REACTPY_DEBUG = "1"
python my_reactpy_app.py

.. danger::
Expand Down
2 changes: 1 addition & 1 deletion docs/source/reference/_examples/simple_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def RandomWalkGraph(mu, sigma):
interval = use_interval(0.5)
data, set_data = reactpy.hooks.use_state([{"x": 0, "y": 0}] * 50)

@reactpy.hooks.use_effect
@reactpy.hooks.use_async_effect
async def animate():
await interval
last_data_point = data[-1]
Expand Down
2 changes: 1 addition & 1 deletion docs/source/reference/_examples/snake_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def on_direction_change(event):

interval = use_interval(0.5)

@reactpy.hooks.use_effect
@reactpy.hooks.use_async_effect
async def animate():
if new_game_state is not None:
await asyncio.sleep(1)
Expand Down
Loading
Loading