From 8698e80304815353ec52be1b16f96483ebe559a0 Mon Sep 17 00:00:00 2001 From: Kyle Kelley Date: Tue, 21 May 2024 13:35:21 -0700 Subject: refactor(jupyter): use runtimelib for Jupyter structures and directory paths (#23826) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This brings in [`runtimelib`](https://github.com/runtimed/runtimed) to use: ## Fully typed structs for Jupyter Messages ```rust let msg = connection.read().await?; self .send_iopub( runtimelib::Status::busy().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. ```rust 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(()) } } ``` Closes https://github.com/denoland/deno/issues/21619 --- tests/specs/jupyter/install_command/__test__.jsonc | 8 ++++++++ tests/specs/jupyter/install_command/install_command.out | 2 ++ 2 files changed, 10 insertions(+) create mode 100644 tests/specs/jupyter/install_command/__test__.jsonc create mode 100644 tests/specs/jupyter/install_command/install_command.out (limited to 'tests/specs/jupyter/install_command') diff --git a/tests/specs/jupyter/install_command/__test__.jsonc b/tests/specs/jupyter/install_command/__test__.jsonc new file mode 100644 index 000000000..df60c3b86 --- /dev/null +++ b/tests/specs/jupyter/install_command/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "jupyter --install", + "output": "install_command.out", + "envs": { + "PATH": "" + }, + "exitCode": 0 +} diff --git a/tests/specs/jupyter/install_command/install_command.out b/tests/specs/jupyter/install_command/install_command.out new file mode 100644 index 000000000..62875d9cf --- /dev/null +++ b/tests/specs/jupyter/install_command/install_command.out @@ -0,0 +1,2 @@ +Warning "deno jupyter" is unstable and might change in the future. +✅ Deno kernelspec installed successfully. -- cgit v1.2.3