30467600bc
Front-door limpio: solo crates del dominio; Llimphi y lo fundacional por git-dep del monorepo gioser.git. cargo check pasa (40 crates, 0 errores). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
pluma-notebook-kernel-python
Python kernel for the pluma notebook.
Built on top of RustPython — pure native Rust, no CPython, no subprocess, not compiled to WASM. The VM runs synchronously inside tokio::task::spawn_blocking (RustPython uses Rc/RefCell and is not Send), with a fresh boot per cell. No network, no fs by default.
API
Implements the Kernel trait from pluma-notebook-exec:
use pluma_notebook_kernel_python::PythonKernel;
use pluma_notebook_exec::Kernel;
let k = PythonKernel::new();
let out = k.execute("2 + 3", "python").await?;
Accepts the languages python and py. Dual execution strategy:
- Eval: tries to parse
sourceas an expression → repr() of the value intoOutputPayload::Text;int/floatalso fillOutputPayload::Scalar(f64). - Exec: if eval fails, re-parses as statements (assignments, defs, prints, …).
print() is captured via a sys.stdout monkey-patch (a _PlumaCapture class injected in the preamble) and surfaces in KernelOutput::stdout alongside the value.
Deps
pluma-notebook-core,pluma-notebook-execrustpython-vmasync-trait,tokio(rt,sync)