Crate jupyter_client

source ·
Expand description

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)?;

Modules

Available commands to send to the kernel.
Available responses back from the kernel.

Structs

The main Client struct.

Type Definitions

Wrapped result type for this crate.