eryx_runtime/lib.rs
1//! Eryx Python WASM Runtime
2//!
3//! Contains the WIT definition and builds the eryx sandbox WASM component.
4//! The component uses our custom eryx-wasm-runtime (`liberyx_runtime.so`) for Python
5//! execution via CPython FFI.
6//!
7//! ## Features
8//!
9//! - `preinit` - Pre-initialization support for capturing Python memory state.
10//! Provides ~25x speedup for sandbox creation. Works with or without native
11//! extensions - can pre-import stdlib modules only.
12//!
13//! - `native-extensions` - Native Python extension support via late-linking.
14//! Allows adding extensions like numpy at sandbox creation time. Implies `preinit`.
15//!
16//! ## Contents
17//!
18//! - `runtime.wit` - WIT interface definition
19//! - `linker` - Late-linking support for native extensions (requires `preinit`)
20//! - `preinit` - Pre-initialization support (requires `preinit` feature)
21//!
22//! ## See Also
23//!
24//! - `eryx-wasm-runtime` - The custom runtime that implements the WIT exports
25
26/// The WIT definition as a string constant.
27pub const WIT_DEFINITION: &str = include_str!("../wit/runtime.wit");
28
29/// Late-linking support for native Python extensions.
30#[cfg(feature = "preinit")]
31pub mod linker;
32
33/// Pre-initialization support for capturing Python memory state.
34#[cfg(feature = "preinit")]
35pub mod preinit;