Skip to content

Commit 031c2c0

Browse files
committed
fix missed idom replacement
1 parent 3943cdc commit 031c2c0

28 files changed

+105
-106
lines changed

docs/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ RUN sphinx-build -v -W -b html docs/source docs/build
4444
# Define Entrypoint
4545
# -----------------
4646
ENV PORT 5000
47-
ENV ReactPy_DEBUG_MODE=1
48-
ENV ReactPy_CHECK_VDOM_SPEC=0
47+
ENV REACTPY_DEBUG_MODE=1
48+
ENV REACTPY_CHECK_VDOM_SPEC=0
4949
CMD python scripts/run_docs.py

docs/app.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111

1212

1313
HERE = Path(__file__).parent
14-
ReactPy_MODEL_SERVER_URL_PREFIX = "/_reactpy"
14+
REACTPY_MODEL_SERVER_URL_PREFIX = "/_reactpy"
1515

1616
logger = getLogger(__name__)
1717

1818

19-
ReactPy_MODEL_SERVER_URL_PREFIX = "/_reactpy"
19+
REACTPY_MODEL_SERVER_URL_PREFIX = "/_reactpy"
2020

2121

2222
@component
@@ -52,7 +52,7 @@ async def forward_to_index(request):
5252
configure(
5353
app,
5454
Example,
55-
Options(url_prefix=ReactPy_MODEL_SERVER_URL_PREFIX),
55+
Options(url_prefix=REACTPY_MODEL_SERVER_URL_PREFIX),
5656
)
5757

5858
return app

docs/source/_exts/idom_view.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
from docs.examples import get_normalized_example_name
99

1010

