1个不稳定版本
使用旧的Rust 2015
0.1.0 | 2018年12月5日 |
---|
#17 in #jupyter
405KB
8K SLoC
Rust Jupyter客户端
运行交互式Python代码的新接口。
安装
将以下内容添加到您的Cargo.toml中
[dependencies]
jupyter-client = { git = "https://gitlab.com/srwalker101/rust-jupyter-client.git", branch = "dev" }
lib.rs
:
Jupyter客户端
是Jupyter客户端的Rust实现。
示例
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)?;
依赖项
~3.5–5MB
~88K SLoC