Skip to content

Commit

Permalink
fix sdist (#1191)
Browse files Browse the repository at this point in the history
Co-authored-by: Archmonger <[email protected]>
  • Loading branch information
rmorshea and Archmonger authored Oct 31, 2024
1 parent 1dcba7c commit 0facdca
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions docs/source/about/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Unreleased
- :pull:`1200` - Fixed ``UnicodeDecodeError`` when using ``reactpy.web.export``
- :pull:`1224` - Fixes needless unmounting of JavaScript components during each ReactPy render.
- :pull:`1126` - Fixed missing ``event["target"]["checked"]`` on checkbox inputs
- :pull:`1191` - Fixed missing static files on `sdist` Python distribution

**Added**

Expand Down
1 change: 1 addition & 0 deletions src/js/app/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default defineConfig({
react: "preact/compat",
"react-dom": "preact/compat",
},
preserveSymlinks: true,
},
base: "/_reactpy/",
});
1 change: 1 addition & 0 deletions src/py/reactpy/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

# --- Build Artifacts ---
reactpy/_static
js
15 changes: 12 additions & 3 deletions src/py/reactpy/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,20 @@ dependencies = [
types = "mypy --strict reactpy"
all = ["types"]

[tool.hatch.build.targets.sdist]
artifacts = ["_static"]

[tool.hatch.build.targets.wheel]
artifacts = ["_static"]

[[tool.hatch.build.hooks.build-scripts.scripts]]
work_dir = "../../js"
out_dir = "reactpy/_static"
commands = ["npm ci", "npm run build"]
artifacts = ["app/dist/"]
commands = [
# link the js directory if it doesn't exist - use Python to avoid platform differences
"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);\"",
"cd js && npm ci && npm run build",
]
artifacts = ["js/app/dist/"]

# --- Pytest ---------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion src/py/reactpy/reactpy/backend/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
MODULES_PATH = PATH_PREFIX / "modules"
ASSETS_PATH = PATH_PREFIX / "assets"
STREAM_PATH = PATH_PREFIX / "stream"
CLIENT_BUILD_DIR = Path(_reactpy_file_path).parent / "_static" / "app" / "dist"
CLIENT_BUILD_DIR = Path(_reactpy_file_path).parent / "_static" / "js" / "app" / "dist"


async def serve_with_uvicorn(
Expand Down
3 changes: 2 additions & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,9 @@ def prepare_py_release(

def publish(dry_run: bool):
with context.cd(package.path):
context.run("twine check dist/*")

if dry_run:
context.run("twine check dist/*")
return

context.run(
Expand Down

0 comments on commit 0facdca

Please sign in to comment.