11-
_ReactPy_EXAMPLE_HOST = os.environ.get("ReactPy_DOC_EXAMPLE_SERVER_HOST", "")
12-
_ReactPy_STATIC_HOST = os.environ.get("ReactPy_DOC_STATIC_SERVER_HOST", "/docs").rstrip(
11+
_REACTPY_EXAMPLE_HOST = os.environ.get("REACTPY_DOC_EXAMPLE_SERVER_HOST", "")
12+
_REACTPY_STATIC_HOST = os.environ.get("REACTPY_DOC_STATIC_SERVER_HOST", "/docs").rstrip(
1313
"/"
1414
)
1515

@@ -43,11 +43,11 @@ def run(self):
4343
style="margin-bottom: {self.options.get("margin", 0)}px;"
4444
/>
4545
<script type="module">
46-
import {{ mountWidgetExample }} from "{_ReactPy_STATIC_HOST}/_static/custom.js";
46+
import {{ mountWidgetExample }} from "{_REACTPY_STATIC_HOST}/_static/custom.js";
4747
mountWidgetExample(
4848
"{container_id}",
4949
"{view_id}",
50-
"{_ReactPy_EXAMPLE_HOST}",
50+
"{_REACTPY_EXAMPLE_HOST}",
5151
{"true" if "activate-button" in self.options else "false"},
5252
);
5353
</script>

docs/source/_exts/reactpy_view.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@
88
from docs.examples import get_normalized_example_name
99

1010

11-
_ReactPy_EXAMPLE_HOST = os.environ.get("ReactPy_DOC_EXAMPLE_SERVER_HOST", "")
12-
_ReactPy_STATIC_HOST = os.environ.get("ReactPy_DOC_STATIC_SERVER_HOST", "/docs").rstrip(
11+
_REACTPY_EXAMPLE_HOST = os.environ.get("REACTPY_DOC_EXAMPLE_SERVER_HOST", "")
12+
_REACTPY_STATIC_HOST = os.environ.get("REACTPY_DOC_STATIC_SERVER_HOST", "/docs").rstrip(
1313
"/"
1414
)
1515

1616

1717
class IteractiveWidget(SphinxDirective):
18-
1918
has_content = False
2019
required_arguments = 1
2120
_next_id = 0
@@ -44,11 +43,11 @@ def run(self):
4443
style="margin-bottom: {self.options.get("margin", 0)}px;"
4544
/>
4645
<script type="module">
47-
import {{ mountWidgetExample }} from "{_ReactPy_STATIC_HOST}/_static/custom.js";
46+
import {{ mountWidgetExample }} from "{_REACTPY_STATIC_HOST}/_static/custom.js";
4847
mountWidgetExample(
4948
"{container_id}",
5049
"{view_id}",
51-
"{_ReactPy_EXAMPLE_HOST}",
50+
"{_REACTPY_EXAMPLE_HOST}",
5251
{"true" if "activate-button" in self.options else "false"},
5352
);
5453
</script>

docs/source/about/changelog.rst

+17-17
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ v0.44.0
100100
- :pull:`886` - Ability to access element value from events via `event['value']` key.
101101
Instead element value should be accessed via `event['target']['value']`. Originally
102102
deprecated in :ref:`v0.34.0`.
103-
- :pull:`886` - old misspelled option ``reactpy.config.ReactPy_WED_MODULES_DIR``. Originally
103+
- :pull:`886` - old misspelled option ``reactpy.config.REACTPY_WED_MODULES_DIR``. Originally
104104
deprecated in :ref:`v0.36.1`.
105105

106106

@@ -136,13 +136,13 @@ v0.42.0
136136

137137
**Fixed**
138138

139-
- :issue:`582` - ``ReactPy_DEBUG_MODE`` is now mutable and can be changed at runtime
139+
- :issue:`582` - ``REACTPY_DEBUG_MODE`` is now mutable and can be changed at runtime
140140
- :pull:`832` - Fix ``html_to_vdom`` improperly removing ``<html>``, ``<head>``, and ``<body>`` nodes.
141141

142142
**Removed**
143143

144144
- :pull:`832` - Removed ``reactpy.html.body`` as it is currently unusable due to technological limitations, and thus not needed.
145-
- :pull:`840` - remove ``ReactPy_FEATURE_INDEX_AS_DEFAULT_KEY`` option
145+
- :pull:`840` - remove ``REACTPY_FEATURE_INDEX_AS_DEFAULT_KEY`` option
146146
- :pull:`835` - ``serve_static_files`` option from backend configuration
147147

148148
**Deprecated**
@@ -462,8 +462,8 @@ v0.36.1
462462
-------
463463
:octicon:`milestone` *released on 2022-02-02*
464464

465-
Includes bug fixes and renames the configuration option ``ReactPy_WED_MODULES_DIR`` to
466-
``ReactPy_WEB_MODULES_DIR`` with a corresponding deprecation warning.
465+
Includes bug fixes and renames the configuration option ``REACTPY_WED_MODULES_DIR`` to
466+
``REACTPY_WEB_MODULES_DIR`` with a corresponding deprecation warning.
467467

468468
**Closed Issues**
469469

@@ -473,7 +473,7 @@ Includes bug fixes and renames the configuration option ``ReactPy_WED_MODULES_DI
473473
**Merged Pull Requests**
474474

475475
- mark old state as None if unmounting - :pull:`641`
476-
- rename ReactPy_WED_MODULES_DIR to ReactPy_WEB_MODULES_DIR - :pull:`638`
476+
- rename REACTPY_WED_MODULES_DIR to REACTPY_WEB_MODULES_DIR - :pull:`638`
477477

478478

479479
v0.36.0
@@ -568,7 +568,7 @@ v0.35.0
568568

569569
The highlight of this release is that the default :ref:`"key" <Organizing Items With
570570
Keys>` of all elements will be their index amongst their neighbors. Previously this
571-
behavior could be engaged by setting ``ReactPy_FEATURE_INDEX_AS_DEFAULT_KEY=1`` when
571+
behavior could be engaged by setting ``REACTPY_FEATURE_INDEX_AS_DEFAULT_KEY=1`` when
572572
running ReactPy. In this release though, you will need to explicitly turn off this feature
573573
(i.e. ``=0``) to return to the old behavior. With this change, some may notice
574574
additional error logs which warn that:
@@ -585,7 +585,7 @@ on :ref:`Organizing Items With Keys`.
585585

586586
- Support Starlette Server - :issue:`588`
587587
- Fix unhandled case in module_from_template - :issue:`584`
588-
- Hide "Children" within ReactPy_DEBUG_MODE key warnings - :issue:`562`
588+
- Hide "Children" within REACTPY_DEBUG_MODE key warnings - :issue:`562`
589589
- Bug in Element Key Identity - :issue:`556`
590590
- Add iFrame to reactpy.html - :issue:`542`
591591
- Create a use_linked_inputs widget instead of Input - :issue:`475`
@@ -636,7 +636,7 @@ v0.33.3
636636
:octicon:`milestone` *released on 2021-10-08*
637637

638638
Contains a small number of bug fixes and improvements. The most significant change is
639-
the addition of a warning stating that `ReactPy_FEATURE_INDEX_AS_DEFAULT_KEY=1` will become
639+
the addition of a warning stating that `REACTPY_FEATURE_INDEX_AS_DEFAULT_KEY=1` will become
640640
the default in a future release. Beyond that, a lesser improvement makes it possible to
641641
use the default export from a Javascript module when calling `module_from_template` by
642642
specifying `exports_default=True` as a parameter. A
@@ -649,7 +649,7 @@ specifying `exports_default=True` as a parameter. A
649649

650650
**Pull Requests**
651651

652-
- warn that ReactPy_FEATURE_INDEX_AS_DEFAULT_KEY=1 will be the default - :pull:`515`
652+
- warn that REACTPY_FEATURE_INDEX_AS_DEFAULT_KEY=1 will be the default - :pull:`515`
653653
- clean up patch queues after exit - :pull:`514`
654654
- Remove Reconnecting WS alert - :pull:`513`
655655
- Fix 502 - :pull:`503`
@@ -831,22 +831,22 @@ runtime reliance on NPM. Doing so has many virtuous knock-on effects:
831831
code.
832832
4. Alternate client implementations benefit from this simplicity. Now, it's possible to
833833
install @reactpy/client normally and write a ``loadImportSource()`` function that
834-
looks for route serving the contents of `ReactPy_WEB_MODULES_DIR.`
834+
looks for route serving the contents of `REACTPY_WEB_MODULES_DIR.`
835835

836836
This change includes large breaking changes:
837837

838838
- The CLI is being removed as it won't be needed any longer
839839
- The `reactpy.client` is being removed in favor of a stripped down ``reactpy.web`` module
840-
- The `ReactPy_CLIENT_BUILD_DIR` config option will no longer exist and a new
841-
``ReactPy_WEB_MODULES_DIR`` which only contains dynamically linked web modules. While
840+
- The `REACTPY_CLIENT_BUILD_DIR` config option will no longer exist and a new
841+
``REACTPY_WEB_MODULES_DIR`` which only contains dynamically linked web modules. While
842842
this new directory's location is configurable, it is meant to be transient and should
843843
not be re-used across sessions.
844844

845845
The new ``reactpy.web`` module takes a simpler approach to constructing import sources and
846846
expands upon the logic for resolving imports by allowing exports from URLs to be
847847
discovered too. Now, that ReactPy isn't using NPM to dynamically install component
848848
libraries ``reactpy.web`` instead creates JS modules from template files and links them
849-
into ``ReactPy_WEB_MODULES_DIR``. These templates ultimately direct the browser to load the
849+
into ``REACTPY_WEB_MODULES_DIR``. These templates ultimately direct the browser to load the
850850
desired library from a CDN.
851851

852852
**Pull Requests**
@@ -1020,7 +1020,7 @@ its state do the same.
10201020

10211021
In a future update, the default key for all elements and components will be its index
10221022
with respect to its siblings in the layout. The
1023-
:attr:`~reactpy.config.ReactPy_FEATURE_INDEX_AS_DEFAULT_KEY` feature flag has been introduced
1023+
:attr:`~reactpy.config.REACTPY_FEATURE_INDEX_AS_DEFAULT_KEY` feature flag has been introduced
10241024
to allow users to enable this behavior early.
10251025

10261026
**Highlighted Commits:**
@@ -1059,12 +1059,12 @@ v0.23.0
10591059
- cleaner way to specify import sources - :commit:`ea19a07`
10601060
- add the reactpy-react-client back into the main repo - :commit:`5dcc3bb`
10611061
- implement fastapi render server - :commit:`94e0620`
1062-
- improve docstring for ReactPy_CLIENT_BUILD_DIR - :commit:`962d885`
1062+
- improve docstring for REACTPY_CLIENT_BUILD_DIR - :commit:`962d885`
10631063
- cli improvements - :commit:`788fd86`
10641064
- rename SERIALIZED_VDOM_JSON_SCHEMA to VDOM_JSON_SCHEMA - :commit:`74ad578`
10651065
- better logging for modules - :commit:`39565b9`
10661066
- move client utils into private module - :commit:`f825e96`
1067-
- redirect BUILD_DIR imports to ReactPy_CLIENT_BUILD_DIR option - :commit:`53fb23b`
1067+
- redirect BUILD_DIR imports to REACTPY_CLIENT_BUILD_DIR option - :commit:`53fb23b`
10681068
- upgrade snowpack - :commit:`5697a2d`
10691069
- better logs for reactpy.run + flask server - :commit:`2b34e3d`
10701070
- move package to src dir - :commit:`066c9c5`

docs/source/guides/escape-hatches/distributing-javascript.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ loaded with :func:`~reactpy.web.module.export`.
188188
189189
.. note::
190190

191-
When :data:`reactpy.config.ReactPy_DEBUG_MODE` is active, named exports will be validated.
191+
When :data:`reactpy.config.REACTPY_DEBUG_MODE` is active, named exports will be validated.
192192

193193
The remaining files that we need to create are concerned with creating a Python package.
194194
We won't cover all the details here, so refer to the Setuptools_ documentation for

docs/source/guides/getting-started/running-reactpy.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -103,29 +103,29 @@ Running ReactPy in Debug Mode
103103
-----------------------------
104104

105105
ReactPy provides a debug mode that is turned off by default. This can be enabled when you
106-
run your application by setting the ``ReactPy_DEBUG_MODE`` environment variable.
106+
run your application by setting the ``REACTPY_DEBUG_MODE`` environment variable.
107107

108108
.. tab-set::
109109

110110
.. tab-item:: Unix Shell
111111

112112
.. code-block::
113113
114-
export ReactPy_DEBUG_MODE=1
114+
export REACTPY_DEBUG_MODE=1
115115
python my_reactpy_app.py
116116
117117
.. tab-item:: Command Prompt
118118

119119
.. code-block:: text
120120
121-
set ReactPy_DEBUG_MODE=1
121+
set REACTPY_DEBUG_MODE=1
122122
python my_reactpy_app.py
123123
124124
.. tab-item:: PowerShell
125125

126126
.. code-block:: powershell
127127
128-
$env:ReactPy_DEBUG_MODE = "1"
128+
$env:REACTPY_DEBUG_MODE = "1"
129129
python my_reactpy_app.py
130130
131131
.. danger::

noxfile.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def test_javascript(session: Session) -> None:
177177
@apply_standard_pip_upgrades
178178
def test_python_suite(session: Session) -> None:
179179
"""Run the Python-based test suite"""
180-
session.env["ReactPy_DEBUG_MODE"] = "1"
180+
session.env["REACTPY_DEBUG_MODE"] = "1"
181181
install_requirements_file(session, "test-env")
182182
session.run("playwright", "install", "chromium")
183183
args = ["pytest", "--reruns", "3", "--reruns-delay", "1", *session.posargs]
@@ -387,9 +387,9 @@ def set_version(new: str) -> None:
387387
def get_reactpy_script_env() -> dict[str, str]:
388388
return {
389389
"PYTHONPATH": os.getcwd(),
390-
"ReactPy_DEBUG_MODE": os.environ.get("ReactPy_DEBUG_MODE", "1"),
391-
"ReactPy_TESTING_DEFAULT_TIMEOUT": os.environ.get(
392-
"ReactPy_TESTING_DEFAULT_TIMEOUT", "6.0"
390+
"REACTPY_DEBUG_MODE": os.environ.get("REACTPY_DEBUG_MODE", "1"),
391+
"REACTPY_TESTING_DEFAULT_TIMEOUT": os.environ.get(
392+
"REACTPY_TESTING_DEFAULT_TIMEOUT", "6.0"
393393
),
394-
"ReactPy_CHECK_VDOM_SPEC": os.environ.get("ReactPy_CHECK_VDOM_SPEC", "0"),
394+
"REACTPY_CHECK_VDOM_SPEC": os.environ.get("REACTPY_CHECK_VDOM_SPEC", "0"),
395395
}

scripts/live_docs.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020

2121
# these environment variable are used in custom Sphinx extensions
22-
os.environ["ReactPy_DOC_EXAMPLE_SERVER_HOST"] = "127.0.0.1:5555"
23-
os.environ["ReactPy_DOC_STATIC_SERVER_HOST"] = ""
22+
os.environ["REACTPY_DOC_EXAMPLE_SERVER_HOST"] = "127.0.0.1:5555"
23+
os.environ["REACTPY_DOC_STATIC_SERVER_HOST"] = ""
2424

2525
_running_reactpy_servers = []
2626

src/reactpy/backend/_common.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from reactpy import __file__ as _reactpy_file_path
1414
from reactpy import html
15-
from reactpy.config import ReactPy_WEB_MODULES_DIR
15+
from reactpy.config import REACTPY_WEB_MODULES_DIR
1616
from reactpy.core.types import VdomDict
1717
from reactpy.utils import vdom_to_html
1818

@@ -68,8 +68,8 @@ def safe_client_build_dir_path(path: str) -> Path:
6868

6969

7070
def safe_web_modules_dir_path(path: str) -> Path:
71-
"""Prevent path traversal out of :data:`reactpy.config.ReactPy_WEB_MODULES_DIR`"""
72-
return traversal_safe_path(ReactPy_WEB_MODULES_DIR.current, *path.split("/"))
71+
"""Prevent path traversal out of :data:`reactpy.config.REACTPY_WEB_MODULES_DIR`"""
72+
return traversal_safe_path(REACTPY_WEB_MODULES_DIR.current, *path.split("/"))
7373

7474

7575
def traversal_safe_path(root: str | Path, *unsafe: str | Path) -> Path:

src/reactpy/backend/starlette.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from reactpy.backend.hooks import ConnectionContext
1717
from reactpy.backend.types import Connection, Location
18-
from reactpy.config import ReactPy_WEB_MODULES_DIR
18+
from reactpy.config import REACTPY_WEB_MODULES_DIR
1919
from reactpy.core.layout import Layout
2020
from reactpy.core.serve import RecvCoroutine, SendCoroutine, serve_layout
2121
from reactpy.core.types import RootComponentConstructor
@@ -111,7 +111,7 @@ def _setup_common_routes(options: Options, app: Starlette) -> None:
111111

112112
app.mount(
113113
str(MODULES_PATH),
114-
StaticFiles(directory=ReactPy_WEB_MODULES_DIR.current, check_dir=False),
114+
StaticFiles(directory=REACTPY_WEB_MODULES_DIR.current, check_dir=False),
115115
)
116116
app.mount(
117117
str(ASSETS_PATH),

src/reactpy/backend/tornado.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from tornado.wsgi import WSGIContainer
1717

1818
from reactpy.backend.types import Connection, Location
19-
from reactpy.config import ReactPy_WEB_MODULES_DIR
19+
from reactpy.config import REACTPY_WEB_MODULES_DIR
2020
from reactpy.core.layout import Layout
2121
from reactpy.core.serve import serve_layout
2222
from reactpy.core.types import ComponentConstructor
@@ -115,7 +115,7 @@ def _setup_common_routes(options: Options) -> _RouteHandlerSpecs:
115115
(
116116
rf"{MODULES_PATH}/(.*)",
117117
StaticFileHandler,
118-
{"path": str(ReactPy_WEB_MODULES_DIR.current)},
118+
{"path": str(REACTPY_WEB_MODULES_DIR.current)},
119119
),
120120
(
121121
rf"{ASSETS_PATH}/(.*)",

0 commit comments

Comments
 (0)