1 unstable release
Uses old Rust 2015
0.1.0 | Dec 5, 2018 |
---|
#22 in #jupyter
405KB
8K
SLoC
Rust Jupyter Client
A new interface for running interactive python code.
Installation
Add the following to your Cargo.toml:
[dependencies]
jupyter-client = { git = "https://gitlab.com/srwalker101/rust-jupyter-client.git", branch = "dev" }
lib.rs
:
Jupyter Client
A Rust implementation of the Jupyter client.
Examples
extern crate jupyter_client;
use jupyter_client::Client;
use jupyter_client::commands::Command;
let client = Client::existing()?;
// Set up the heartbeat watcher
let hb_receiver = client.heartbeat()?;
thread::spawn(move || {
for _ in hb_receiver {
println!("Received heartbeat from kernel");
}
});
// Spawn an IOPub watcher
let receiver = client.iopub_subscribe()?;
thread::spawn(move || {
for msg in receiver {
println!("Received message from kernel: {:#?}", msg);
}
});
// Command to run
let command = Command::Execute {
code: "a = 10".to_string(),
silent: false,
store_history: true,
user_expressions: HashMap::new(),
allow_stdin: true,
stop_on_error: false,
};
// Run some code on the kernel
let response = client.send_shell_command(command)?;
Dependencies
~3.5–5MB
~91K SLoC