Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Installation

Eryx provides language bindings for Rust, Python, and JavaScript. Choose your preferred language below.

Rust

Add Eryx to your Cargo.toml:

[dependencies]
eryx = { version = "0.3", features = ["embedded"] }
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }

Setting up the embedded feature

The embedded feature embeds a pre-compiled Wasm runtime into your binary for zero-config sandbox creation. Because the pre-compiled runtime is platform-specific (~55MB), it is not included in the crate and must be generated once for your machine:

cargo binstall eryx-precompile   # install the pre-compile tool
eryx-precompile setup            # download runtime + pre-compile for your platform

After this one-time setup, cargo build will find the cached runtime automatically. You can also set ERYX_RUNTIME_CWASM=/path/to/runtime-python.cwasm to use a specific file, which is embedded without the checksum and ownership checks applied to the cached runtime. See Pre-compiling Runtimes for advanced options like cross-compilation, CPU targeting, and bundling packages.

Feature Flags

FeatureDescriptionTrade-offs
embeddedEmbeds pre-compiled Wasm runtime + Python stdlib into your binary+55MB binary size; requires one-time setup (see above)
macrosEnables the #[callback] proc macro for simplified callback definitionsAdds proc-macro compile time
preinitPre-initialization support for ~25x faster sandbox creationAdds eryx-runtime dep; requires build step
native-extensionsNative Python extension support (e.g., numpy) via late-linkingImplies preinit; experimental

Recommended: Start with the embedded feature for the simplest setup.

Package support (with_package() for .whl and .tar.gz files) is always available — no feature flag required.


Python

Install from PyPI:

pip install pyeryx

Note: The package is installed as pyeryx but imported as eryx.

Verify Installation

import eryx

sandbox = eryx.Sandbox()
result = sandbox.execute("print('Hello from Eryx!')")
print(result.stdout_text)

JavaScript

Install from npm:

npm install @eryx-org/eryx

Note: JavaScript bindings require WebAssembly JSPI support. In Node.js 24–25, pass --experimental-wasm-jspi (on by default in Node.js 26+). In browsers, Chrome 133+ and Edge 133+ are supported.

Node.js

node --experimental-wasm-jspi your-script.js   # flag not needed on Node.js 26+
import { Sandbox } from "@eryx-org/eryx";

const sandbox = new Sandbox();
const result = await sandbox.execute('print("Hello from Eryx!")');
console.log(result.stdout);

Browser

import { Sandbox } from "@eryx-org/eryx";

const sandbox = new Sandbox();
const result = await sandbox.execute('print("Hello from the browser!")');
console.log(result.stdout);

See the JavaScript API reference for full documentation.


Next Steps