Upgrade jupyter websocket client (#21095)

Upgrade to changes from https://github.com/runtimed/runtimed/pull/158 

Release Notes:

- N/A
This commit is contained in:
Kyle Kelley 2024-11-22 22:11:20 -08:00 committed by GitHub
parent 8a9c53524a
commit 2177e833d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 98 additions and 55 deletions

114
Cargo.lock generated
View file

@ -885,6 +885,20 @@ version = "4.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de"
[[package]]
name = "async-tls"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cfeefd0ca297cbbb3bd34fd6b228401c2a5177038257afd751bc29f0a2da4795"
dependencies = [
"futures-core",
"futures-io",
"rustls 0.20.9",
"rustls-pemfile 1.0.4",
"webpki",
"webpki-roots 0.22.6",
]
[[package]]
name = "async-tls"
version = "0.13.0"
@ -916,6 +930,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce01ac37fdc85f10a43c43bc582cbd566720357011578a935761075f898baf58"
dependencies = [
"async-std",
"async-tls 0.12.0",
"futures-io",
"futures-util",
"log",
@ -930,7 +945,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90e661b6cb0a6eb34d02c520b052daa3aa9ac0cc02495c9d066bbce13ead132b"
dependencies = [
"async-std",
"async-tls",
"async-tls 0.13.0",
"futures-io",
"futures-util",
"log",
@ -1100,7 +1115,7 @@ dependencies = [
"fastrand 2.2.0",
"hex",
"http 0.2.12",
"ring",
"ring 0.17.8",
"time",
"tokio",
"tracing",
@ -1290,7 +1305,7 @@ dependencies = [
"once_cell",
"p256",
"percent-encoding",
"ring",
"ring 0.17.8",
"sha2",
"subtle",
"time",
@ -4457,7 +4472,7 @@ dependencies = [
"futures-core",
"futures-sink",
"nanorand",
"spin",
"spin 0.9.8",
]
[[package]]
@ -6370,7 +6385,7 @@ dependencies = [
"base64 0.21.7",
"js-sys",
"pem",
"ring",
"ring 0.17.8",
"serde",
"serde_json",
"simple_asn1",
@ -6378,9 +6393,9 @@ dependencies = [
[[package]]
name = "jupyter-protocol"
version = "0.2.0"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f3e9d36f282f7e0400de20921d283121a97c5a5a6db2c1bb0c0853defff9934"
checksum = "3d4d496ac890e14efc12c5289818b3c39e3026a7bb02d5576b011e1a062d4bcc"
dependencies = [
"anyhow",
"async-trait",
@ -6396,9 +6411,9 @@ dependencies = [
[[package]]
name = "jupyter-serde"
version = "0.5.0"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11adb69edaf2eb03d5e84249f68f870dd03d4c8f955314b5a32b2db5798e9b9a"
checksum = "32aa595c3912167b7eafcaa822b767ad1fa9605a18127fc9ac741241b796410e"
dependencies = [
"anyhow",
"serde",
@ -6409,9 +6424,9 @@ dependencies = [
[[package]]
name = "jupyter-websocket-client"
version = "0.4.1"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d315d037789a652084877b0919615e937d2f2e877b01aa4ba8fcc1ab07cb58b"
checksum = "5850894210a3f033ff730d6f956b0335db38573ce7bb61c6abbf69dcbe284ba7"
dependencies = [
"anyhow",
"async-trait",
@ -6717,7 +6732,7 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
dependencies = [
"spin",
"spin 0.9.8",
]
[[package]]
@ -7439,9 +7454,9 @@ dependencies = [
[[package]]
name = "nbformat"
version = "0.6.0"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "187de1b1f1430353ef9b5208096d84f7bf089ee1593f14213d122b7fbb1f3dee"
checksum = "aa6827a3881aa100bb2241cd2633b3c79474dbc93704f1f2cf5cc85064cda4be"
dependencies = [
"anyhow",
"chrono",
@ -9470,7 +9485,7 @@ dependencies = [
"bytes 1.8.0",
"getrandom 0.2.15",
"rand 0.8.5",
"ring",
"ring 0.17.8",
"rustc-hash 2.0.0",
"rustls 0.23.16",
"rustls-pki-types",
@ -10113,6 +10128,21 @@ dependencies = [
"util",
]
[[package]]
name = "ring"
version = "0.16.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc"
dependencies = [
"cc",
"libc",
"once_cell",
"spin 0.5.2",
"untrusted 0.7.1",
"web-sys",
"winapi",
]
[[package]]
name = "ring"
version = "0.17.8"
@ -10123,8 +10153,8 @@ dependencies = [
"cfg-if",
"getrandom 0.2.15",
"libc",
"spin",
"untrusted",
"spin 0.9.8",
"untrusted 0.9.0",
"windows-sys 0.52.0",
]
@ -10260,9 +10290,9 @@ dependencies = [
[[package]]
name = "runtimelib"
version = "0.21.0"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2db079f82c110e25c3202d20c7cd29dcbfa93d96de7c5bb8bb6f294f477567cf"
checksum = "b3a8ab675beb5cf25c28f9c6ddb8f47bcf73b43872797e6ab6157865f44d1e19"
dependencies = [
"anyhow",
"async-dispatcher",
@ -10276,7 +10306,7 @@ dependencies = [
"glob",
"jupyter-protocol",
"jupyter-serde",
"ring",
"ring 0.17.8",
"serde",
"serde_json",
"shellexpand 3.1.0",
@ -10403,6 +10433,18 @@ dependencies = [
"rustix 0.38.40",
]
[[package]]
name = "rustls"
version = "0.20.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b80e3dec595989ea8510028f30c408a4630db12c9cbb8de34203b89d6577e99"
dependencies = [
"log",
"ring 0.16.20",
"sct",
"webpki",
]
[[package]]
name = "rustls"
version = "0.21.12"
@ -10410,7 +10452,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e"
dependencies = [
"log",
"ring",
"ring 0.17.8",
"rustls-webpki 0.101.7",
"sct",
]
@ -10422,7 +10464,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eee87ff5d9b36712a58574e12e9f0ea80f915a5b0ac518d322b24a465617925e"
dependencies = [
"once_cell",
"ring",
"ring 0.17.8",
"rustls-pki-types",
"rustls-webpki 0.102.8",
"subtle",
@ -10487,8 +10529,8 @@ version = "0.101.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765"
dependencies = [
"ring",
"untrusted",
"ring 0.17.8",
"untrusted 0.9.0",
]
[[package]]
@ -10497,9 +10539,9 @@ version = "0.102.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9"
dependencies = [
"ring",
"ring 0.17.8",
"rustls-pki-types",
"untrusted",
"untrusted 0.9.0",
]
[[package]]
@ -10613,8 +10655,8 @@ version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414"
dependencies = [
"ring",
"untrusted",
"ring 0.17.8",
"untrusted 0.9.0",
]
[[package]]
@ -11376,6 +11418,12 @@ dependencies = [
"smallvec",
]
[[package]]
name = "spin"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
[[package]]
name = "spin"
version = "0.9.8"
@ -13485,6 +13533,12 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1766d682d402817b5ac4490b3c3002d91dfa0d22812f341609f97b08757359c"
[[package]]
name = "untrusted"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
[[package]]
name = "untrusted"
version = "0.9.0"
@ -14393,8 +14447,8 @@ version = "0.22.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53"
dependencies = [
"ring",
"untrusted",
"ring 0.17.8",
"untrusted 0.9.0",
]
[[package]]

View file

@ -378,14 +378,14 @@ indexmap = { version = "1.6.2", features = ["serde"] }
indoc = "2"
itertools = "0.13.0"
jsonwebtoken = "9.3"
jupyter-protocol = { version = "0.2.0" }
jupyter-websocket-client = { version = "0.4.1" }
jupyter-protocol = { version = "0.3.0" }
jupyter-websocket-client = { version = "0.5.0" }
libc = "0.2"
linkify = "0.10.0"
log = { version = "0.4.16", features = ["kv_unstable_serde", "serde"] }
markup5ever_rcdom = "0.3.0"
nanoid = "0.4"
nbformat = "0.6.0"
nbformat = { version = "0.7.0" }
nix = "0.29"
num-format = "0.4.4"
once_cell = "1.19.0"
@ -419,7 +419,7 @@ reqwest = { git = "https://github.com/zed-industries/reqwest.git", rev = "fd110f
"stream",
] }
rsa = "0.9.6"
runtimelib = { version = "0.21.0", default-features = false, features = [
runtimelib = { version = "0.22.0", default-features = false, features = [
"async-dispatcher-runtime",
] }
rustc-demangle = "0.1.23"

View file

@ -15,7 +15,8 @@ use project::{Project, WorktreeId};
pub use remote_kernels::*;
use anyhow::Result;
use runtimelib::{ExecutionState, JupyterKernelspec, JupyterMessage, KernelInfoReply};
use jupyter_protocol::JupyterKernelspec;
use runtimelib::{ExecutionState, JupyterMessage, KernelInfoReply};
use ui::{Icon, IconName, SharedString};
pub type JupyterMessageChannel = stream::SelectAll<Receiver<JupyterMessage>>;

View file

@ -6,9 +6,9 @@ use futures::{
AsyncBufReadExt as _, SinkExt as _,
};
use gpui::{EntityId, Task, View, WindowContext};
use jupyter_protocol::{JupyterMessage, JupyterMessageContent, KernelInfoReply};
use jupyter_protocol::{JupyterKernelspec, JupyterMessage, JupyterMessageContent, KernelInfoReply};
use project::Fs;
use runtimelib::{dirs, ConnectionInfo, ExecutionState, JupyterKernelspec};
use runtimelib::{dirs, ConnectionInfo, ExecutionState};
use smol::{net::TcpListener, process::Command};
use std::{
env,

View file

@ -1,8 +1,7 @@
use futures::{channel::mpsc, SinkExt as _};
use gpui::{Task, View, WindowContext};
use http_client::{AsyncBody, HttpClient, Request};
use jupyter_protocol::{ExecutionState, JupyterMessage, KernelInfoReply};
use runtimelib::JupyterKernelspec;
use jupyter_protocol::{ExecutionState, JupyterKernelspec, JupyterMessage, KernelInfoReply};
use futures::StreamExt;
use smol::io::AsyncReadExt as _;
@ -34,8 +33,9 @@ pub async fn launch_remote_kernel(
//
let kernel_launch_request = KernelLaunchRequest {
name: kernel_name.to_string(),
// todo: add path to runtimelib
// path,
// Note: since the path we have locally may not be the same as the one on the remote server,
// we don't send it. We'll have to evaluate this decisiion along the way.
path: None,
};
let kernel_launch_request = serde_json::to_string(&kernel_launch_request)?;
@ -91,19 +91,7 @@ pub async fn list_remote_kernelspecs(
name: name.clone(),
url: remote_server.base_url.clone(),
token: remote_server.token.clone(),
// todo: line up the jupyter kernelspec from runtimelib with
// the kernelspec pulled from the API
//
// There are _small_ differences, so we may just want a impl `From`
kernelspec: JupyterKernelspec {
argv: spec.spec.argv,
display_name: spec.spec.display_name,
language: spec.spec.language,
// todo: fix up mismatch in types here
metadata: None,
interrupt_mode: None,
env: None,
},
kernelspec: spec.spec,
})
.collect::<Vec<RemoteKernelSpecification>>();
@ -163,7 +151,7 @@ impl RemoteRunningKernel {
)
.await?;
let kernel_socket = remote_server.connect_to_kernel(&kernel_id).await?;
let (kernel_socket, _response) = remote_server.connect_to_kernel(&kernel_id).await?;
let (mut w, mut r): (JupyterWebSocketWriter, JupyterWebSocketReader) =
kernel_socket.split();