Cellbook
Dynamic computational notebook environment in plain Rust.
-
Cells are defined as
asyncfunctions with#[cell]annotations -
Cells are compiled as a
dylibcrate and dynamically reloaded on changes -
cargo-cellbookCLI utility provides a TUI runner and automatic reloader -
Cells have access to a shared store which retains the cell context across reloads
-
Cell output is stored and can be viewed in the TUI runner
-
Integrates with external applications to view images, plots, graphs, etc.
Installation
To create and run a new cellbook project use:
Notebook structure
The notebook consists of individual cells which are loaded in source order and the cellbook!(Config::default()) invocation which sets up the notebook with configuration options.
use ;
use ;
async
async
cellbook!;
Context store
Cells can store persistent data in the shared store using store!(), load!(), remove!(), consume!() convenience macros.
Values in the store are serialized with postcard, hence stored types must implement serde's Serialize and Deserialize traits.
// Store a value (variable name becomes the key)
store!?;
// Store with explicit key
store!?;
// Load a value (type has to be specified)
let data: = load!?;
// Remove a value from the store
remove!;
// Load and remove the value from the store
let data: = consume!?;
Components
| Crate | Description |
|---|---|
cellbook |
Core library with context store, cell registry, and macros |
cellbook-macros |
Proc macros (#[cell], cellbook!) |
cargo-cellbook |
CLI for project scaffolding and runtime |