deno
deno copied to clipboard
refactor(jupyter): use runtimelib for Jupyter structures and directory paths
Posting this up for now before I hack with @bartlomieju next week.
This brings in runtimelib
to use:
Fully typed structs for Jupyter Messages
let msg = connection.read().await?;
self
.send_iopub(
messaging::Status {
execution_state: "busy".to_string(),
}
.as_child_of(msg),
)
.await?;
Jupyter paths
Jupyter paths are implemented in Rust, allowing the Deno kernel to be installed completely via Deno without a requirement on Python or Jupyter. Deno users will be able to install and use the kernel with just VS Code or other editors that support Jupyter.
pub fn status() -> Result<(), AnyError> {
let user_data_dir = user_data_dir()?;
let kernel_spec_dir_path = user_data_dir.join("kernels").join("deno");
let kernel_spec_path = kernel_spec_dir_path.join("kernel.json");
if kernel_spec_path.exists() {
log::info!("✅ Deno kernel already installed");
Ok(())
} else {
log::warn!("ℹ️ Deno kernel is not yet installed, run `deno jupyter --install` to set it up");
Ok(())
}
}
I tested this out across all the notebooks in https://github.com/rgbkrk/denotebooks, which was also a great chance for me to switch them all to jsr:
wherever possible. Update: anywidget is also working (cc @manzt)!