Skip to content

Commit 2671e78

Browse files
authored
v2.0.0b6 (#1314)
1 parent 87ec4a7 commit 2671e78

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1958
-1156
lines changed

.github/copilot-instructions.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ Always reference these instructions first and fallback to search or bash command
88

99
**BUG INVESTIGATION**: When investigating whether a bug was already resolved in a previous version, always prioritize searching through `docs/source/about/changelog.rst` first before using Git history. Only search through Git history when no relevant changelog entries are found.
1010

11-
**CODE RETRIEVAL**: Always prioritize using Serena tools (e.g., `mcp_oraios_serena_find_symbol`, `mcp_oraios_serena_search_for_pattern`) for code retrieval and analysis over standard file reading or searching tools.
12-
1311
## Working Effectively
1412

1513
### Bootstrap, Build, and Test the Repository
@@ -56,7 +54,6 @@ pip install flask sanic tornado
5654
- `hatch test --cover` -- run tests with coverage reporting (used in CI)
5755
- `hatch test -k test_name` -- run specific tests
5856
- `hatch test tests/test_config.py` -- run specific test files
59-
- Note: Some tests require Playwright browser automation and may fail in headless environments
6057

6158
**Run Python Linting and Formatting:**
6259

@@ -70,7 +67,7 @@ pip install flask sanic tornado
7067

7168
- `hatch run javascript:check` -- Lint and type-check JavaScript (10 seconds). NEVER CANCEL. Set timeout to 30+ minutes.
7269
- `hatch run javascript:fix` -- Format JavaScript code
73-
- `hatch run javascript:test` -- Run JavaScript tests (note: may fail in headless environments due to DOM dependencies)
70+
- `hatch run javascript:test` -- Run JavaScript tests
7471

7572
**Interactive Development Shell:**
7673

@@ -325,13 +322,6 @@ Follow this step-by-step process for effective development:
325322
- Network timeouts during pip install are common in CI environments
326323
- Missing dependencies error: Install ASGI dependencies with `pip install orjson asgiref asgi-tools servestatic`
327324

328-
### Test Issues:
329-
330-
- Playwright tests may fail in headless environments -- this is expected
331-
- Tests requiring browser DOM should be marked appropriately
332-
- Use `hatch test -k "not playwright"` to skip browser-dependent tests
333-
- JavaScript tests may fail with "window is not defined" in Node.js environment -- this is expected
334-
335325
### Import Issues:
336326

337327
- ReactPy must be installed or src/ must be in Python path
@@ -397,7 +387,6 @@ Always ensure your changes pass local validation before pushing, as the CI pipel
397387
- **All builds and tests run quickly** - if something takes more than 60 seconds, investigate the issue
398388
- **Hatch environments provide full isolation** - no need to manage virtual environments manually
399389
- **JavaScript packages are bundled into Python** - the build process combines JS and Python into a single distribution
400-
- **Browser automation tests may fail in headless environments** - this is expected behavior for Playwright tests
401390
- **Documentation updates are required** when making changes to Python source code
402391
- **Always update this file** when making changes to the development workflow, build process, or repository structure
403392
- **All tests must always pass** - failures are never expected or allowed in a healthy development environment

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# --- Build Artifacts ---
2-
src/reactpy/static/index.js*
2+
src/reactpy/static/*.js*
33
src/reactpy/static/morphdom/
44
src/reactpy/static/pyscript/
55

.serena/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.serena/memories/code_style.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

.serena/memories/development_workflow.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

.serena/memories/project_overview.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

.serena/memories/suggested_commands.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

.serena/project.yml

Lines changed: 0 additions & 84 deletions
This file was deleted.

docs/source/about/changelog.rst

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,15 @@ Unreleased
3333
- :pull:`1269` - Added ``reactpy.pyscript_component`` that can be used to embed ReactPy components into your existing application.
3434
- :pull:`1264` - Added ``reactpy.use_async_effect`` hook.
3535
- :pull:`1281` - Added ``reactpy.Vdom`` primitive interface for creating VDOM dictionaries.
36-
- :pull:`1307` - Added ``reactpy.web.reactjs_component_from_file`` to import ReactJS components from a file.
37-
- :pull:`1307` - Added ``reactpy.web.reactjs_component_from_url`` to import ReactJS components from a URL.
38-
- :pull:`1307` - Added ``reactpy.web.reactjs_component_from_string`` to import ReactJS components from a string.
36+
- :pull:`1307` - Added ``reactpy.reactjs.component_from_file`` to import ReactJS components from a file.
37+
- :pull:`1307` - Added ``reactpy.reactjs.component_from_url`` to import ReactJS components from a URL.
38+
- :pull:`1307` - Added ``reactpy.reactjs.component_from_string`` to import ReactJS components from a string.
39+
- :pull:`1314` - Added ``reactpy.reactjs.component_from_npm`` to import ReactJS components from NPM.
40+
- :pull:`1314` - Added ``reactpy.h`` as a shorthand alias for ``reactpy.html``.
3941

4042
**Changed**
4143

44+
- :pull:`1314` - The ``key`` attribute is now stored within ``attributes`` in the VDOM spec.
4245
- :pull:`1251` - Substitute client-side usage of ``react`` with ``preact``.
4346
- :pull:`1239` - Script elements no longer support behaving like effects. They now strictly behave like plain HTML scripts.
4447
- :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()``.
@@ -59,14 +62,15 @@ Unreleased
5962
- :pull:`1281` - ``reactpy.core.vdom._EllipsisRepr`` has been moved to ``reactpy.types.EllipsisRepr``.
6063
- :pull:`1281` - ``reactpy.types.VdomDictConstructor`` has been renamed to ``reactpy.types.VdomConstructor``.
6164
- :pull:`1312` - ``REACTPY_ASYNC_RENDERING`` can now de-duplicate and cascade renders where necessary.
62-
- :pull:`1312` - ``REACTPY_ASYNC_RENDERING`` is now defaulted to ``True`` for up to 40x performance improvements.
65+
- :pull:`1312` - ``REACTPY_ASYNC_RENDERING`` is now defaulted to ``True`` for up to 40x performance improvements in environments with high concurrency.
6366

6467
**Deprecated**
6568

66-
-:pull:`1307` - ``reactpy.web.export`` is deprecated. Use ``reactpy.web.reactjs_component_from_*`` instead.
67-
-:pull:`1307` - ``reactpy.web.module_from_file`` is deprecated. Use ``reactpy.web.reactjs_component_from_file`` instead.
68-
-:pull:`1307` - ``reactpy.web.module_from_url`` is deprecated. Use ``reactpy.web.reactjs_component_from_url`` instead.
69-
-:pull:`1307` - ``reactpy.web.module_from_string`` is deprecated. Use ``reactpy.web.reactjs_component_from_string`` instead.
69+
-:pull:`1307` - ``reactpy.web.export`` is deprecated. Use ``reactpy.reactjs.component_from_*`` instead.
70+
-:pull:`1307` - ``reactpy.web.module_from_file`` is deprecated. Use ``reactpy.reactjs.component_from_file`` instead.
71+
-:pull:`1307` - ``reactpy.web.module_from_url`` is deprecated. Use ``reactpy.reactjs.component_from_url`` instead.
72+
-:pull:`1307` - ``reactpy.web.module_from_string`` is deprecated. Use ``reactpy.reactjs.component_from_string`` instead.
73+
-:pull:`1314` - ``reactpy.web.*`` is deprecated. Use ``reactpy.reactjs.*`` instead.
7074

7175
**Removed**
7276

@@ -78,8 +82,8 @@ Unreleased
7882
- :pull:`1311` - Removed deprecated exception type ``reactpy.core.serve.Stop``.
7983
- :pull:`1311` - Removed deprecated component ``reactpy.widgets.hotswap``.
8084
- :pull:`1255` - Removed ``reactpy.sample`` module.
81-
- :pull:`1255` - Removed ``reactpy.svg`` module. Contents previously within ``reactpy.svg.*`` can now be accessed via ``html.svg.*``.
82-
- :pull:`1255` - Removed ``reactpy.html._`` function. Use ``html.fragment`` instead.
85+
- :pull:`1255` - Removed ``reactpy.svg`` module. Contents previously within ``reactpy.svg.*`` can now be accessed via ``reactpy.html.svg.*``.
86+
- :pull:`1255` - Removed ``reactpy.html._`` function. Use ``reactpy.html(...)`` or ``reactpy.html.fragment(...)`` instead.
8387
- :pull:`1113` - Removed ``reactpy.run``. See the documentation for the new method to run ReactPy applications.
8488
- :pull:`1113` - Removed ``reactpy.backend.*``. See the documentation for the new method to run ReactPy applications.
8589
- :pull:`1113` - Removed ``reactpy.core.types`` module. Use ``reactpy.types`` instead.
@@ -92,12 +96,14 @@ Unreleased
9296
- :pull:`1312` - Removed ``reactpy.types.LayoutType``. Use ``reactpy.types.BaseLayout`` instead.
9397
- :pull:`1312` - Removed ``reactpy.types.ContextProviderType``. Use ``reactpy.types.ContextProvider`` instead.
9498
- :pull:`1312` - Removed ``reactpy.core.hooks._ContextProvider``. Use ``reactpy.types.ContextProvider`` instead.
99+
- :pull:`1314` - Removed ``reactpy.web.utils``. Use ``reactpy.reactjs.utils`` instead.
95100

96101
**Fixed**
97102

98103
- :pull:`1239` - Fixed a bug where script elements would not render to the DOM as plain text.
99104
- :pull:`1271` - Fixed a bug where the ``key`` property provided within server-side ReactPy code was failing to propagate to the front-end JavaScript components.
100105
- :pull:`1254` - Fixed a bug where ``RuntimeError("Hook stack is in an invalid state")`` errors could be generated when using a webserver that reuses threads.
106+
- :pull:`1314` - Allow for ReactPy and ReactJS components to be arbitrarily inserted onto the page with any possible hierarchy.
101107

102108

103109
v1.1.0

src/build_scripts/clean_js_dir.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,30 @@
1313

1414
# Get the path to the JS source directory
1515
js_src_dir = pathlib.Path(__file__).parent.parent / "js"
16-
17-
# Get the paths to all `dist` folders in the JS source directory
18-
dist_dirs = glob.glob(str(js_src_dir / "**/dist"), recursive=True)
19-
20-
# Get the paths to all `node_modules` folders in the JS source directory
21-
node_modules_dirs = glob.glob(str(js_src_dir / "**/node_modules"), recursive=True)
22-
23-
# Get the paths to all `tsconfig.tsbuildinfo` files in the JS source directory
24-
tsconfig_tsbuildinfo_files = glob.glob(
25-
str(js_src_dir / "**/tsconfig.tsbuildinfo"), recursive=True
26-
)
16+
static_output_dir = pathlib.Path(__file__).parent.parent / "reactpy" / "static"
2717

2818
# Delete all `dist` folders
19+
dist_dirs = glob.glob(str(js_src_dir / "**/dist"), recursive=True)
2920
for dist_dir in dist_dirs:
3021
with contextlib.suppress(FileNotFoundError):
3122
shutil.rmtree(dist_dir)
3223

3324
# Delete all `node_modules` folders
25+
node_modules_dirs = glob.glob(str(js_src_dir / "**/node_modules"), recursive=True)
3426
for node_modules_dir in node_modules_dirs:
3527
with contextlib.suppress(FileNotFoundError):
3628
shutil.rmtree(node_modules_dir)
3729

3830
# Delete all `tsconfig.tsbuildinfo` files
31+
tsconfig_tsbuildinfo_files = glob.glob(
32+
str(js_src_dir / "**/tsconfig.tsbuildinfo"), recursive=True
33+
)
3934
for tsconfig_tsbuildinfo_file in tsconfig_tsbuildinfo_files:
4035
with contextlib.suppress(FileNotFoundError):
4136
os.remove(tsconfig_tsbuildinfo_file)
37+
38+
# Delete all `index-*.js` files
39+
index_js_files = glob.glob(str(static_output_dir / "index-*.js*"))
40+
for index_js_file in index_js_files:
41+
with contextlib.suppress(FileNotFoundError):
42+
os.remove(index_js_file)

0 commit comments

Comments
 (0)