Add boomslang-py: Python host package (python-in-python)#53
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Boomslang's sandboxed CPython-3.14-WASM runtime is currently only embeddable from Java (Chicory) or Rust (Wasmtime). Python programs that want to execute untrusted Python — agent code execution, user-supplied scripts, notebooks — have no way to use it. Inspired by simonw/micropython-wasm, this adds a self-contained Python wheel that bundles the entire WASM runtime, so
pip install+Sandbox().execute(code)gives sandboxed python-in-python with numpy/pandas/pydantic preloaded, no JVM required.What
boomslang-py/— pure-Python package (only dep:wasmtime) exposingSandbox: execute, resource limits (timeout via epoch interruption, memory, output caps), poison/reset,/work//libmounts, stdin, bytecode compile/load,execute_function, sync and async host functions (ports theAsyncHostRegistryv1 wire protocol).boomslang_host.callat sandbox bootstrap to fetch parked results in chunks via reserved__result_pending__/__result_chunk__control calls (no wasm rebuild; degrades to stock behavior under the Java host).python-wheeljob builds the wheel from the existing runtime artifact, tests against the installed wheel, and the release job ships it as a GitHub release asset (no PyPI)./usr, fd 4 =/lib, fd 5 =/work, fd 6 =/tmp) — arbitrary guest mount points are unreachable for any host.Testing
51 pytest cases executing real guest code (isolation, timeout-poison-reset, concurrency of async handlers, 3 MB host-call results, stdlib read-only enforcement, work-dir roundtrips), run both editable and against the installed 55 MB wheel in a clean venv: all green. Local flow:
just fetch-main-wasm && just python-test.