@@ -10,6 +10,9 @@ javascript-guest-dist := dist-root + "/javascript_guest"
1010
1111#### BUILD ####
1212
13+ # Copy pre-built guest binaries (.aot/.wasm) from the wasm_sandbox build
14+ # into the Python guest packages so they can be bundled into wheels.
15+ # Requires `just wasm build` to have run first.
1316python-sync-guest-resources :
1417 mkdir -p {{ repo-root}} / src/ sdk/ python/ wasm_guests/ python_guest/ python_guest/ resources
1518 mkdir -p {{ repo-root}} / src/ sdk/ python/ wasm_guests/ javascript_guest/ javascript_guest/ resources
@@ -18,33 +21,32 @@ python-sync-guest-resources:
1821 cp {{ repo-root}} / src/ wasm_sandbox/ guests/ javascript/ js-sandbox.aot {{ repo-root}} / src/ sdk/ python/ wasm_guests/ javascript_guest/ javascript_guest/ resources/ js-sandbox.aot
1922 cp {{ repo-root}} / src/ wasm_sandbox/ guests/ javascript/ js-sandbox.wasm {{ repo-root}} / src/ sdk/ python/ wasm_guests/ javascript_guest/ javascript_guest/ resources/ js-sandbox.wasm
2023
21- # Sync the venv (installs maturin, guest packages, etc.) but skip the
22- # two maturin backend crates — they are built below via `maturin develop`.
24+ # Install pure Python dependencies from the lockfile into the local venv.
25+ # Skips the two Rust backend packages — those are compiled and installed
26+ # separately by `python-install-backends` via `maturin develop`.
2327python-sync-env :
2428 uv sync --frozen --inexact --no-install-package hyperlight-sandbox-backend-wasm --no-install-package hyperlight-sandbox-backend-hyperlight-js
2529
26- python-install-backend-wasm :
27- cd {{ repo-root}} / src/ sdk/ python/ wasm_backend && {{ wit-world }} uv run --no-sync maturin develop
28-
29- python-install-backend-wasm-release :
30- # Remove cached build-script output so the runtime binary is rebuilt
31- # for the release profile. The debug build may have left stale
32- # fingerprints that prevent the build script from re-running.
33- rm -rf {{ repo-root}} / target/ release/ build/ hyperlight-wasm-* \
34- {{ repo-root}} / target/ release/ .fingerprint/ hyperlight-wasm-*
35- cd {{ repo-root}} / src/ sdk/ python/ wasm_backend && {{ wit-world }} uv run --no-sync maturin develop --release
36-
37- python-install-backend-hyperlight-js :
38- cd {{ repo-root}} / src/ sdk/ python/ hyperlight_js_backend && uv run --no-sync maturin develop
39-
40- python-install-backend-hyperlight-js-release :
41- rm -rf {{ repo-root}} / target/ release/ build/ hyperlight-js-* \
42- {{ repo-root}} / target/ release/ .fingerprint/ hyperlight-js-*
43- cd {{ repo-root}} / src/ sdk/ python/ hyperlight_js_backend && uv run --no-sync maturin develop --release
44-
45- python-build : python-sync-guest-resources python-sync-env python-install-backend-wasm python-install-backend-hyperlight-js
30+ # Install maturin backends into the local venv for development (maturin develop).
31+ # This compiles the Rust backend crates and installs them as editable packages
32+ # in the local venv so you can `import hyperlight_sandbox` directly.
33+ # For distributable wheels, use `python-dist` (maturin build) instead.
34+ # Use `just python python-build` for debug, `just python python-build release` for release.
35+ python-install-backends profile = " debug":
36+ #!/usr/bin/env bash
37+ set -e
38+ release_flag=" "
39+ if [ " {{ profile }} " = " release" ]; then
40+ release_flag=" --release"
41+ rm -rf {{ repo-root}} / target/ release/ build/ hyperlight-wasm-* \
42+ {{ repo-root}} / target/ release/ .fingerprint/ hyperlight-wasm-* \
43+ {{ repo-root}} / target/ release/ build/ hyperlight-js-* \
44+ {{ repo-root}} / target/ release/ .fingerprint/ hyperlight-js-*
45+ fi
46+ cd {{ repo-root}} / src/ sdk/ python/ wasm_backend && {{ wit-world }} uv run --no-sync maturin develop $release_flag
47+ cd {{ repo-root}} / src/ sdk/ python/ hyperlight_js_backend && uv run --no-sync maturin develop $release_flag
4648
47- python-build-release : python-sync-guest-resources python-sync-env python-install-backend-wasm-release python-install-backend-hyperlight-js-release
49+ python-build profile = " debug" : python-sync-guest-resources python-sync-env ( python-install-backends profile)
4850
4951build : python-build
5052
@@ -58,7 +60,7 @@ python-dist: python-sync-guest-resources
5860 cd {{ repo-root}} / src/ sdk/ python/ wasm_guests/ python_guest && uv run python -m build --outdir {{ python-guest-dist}}
5961 cd {{ repo-root}} / src/ sdk/ python/ wasm_guests/ javascript_guest && uv run python -m build --outdir {{ javascript-guest-dist}}
6062
61- python-publish repository = " pypi": python-dist
63+ python-publish repository = " pypi":
6264 #!/usr/bin/env bash
6365 set -e
6466 publish_url=()
@@ -71,25 +73,25 @@ python-publish repository="pypi": python-dist
7173 uv publish " ${publish_url[@]}" {{ javascript-guest-dist}} / *
7274 uv publish " ${publish_url[@]}" {{ core-dist}} / *
7375
74- python-wheelhouse-test : python-sync-guest-resources
76+ python-wheelhouse-test : python-dist
7577 #!/usr/bin/env bash
7678 set -e
77- wheelhouse=$(mktemp -d)
7879 root={{ repo-root}}
79-
80- uv build --wheel --out-dir " $wheelhouse" " $root/src/sdk/python/core"
81- {{ wit-world }} uv build --wheel --out-dir " $wheelhouse" " $root/src/sdk/python/wasm_backend"
82- uv build --wheel --out-dir " $wheelhouse" " $root/src/sdk/python/hyperlight_js_backend"
83- uv build --wheel --out-dir " $wheelhouse" " $root/src/sdk/python/wasm_guests/python_guest"
84- uv build --wheel --out-dir " $wheelhouse" " $root/src/sdk/python/wasm_guests/javascript_guest"
80+ dist={{ dist-root}}
8581
8682 # Test wasm + python guest
87- uv run --no-project --no-index --find-links=" $wheelhouse" \
83+ uv run --no-project --no-index \
84+ - -find-links=" $dist/core" \
85+ - -find-links=" $dist/wasm_backend" \
86+ - -find-links=" $dist/python_guest" \
8887 - -with " hyperlight-sandbox[wasm,python_guest]" \
8988 python " $root/src/sdk/python/tests/wheelhouse_wasm.py"
9089
9190 # Test hyperlight-js + javascript guest
92- uv run --no-project --no-index --find-links=" $wheelhouse" \
91+ uv run --no-project --no-index \
92+ - -find-links=" $dist/core" \
93+ - -find-links=" $dist/hyperlight_js_backend" \
94+ - -find-links=" $dist/javascript_guest" \
9395 - -with " hyperlight-sandbox[hyperlight_js,javascript_guest]" \
9496 python " $root/src/sdk/python/tests/wheelhouse_js.py"
9597
@@ -106,7 +108,7 @@ examples: python-build
106108 {{ wit-world }} uv run python {{ repo-root}} / src/ sdk/ python/ core/ examples/ jswasm_network_demo.py
107109 {{ wit-world }} uv run python {{ repo-root}} / src/ sdk/ python/ core/ examples/ jswasm_filesystem_demo.py
108110
109- python-sandbox-benchmark : python-build- release
111+ python-sandbox-benchmark : ( python-build " release" )
110112 {{ wit-world }} uv run python {{ repo-root}} / src/ sdk/ python/ core/ examples/ benchmark.py
111113
112114#### CLEAN ####
0 commit comments