Skip to content

Commit 0facdca

Browse files
rmorsheaArchmonger
andauthored
fix sdist (#1191)
Co-authored-by: Archmonger <[email protected]>
1 parent 1dcba7c commit 0facdca

File tree

6 files changed

+18
-5
lines changed

6 files changed

+18
-5
lines changed

docs/source/about/changelog.rst

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Unreleased
2525
- :pull:`1200` - Fixed ``UnicodeDecodeError`` when using ``reactpy.web.export``
2626
- :pull:`1224` - Fixes needless unmounting of JavaScript components during each ReactPy render.
2727
- :pull:`1126` - Fixed missing ``event["target"]["checked"]`` on checkbox inputs
28+
- :pull:`1191` - Fixed missing static files on `sdist` Python distribution
2829

2930
**Added**
3031

src/js/app/vite.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export default defineConfig({
77
react: "preact/compat",
88
"react-dom": "preact/compat",
99
},
10+
preserveSymlinks: true,
1011
},
1112
base: "/_reactpy/",
1213
});

src/py/reactpy/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22

33
# --- Build Artifacts ---
44
reactpy/_static
5+
js

src/py/reactpy/pyproject.toml

+12-3
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,20 @@ dependencies = [
103103
types = "mypy --strict reactpy"
104104
all = ["types"]
105105

106+
[tool.hatch.build.targets.sdist]
107+
artifacts = ["_static"]
108+
109+
[tool.hatch.build.targets.wheel]
110+
artifacts = ["_static"]
111+
106112
[[tool.hatch.build.hooks.build-scripts.scripts]]
107-
work_dir = "../../js"
108113
out_dir = "reactpy/_static"
109-
commands = ["npm ci", "npm run build"]
110-
artifacts = ["app/dist/"]
114+
commands = [
115+
# link the js directory if it doesn't exist - use Python to avoid platform differences
116+
"python -c \"import pathlib as p;js=p.Path('js');js.unlink(missing_ok=True);js.symlink_to(p.Path('..','..','js').resolve(),target_is_directory=True);\"",
117+
"cd js && npm ci && npm run build",
118+
]
119+
artifacts = ["js/app/dist/"]
111120

112121
# --- Pytest ---------------------------------------------------------------------------
113122

src/py/reactpy/reactpy/backend/_common.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
MODULES_PATH = PATH_PREFIX / "modules"
2222
ASSETS_PATH = PATH_PREFIX / "assets"
2323
STREAM_PATH = PATH_PREFIX / "stream"
24-
CLIENT_BUILD_DIR = Path(_reactpy_file_path).parent / "_static" / "app" / "dist"
24+
CLIENT_BUILD_DIR = Path(_reactpy_file_path).parent / "_static" / "js" / "app" / "dist"
2525

2626

2727
async def serve_with_uvicorn(

tasks.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,9 @@ def prepare_py_release(
416416

417417
def publish(dry_run: bool):
418418
with context.cd(package.path):
419+
context.run("twine check dist/*")
420+
419421
if dry_run:
420-
context.run("twine check dist/*")
421422
return
422423

423424
context.run(

0 commit comments

Comments
 (0)