11set windows-shell := [" pwsh" , " -NoLogo" , " -Command" ]
22
33repo-root := invocation_directory_native ()
4+ python-root := repo-root + " /src/sdk/python"
45export WIT_WORLD := repo-root + " /src/wasm_sandbox/wit/sandbox-world.wasm"
56rmrf := if os () == " windows" { " Remove-Item -Recurse -Force -ErrorAction SilentlyContinue" } else { " rm -rf" }
67mkdirp := if os () == " windows" { " New-Item -ItemType Directory -Force" } else { " mkdir -p" }
8+ uv-python-env := " UV_PYTHON"
9+ python-version-flag := " --python"
710
8- # Set via env or CLI (e.g. `just interpreters="--interpreter python3.10 python3.13 " python-dist`)
11+ # Set via env or CLI (e.g. `just interpreters="--interpreter python3.10 python3.14 " python-dist`)
912# to build wheels for multiple Python versions. Defaults to empty (maturin uses active Python).
1013interpreters := env (" INTERPRETERS" , " " )
14+ # Atheris currently supports fuzzing on Python <= 3.12. Keep the rest of the
15+ # SDK test/build surface on the active Python while running fuzz on 3.12.
16+ default-fuzz-python := " 3.12"
17+ fuzz-python := env (" FUZZ_PYTHON" , default-fuzz-python)
1118
1219dist-root := repo-root + " /dist/pythonsdk"
1320core-dist := dist-root + " /core"
@@ -32,23 +39,28 @@ python-sync-guest-resources:
3239# Install pure Python dependencies from the lockfile into the local venv.
3340# Skips the two Rust backend packages — those are compiled and installed
3441# separately by `python-install-backends` via `maturin develop`.
35- python-sync-env :
36- uv sync --frozen --inexact --no-install-package hyperlight-sandbox-backend-wasm --no-install-package hyperlight-sandbox-backend-hyperlight-js
42+ python-sync-env python - version = " " $ UV_PYTHON = ( if python-version != " " { python-version } else { env (uv-python- env , " " ) }) python - version - arg = ( if python-version != " " { python-version-flag + " " + python-version } else { " " }) :
43+ uv sync {{ python-version-arg }} --frozen --inexact --no-install-package hyperlight-sandbox-backend-wasm --no-install-package hyperlight-sandbox-backend-hyperlight-js
3744
3845# Install maturin backends into the local venv for development (maturin develop).
3946# This compiles the Rust backend crates and installs them as editable packages
4047# in the local venv so you can `import hyperlight_sandbox` directly.
4148# For distributable wheels, use `python-dist` (maturin build) instead.
4249# Use `just python python-build` for debug, `just python python-build release` for release.
43- python-install-backends profile = " debug":
50+ [private ]
51+ python-clean-backend-artifacts profile = " debug":
4452 - {{ if profile == " release" { rmrf + " " + repo-root + " /target/release/build/hyperlight-wasm-*" } else { " " } }}
4553 - {{ if profile == " release" { rmrf + " " + repo-root + " /target/release/.fingerprint/hyperlight-wasm-*" } else { " " } }}
4654 - {{ if profile == " release" { rmrf + " " + repo-root + " /target/release/build/hyperlight-js-*" } else { " " } }}
4755 - {{ if profile == " release" { rmrf + " " + repo-root + " /target/release/.fingerprint/hyperlight-js-*" } else { " " } }}
48- cd {{ repo-root}} / src/ sdk/ python/ wasm_backend && uv run --no-sync maturin develop {{ if profile == " release" { " --release" } else { " " } }}
49- cd {{ repo-root}} / src/ sdk/ python/ hyperlight_js_backend && uv run --no-sync maturin develop {{ if profile == " release" { " --release" } else { " " } }}
5056
51- python-build profile = " debug": python-sync-guest-resources python-sync-env (python-install-backends profile)
57+ [private ]
58+ python-develop-backend backend profile = " debug" python -version = " " $ UV_PYTHON = (if python-version != " " { python-version } else { env (uv-python-env , " " ) }) python -version -arg = (if python-version != " " { python-version-flag + " " + python-version } else { " " }) profile -arg = (if profile == " release" { " --release" } else { " " }):
59+ uv run --directory {{ python-root}} / {{ backend}} --no-sync {{ python-version-arg}} maturin develop {{ profile-arg}}
60+
61+ python-install-backends profile = " debug" python -version = " ": (python-clean-backend-artifacts profile) (python-develop-backend " wasm_backend" profile python-version) (python-develop-backend " hyperlight_js_backend" profile python-version)
62+
63+ python-build profile = " debug" python -version = " ": python-sync-guest-resources (python-sync-env python-version) (python-install-backends profile python-version)
5264
5365build : python-build
5466
@@ -81,20 +93,20 @@ python-publish repository="pypi":
8193# Smoke-test the wheels in dist/pythonsdk/ by installing them into
8294# isolated environments and running basic tests.
8395# Requires `just python-dist` (root) to have been run first.
84- python-wheelhouse-test python -version = " ":
85- uv run --no-project {{ if python-version != " " { " --python " + python-version } else { " " } }} --no-index \
96+ python-wheelhouse-test python -version = " " python - version - arg = ( if python-version != " " { python-version-flag + " " + python-version } else { " " }) :
97+ uv run --no-project {{ python-version-arg }} --no-index \
8698 - -find-links={{ core-dist}} \
8799 - -find-links={{ wasm-wheels}} \
88100 - -find-links={{ python-guest-dist}} \
89101 - -with " hyperlight-sandbox[wasm,python_guest]" \
90102 python {{ repo-root}} / src/ sdk/ python/ tests/ wheelhouse_wasm_python.py
91- uv run --no-project {{ if python-version != " " { " --python " + python-version } else { " " } }} --no-index \
103+ uv run --no-project {{ python-version-arg }} --no-index \
92104 - -find-links={{ core-dist}} \
93105 - -find-links={{ wasm-wheels}} \
94106 - -find-links={{ javascript-guest-dist}} \
95107 - -with " hyperlight-sandbox[wasm,javascript_guest]" \
96108 python {{ repo-root}} / src/ sdk/ python/ tests/ wheelhouse_wasm_js.py
97- uv run --no-project {{ if python-version != " " { " --python " + python-version } else { " " } }} --no-index \
109+ uv run --no-project {{ python-version-arg }} --no-index \
98110 - -find-links={{ core-dist}} \
99111 - -find-links={{ hyperlight-js-wheels}} \
100112 - -find-links={{ javascript-guest-dist}} \
@@ -141,5 +153,5 @@ fmt-check:
141153python-test : python-build
142154 uv run python -m unittest discover -s {{ repo-root}} / src/ sdk/ python/ core/ tests -p ' test_*.py' -v
143155
144- python-fuzz seconds = " 60": python-build
145- {{ if os () == " windows" { " echo 'Skipping python fuzz (atheris not available on Windows)'" } else { " uv run --package hyperlight-sandbox --extra dev python " + repo-root + " /src/sdk/python/core/tests/fuzz_tool_dispatch.py -max_total_time=" + seconds } }}
156+ python-fuzz seconds = " 60": ( python-build " debug" fuzz-python)
157+ {{ if os () == " windows" { " echo 'Skipping python fuzz (atheris not available on Windows)'" } else { " UV_PYTHON=" + fuzz-python + " uv run --python " + fuzz-python + " --package hyperlight-sandbox --extra dev python " + repo-root + " /src/sdk/python/core/tests/fuzz_tool_dispatch.py -max_total_time=" + seconds } }}
0 commit comments