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