Skip to content
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

fix sdist #1191

Merged
merged 22 commits into from
Oct 31, 2024
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
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
Loading