Summary
Add a --precompiled / -s flag to the eryx CLI that lets users run Python code in a custom pre-initialized, pre-compiled sandbox.
Motivation
With the enhanced eryx-precompile CLI (#81), users can create custom .cwasm files with third-party packages baked in. But there's no easy way to use them — you'd need to write Rust code with the Sandbox builder API.
A CLI flag would complete the user-facing workflow:
# Build a custom sandbox with numpy
eryx-precompile runtime.wasm -o numpy.cwasm \
--preinit --stdlib ./python-stdlib \
--package numpy-wasi.tar.gz --import numpy
# Use it
eryx --precompiled numpy.cwasm -c 'import numpy; print(numpy.array([1,2,3]).sum())'
eryx --precompiled numpy.cwasm script.py
Design
- Add
--precompiled <path> flag to the eryx CLI
- Loads the
.cwasm file via Sandbox::builder().with_precompiled_file(path)
- Needs
--stdlib for the Python stdlib path (or uses embedded if available)
- Could also support
--site-packages for pure-Python packages not baked into the cwasm
- The Python bindings could get a similar option:
python -m eryx -s numpy.cwasm -c '...'
References
Summary
Add a
--precompiled/-sflag to the eryx CLI that lets users run Python code in a custom pre-initialized, pre-compiled sandbox.Motivation
With the enhanced
eryx-precompileCLI (#81), users can create custom.cwasmfiles with third-party packages baked in. But there's no easy way to use them — you'd need to write Rust code with theSandboxbuilder API.A CLI flag would complete the user-facing workflow:
Design
--precompiled <path>flag to the eryx CLI.cwasmfile viaSandbox::builder().with_precompiled_file(path)--stdlibfor the Python stdlib path (or uses embedded if available)--site-packagesfor pure-Python packages not baked into the cwasmpython -m eryx -s numpy.cwasm -c '...'References