Skip to content

feat(cli): support custom precompiled sandboxes in eryx CLI #89

Description

@sd2k

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions