From b1962f7cd8569ecade486c40320e3cff2d4b9d22 Mon Sep 17 00:00:00 2001 From: Kyle Kelley Date: Tue, 10 Nov 2026 13:38:24 +0000 Subject: [PATCH] repl: Update Jupyter dependencies (#66220) ## Summary Upgrades jupyter deps to latest versions. This also brings us forward to a version without async-std so that we can go all in on smol or tokio as needed. ## Testing Beyond the test suites, ran notebooks and repl code for some nice quality human QA. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - N/A --------- Co-authored-by: MrSubidubi <75036051+MrSubidubi@users.noreply.github.com> --- Cargo.lock | 269 ++++++++++------------ Cargo.toml | 8 +- crates/repl/Cargo.toml | 2 +- crates/repl/src/kernels/mod.rs | 11 +- crates/repl/src/kernels/native_kernel.rs | 20 +- crates/repl/src/kernels/remote_kernels.rs | 12 +- crates/repl/src/kernels/ssh_kernel.rs | 14 +- crates/repl/src/kernels/wsl_kernel.rs | 12 +- crates/repl/src/notebook/cell.rs | 2 +- crates/repl/src/notebook/notebook_ui.rs | 80 ++++--- crates/repl/src/outputs.rs | 59 ++--- crates/repl/src/outputs/table.rs | 21 +- crates/repl/src/repl.rs | 2 +- crates/repl/src/session.rs | 6 +- 14 files changed, 267 insertions(+), 251 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9bd8b4cc56f..324ca2375fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -955,16 +955,6 @@ dependencies = [ "util", ] -[[package]] -name = "async-attributes" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3203e79f4dd9bdda415ed03cf14dae5a2bf775c683a00f94e9cd1faf0f596e5" -dependencies = [ - "quote", - "syn 1.0.109", -] - [[package]] name = "async-broadcast" version = "0.7.2" @@ -1177,7 +1167,6 @@ version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c8e079a4ab67ae52b7403632e4618815d6db36d2a010cfe41b02c1b1578f93b" dependencies = [ - "async-attributes", "async-channel 1.9.0", "async-global-executor", "async-io", @@ -1288,7 +1277,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a860072022177f903e59730004fb5dc13db9275b79bb2aef7ba8ce831956c233" dependencies = [ - "bytes 1.11.1", + "bytes 1.12.1", "futures-sink", "futures-util", "memchr", @@ -1518,7 +1507,7 @@ dependencies = [ "aws-smithy-runtime-api", "aws-smithy-types", "aws-types", - "bytes 1.11.1", + "bytes 1.12.1", "fastrand 2.3.0", "hex", "http 1.3.1", @@ -1544,9 +1533,9 @@ dependencies = [ [[package]] name = "aws-lc-rs" -version = "1.18.1" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b281d307588d634de920874890732659e2e7672f72b5e10e81badc1a8a83621e" +checksum = "048006790404103c488e6c5616b3e7e702a71292aadda08e8f7698a9e0d2eb53" dependencies = [ "aws-lc-sys", "untrusted 0.7.1", @@ -1555,9 +1544,9 @@ dependencies = [ [[package]] name = "aws-lc-sys" -version = "0.45.0" +version = "0.47.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bff6c3b54fad79a2e60b8102caf565819711497c1f5f092f49508e2f5c31b27" +checksum = "8bfbe32ac36b3c428696ce315464181bc4029d689fd58e3f2a4e58c252242f52" dependencies = [ "cc", "cmake", @@ -1581,7 +1570,7 @@ dependencies = [ "aws-smithy-runtime-api", "aws-smithy-types", "aws-types", - "bytes 1.11.1", + "bytes 1.12.1", "bytes-utils", "fastrand 2.3.0", "http 0.2.12", @@ -1612,7 +1601,7 @@ dependencies = [ "aws-smithy-runtime-api", "aws-smithy-types", "aws-types", - "bytes 1.11.1", + "bytes 1.12.1", "fastrand 2.3.0", "http 0.2.12", "http 1.3.1", @@ -1638,7 +1627,7 @@ dependencies = [ "aws-smithy-runtime-api", "aws-smithy-types", "aws-types", - "bytes 1.11.1", + "bytes 1.12.1", "fastrand 2.3.0", "http 0.2.12", "http 1.3.1", @@ -1666,7 +1655,7 @@ dependencies = [ "aws-smithy-types", "aws-smithy-xml", "aws-types", - "bytes 1.11.1", + "bytes 1.12.1", "fastrand 2.3.0", "hex", "hmac", @@ -1697,7 +1686,7 @@ dependencies = [ "aws-smithy-runtime-api", "aws-smithy-types", "aws-types", - "bytes 1.11.1", + "bytes 1.12.1", "fastrand 2.3.0", "http 0.2.12", "http 1.3.1", @@ -1721,7 +1710,7 @@ dependencies = [ "aws-smithy-runtime-api", "aws-smithy-types", "aws-types", - "bytes 1.11.1", + "bytes 1.12.1", "fastrand 2.3.0", "http 0.2.12", "http 1.3.1", @@ -1765,7 +1754,7 @@ dependencies = [ "aws-smithy-http", "aws-smithy-runtime-api", "aws-smithy-types", - "bytes 1.11.1", + "bytes 1.12.1", "crypto-bigint 0.5.5", "form_urlencoded", "hex", @@ -1801,7 +1790,7 @@ checksum = "a764fa7222922f6c0af8eea478b0ef1ba5ce1222af97e01f33ca5e957bd7f3b9" dependencies = [ "aws-smithy-http", "aws-smithy-types", - "bytes 1.11.1", + "bytes 1.12.1", "crc-fast", "hex", "http 1.3.1", @@ -1821,7 +1810,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "faf09d74e5e32f76b8762da505a3cd59303e367a664ca67295387baa8c1d7548" dependencies = [ "aws-smithy-types", - "bytes 1.11.1", + "bytes 1.12.1", "crc32fast", ] @@ -1834,7 +1823,7 @@ dependencies = [ "aws-smithy-eventstream", "aws-smithy-runtime-api", "aws-smithy-types", - "bytes 1.11.1", + "bytes 1.12.1", "bytes-utils", "futures-core", "futures-util", @@ -1913,7 +1902,7 @@ dependencies = [ "aws-smithy-observability", "aws-smithy-runtime-api", "aws-smithy-types", - "bytes 1.11.1", + "bytes 1.12.1", "fastrand 2.3.0", "http 0.2.12", "http 1.3.1", @@ -1935,7 +1924,7 @@ dependencies = [ "aws-smithy-async", "aws-smithy-runtime-api-macros", "aws-smithy-types", - "bytes 1.11.1", + "bytes 1.12.1", "http 0.2.12", "http 1.3.1", "pin-project-lite", @@ -1973,7 +1962,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53f93074121a1be41317b9aa607143ae17900631f7f59a99f2b905d519d6783b" dependencies = [ "base64-simd", - "bytes 1.11.1", + "bytes 1.12.1", "bytes-utils", "futures-core", "http 0.2.12", @@ -2034,7 +2023,7 @@ dependencies = [ "axum-core", "base64 0.21.7", "bitflags 1.3.2", - "bytes 1.11.1", + "bytes 1.12.1", "futures-util", "headers", "http 0.2.12", @@ -2067,7 +2056,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" dependencies = [ "async-trait", - "bytes 1.11.1", + "bytes 1.12.1", "futures-util", "http 0.2.12", "http-body 0.4.6", @@ -2403,7 +2392,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "553c5d846a6ba5150c65e3b1b8ec073bcf1abc20f9b7220de384a4443ea4e20a" dependencies = [ "borsh-derive", - "bytes 1.11.1", + "bytes 1.12.1", "cfg_aliases", ] @@ -2558,9 +2547,9 @@ dependencies = [ [[package]] name = "bytes" -version = "1.11.1" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" [[package]] name = "bytes-utils" @@ -2568,7 +2557,7 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dafe3a8757b027e2be6e4e5601ed563c55989fcf1546e933c66c8eb3a058d35" dependencies = [ - "bytes 1.11.1", + "bytes 1.12.1", "either", ] @@ -2719,7 +2708,7 @@ dependencies = [ "maybe-owned", "rustix", "rustix-linux-procfs", - "windows-sys 0.61.2", + "windows-sys 0.60.2", "winx", ] @@ -3366,7 +3355,7 @@ version = "4.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" dependencies = [ - "bytes 1.11.1", + "bytes 1.12.1", "memchr", ] @@ -5006,7 +4995,7 @@ dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -5792,7 +5781,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -6854,7 +6843,7 @@ dependencies = [ "libc", "log", "rustversion", - "windows-link 0.2.1", + "windows-link 0.1.3", "windows-result 0.4.1", ] @@ -6986,7 +6975,7 @@ dependencies = [ "gobject-sys", "libc", "system-deps", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -7817,7 +7806,7 @@ version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0beca50380b1fc32983fc1cb4587bfa4bb9e78fc259aad4a0032d2080309222d" dependencies = [ - "bytes 1.11.1", + "bytes 1.12.1", "fnv", "futures-core", "futures-sink", @@ -7837,7 +7826,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef8e5e5a340588f4452631496976cf8636d4a7ecf600239fdc27615d2530bc16" dependencies = [ "atomic-waker", - "bytes 1.11.1", + "bytes 1.12.1", "fnv", "futures-core", "futures-sink", @@ -8009,7 +7998,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270" dependencies = [ "base64 0.21.7", - "bytes 1.11.1", + "bytes 1.12.1", "headers-core", "http 0.2.12", "httpdate", @@ -8174,7 +8163,7 @@ version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" dependencies = [ - "bytes 1.11.1", + "bytes 1.12.1", "fnv", "itoa", ] @@ -8185,7 +8174,7 @@ version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" dependencies = [ - "bytes 1.11.1", + "bytes 1.12.1", "fnv", "itoa", ] @@ -8196,7 +8185,7 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ - "bytes 1.11.1", + "bytes 1.12.1", "http 0.2.12", "pin-project-lite", ] @@ -8207,7 +8196,7 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ - "bytes 1.11.1", + "bytes 1.12.1", "http 1.3.1", ] @@ -8217,7 +8206,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" dependencies = [ - "bytes 1.11.1", + "bytes 1.12.1", "futures-core", "http 1.3.1", "http-body 1.0.1", @@ -8235,7 +8224,7 @@ name = "http_client" version = "0.1.0" dependencies = [ "anyhow", - "bytes 1.11.1", + "bytes 1.12.1", "futures 0.3.34", "http 1.3.1", "http-body 1.0.1", @@ -8303,7 +8292,7 @@ version = "0.14.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" dependencies = [ - "bytes 1.11.1", + "bytes 1.12.1", "futures-channel", "futures-core", "futures-util", @@ -8328,7 +8317,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27b501faa50e7a26c3d3560ca625132f4078a17771f4810baf70475ae48cbe43" dependencies = [ "atomic-waker", - "bytes 1.11.1", + "bytes 1.12.1", "futures-channel", "futures-core", "h2 0.4.19", @@ -8378,7 +8367,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ - "bytes 1.11.1", + "bytes 1.12.1", "hyper 0.14.32", "native-tls", "tokio", @@ -8392,7 +8381,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c6995591a8f1380fcb4ba966a252a4b29188d51d2b89e3a252f5305be65aea8" dependencies = [ "base64 0.22.1", - "bytes 1.11.1", + "bytes 1.12.1", "futures-channel", "futures-core", "futures-util", @@ -8403,7 +8392,7 @@ dependencies = [ "libc", "percent-encoding", "pin-project-lite", - "socket2 0.6.5", + "socket2 0.5.10", "tokio", "tower-service", "tracing", @@ -9309,12 +9298,12 @@ dependencies = [ [[package]] name = "jupyter-protocol" -version = "1.4.0" +version = "2.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4649647741f9794a7a02e3be976f1b248ba28a37dbfc626d5089316fd4fbf4c8" +checksum = "cf199c30e61505042f5c0d79a33b5a71c552ea8b64243ff3498b1f4592d8e692" dependencies = [ "async-trait", - "bytes 1.11.1", + "bytes 1.12.1", "chrono", "futures 0.3.34", "serde", @@ -9325,14 +9314,14 @@ dependencies = [ [[package]] name = "jupyter-websocket-client" -version = "1.1.0" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c2ae4d8d5344f69bf9734b264e969c2139e30e932ce9b6455de9f65663ed614" +checksum = "f31dc36df1907d5350072e2d404ed815ac92c33e10c7fb2205b4eb67ed1b23f6" dependencies = [ "anyhow", "async-trait", "async-tungstenite", - "bytes 1.11.1", + "bytes 1.12.1", "futures 0.3.34", "jupyter-protocol", "serde", @@ -9342,6 +9331,26 @@ dependencies = [ "uuid", ] +[[package]] +name = "jupyter-zmq-client" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb9fa2584acd956d0044dcb1c85d94e8c9147a5b59d3f1074c842eb14d6a609" +dependencies = [ + "async-dispatcher", + "aws-lc-rs", + "bytes 1.12.1", + "data-encoding", + "dirs", + "jupyter-protocol", + "serde", + "serde_json", + "smol", + "thiserror 2.0.17", + "uuid", + "zeromq", +] + [[package]] name = "keymap_editor" version = "0.1.0" @@ -10050,7 +10059,7 @@ source = "git+https://github.com/zed-industries/livekit-rust-sdks?rev=fbda05eb27 dependencies = [ "base64 0.22.1", "bmrng", - "bytes 1.11.1", + "bytes 1.12.1", "chrono", "futures-util", "lazy_static", @@ -11037,7 +11046,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "536bfad37a309d62069485248eeaba1e8d9853aaf951caaeaed0585a95346f08" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -11195,9 +11204,9 @@ dependencies = [ [[package]] name = "nbformat" -version = "1.2.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4983a40792c45e8639f77ef8e4461c55679cbc618f4b9e83830e8c7e79c8383" +checksum = "b2c06543f305caee515923b125a737c4d58079c063e25701f93f45077bb8d622" dependencies = [ "anyhow", "chrono", @@ -11426,7 +11435,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -12032,7 +12041,7 @@ dependencies = [ "arc-swap", "async-trait", "base64 0.22.1", - "bytes 1.11.1", + "bytes 1.12.1", "cargo_metadata", "cfg-if", "chrono", @@ -12645,7 +12654,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a14e2757d877c0f607a82ce1b8560e224370f159d66c5d52eb55ea187ef0350e" dependencies = [ - "bytes 1.11.1", + "bytes 1.12.1", "chrono", "pbjson", "pbjson-build", @@ -14156,7 +14165,7 @@ version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "528ac67416ff8646872a3c02cad9cc4ee5dc9f9540c9b10771855c95cb2e5ae1" dependencies = [ - "bytes 1.11.1", + "bytes 1.12.1", "prost-derive", ] @@ -14166,7 +14175,7 @@ version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03da047801ff44bb6a4d407d4860c05fd70bb81714e6b2f3812603d5b145b042" dependencies = [ - "heck 0.5.0", + "heck 0.4.1", "itertools 0.14.0", "log", "multimap", @@ -14250,7 +14259,7 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4f25a07a73c6717f0b9bbbd685918f5df9815f7efba450b83d9c9dea41f0e3a1" dependencies = [ - "bytes 1.11.1", + "bytes 1.12.1", "miette", "prost", "prost-reflect", @@ -14431,14 +14440,14 @@ version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20" dependencies = [ - "bytes 1.11.1", + "bytes 1.12.1", "cfg_aliases", "pin-project-lite", "quinn-proto", "quinn-udp", "rustc-hash 2.1.1", "rustls", - "socket2 0.6.5", + "socket2 0.5.10", "thiserror 2.0.17", "tokio", "tracing", @@ -14451,7 +14460,7 @@ version = "0.11.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9746dbde176634f4f2f1faf2404e30a31b2bc1e9cafb5329c95d8177a18c9fc" dependencies = [ - "bytes 1.11.1", + "bytes 1.12.1", "getrandom 0.4.1", "lru-slab", "rand 0.10.2", @@ -14476,7 +14485,7 @@ dependencies = [ "cfg_aliases", "libc", "once_cell", - "socket2 0.6.5", + "socket2 0.5.10", "tracing", "windows-sys 0.60.2", ] @@ -15119,6 +15128,7 @@ dependencies = [ "indoc", "jupyter-protocol", "jupyter-websocket-client", + "jupyter-zmq-client", "language", "languages", "log", @@ -15129,7 +15139,6 @@ dependencies = [ "picker", "project", "remote", - "runtimelib", "serde", "serde_json", "settings", @@ -15158,7 +15167,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" dependencies = [ "base64 0.21.7", - "bytes 1.11.1", + "bytes 1.12.1", "encoding_rs", "futures-core", "futures-util", @@ -15198,7 +15207,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d0946410b9f7b082a427e4ef5c8ff541a88b357bc6c637c40db3a68ac70a36f" dependencies = [ "base64 0.22.1", - "bytes 1.11.1", + "bytes 1.12.1", "futures-channel", "futures-core", "futures-util", @@ -15236,7 +15245,7 @@ name = "reqwest_client" version = "0.1.0" dependencies = [ "anyhow", - "bytes 1.11.1", + "bytes 1.12.1", "futures 0.3.34", "gpui_util", "http_client", @@ -15457,32 +15466,6 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fae8ee26b0371a29a77d2b2d6b3ae13aa81def6f9bf1b1b92a32d279a5e709b7" -[[package]] -name = "runtimelib" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa84884e45ed4a1e663120cef3fc11f14d1a2a1933776e1c31599f7bd2dd0c9e" -dependencies = [ - "async-dispatcher", - "async-std", - "aws-lc-rs", - "base64 0.22.1", - "bytes 1.11.1", - "chrono", - "data-encoding", - "dirs", - "futures 0.3.34", - "glob", - "jupyter-protocol", - "serde", - "serde_json", - "shellexpand", - "smol", - "thiserror 2.0.17", - "uuid", - "zeromq", -] - [[package]] name = "rust-embed" version = "8.11.0" @@ -15567,7 +15550,7 @@ dependencies = [ "errno 0.3.14", "libc", "linux-raw-sys", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -15665,7 +15648,7 @@ dependencies = [ "security-framework", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -15736,9 +15719,9 @@ checksum = "dd29631678d6fb0903b69223673e122c32e9ae559d0960a38d574695ebc0ea15" [[package]] name = "saa" -version = "5.4.9" +version = "5.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0ba8adb63e0deebd0744d8fc5bea394c08029159deaf680513fec1a3949144" +checksum = "bd85992a680de788217d9c70b74aa7685b108cf1aba02f728fb27f1b27199ad1" [[package]] name = "same-file" @@ -15770,9 +15753,9 @@ dependencies = [ [[package]] name = "scc" -version = "3.5.6" +version = "3.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4bd9d1727de391b6982925d830baad51692fa2aa6e337733c03d95121ca2793" +checksum = "5d5f8ca67c4f6208caf824037a6a9df0211b4e0937fccc4f543441f294d04511" dependencies = [ "saa", "sdd", @@ -15892,9 +15875,12 @@ dependencies = [ [[package]] name = "sdd" -version = "4.6.2" +version = "4.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c25da4ae64b24edfcb0b0d30b96b2b0dbc64ec63aefeb6ec35bfc5ef167e5c9e" +checksum = "a31877eee03686b905845993b5d9809a220c9dd5a10e9d6021d7ca67384c9070" +dependencies = [ + "saa", +] [[package]] name = "sea-bae" @@ -16859,7 +16845,7 @@ version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1c97747dbf44bb1ca44a561ece23508e99cb592e862f22222dcf42f51d1e451" dependencies = [ - "heck 0.5.0", + "heck 0.4.1", "proc-macro2", "quote", "syn 2.0.117", @@ -16928,7 +16914,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -17044,7 +17030,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee6798b1838b6a0f69c007c133b8df5866302197e404e8b6ee8ed3e3a5e68dc6" dependencies = [ "base64 0.22.1", - "bytes 1.11.1", + "bytes 1.12.1", "chrono", "crc", "crossbeam-queue", @@ -17124,7 +17110,7 @@ dependencies = [ "base64 0.22.1", "bitflags 2.13.1", "byteorder", - "bytes 1.11.1", + "bytes 1.12.1", "chrono", "crc", "digest", @@ -17242,7 +17228,7 @@ dependencies = [ "cfg-if", "libc", "psm", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -17962,7 +17948,7 @@ dependencies = [ "getrandom 0.4.1", "once_cell", "rustix", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -18418,11 +18404,11 @@ dependencies = [ [[package]] name = "tokio" -version = "1.52.1" +version = "1.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67dee974fe86fd92cc45b7a95fdd2f99a36a6d7b0d431a231178d3d670bbcc6" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" dependencies = [ - "bytes 1.11.1", + "bytes 1.12.1", "libc", "mio", "parking_lot", @@ -18532,7 +18518,7 @@ version = "0.7.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" dependencies = [ - "bytes 1.11.1", + "bytes 1.12.1", "futures-core", "futures-io", "futures-sink", @@ -18707,7 +18693,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140" dependencies = [ "bitflags 2.13.1", - "bytes 1.11.1", + "bytes 1.12.1", "futures-core", "futures-util", "http 0.2.12", @@ -18726,7 +18712,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" dependencies = [ "bitflags 2.13.1", - "bytes 1.11.1", + "bytes 1.12.1", "futures-util", "http 1.3.1", "http-body 1.0.1", @@ -18854,7 +18840,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fb391ac70462b3097a755618fbf9c8f95ecc1eb379a414f7b46f202ed10db1f" dependencies = [ "cc", - "windows-targets 0.52.6", + "windows-targets 0.48.5", ] [[package]] @@ -19135,7 +19121,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9" dependencies = [ "byteorder", - "bytes 1.11.1", + "bytes 1.12.1", "data-encoding", "http 0.2.12", "httparse", @@ -19153,7 +19139,7 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8628dcc84e5a09eb3d8423d6cb682965dea9133204e8fb3efee74c2a0c259442" dependencies = [ - "bytes 1.11.1", + "bytes 1.12.1", "data-encoding", "http 1.3.1", "httparse", @@ -20264,7 +20250,7 @@ checksum = "3ef0d3ec88f9406bc5e498848489c49ff515577500acc9f03fa93d0883dce435" dependencies = [ "async-trait", "bitflags 2.13.1", - "bytes 1.11.1", + "bytes 1.12.1", "cap-primitives", "futures 0.3.34", "rand 0.10.2", @@ -20287,7 +20273,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe7dfc924e222e15455bd6d445ff7065a4595fffc7698c7bbc01acc0ed6c0421" dependencies = [ "async-trait", - "bytes 1.11.1", + "bytes 1.12.1", "futures 0.3.34", "tracing", "wasmtime", @@ -20790,7 +20776,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.48.0", ] [[package]] @@ -22267,7 +22253,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35e709a1923e34cf52d5b1466653b8da2f0360bccfbdd9870c5bf78732d4faad" dependencies = [ "base64 0.22.1", - "bytes 1.11.1", + "bytes 1.12.1", "flate2", "futures 0.3.34", "getrandom 0.2.16", @@ -22640,7 +22626,7 @@ version = "0.12.15-zed" source = "git+https://github.com/zed-industries/reqwest.git?rev=33bc764aa15ff7b200bf7c93bd96e24878d53e14#33bc764aa15ff7b200bf7c93bd96e24878d53e14" dependencies = [ "base64 0.22.1", - "bytes 1.11.1", + "bytes 1.12.1", "encoding_rs", "futures-core", "futures-util", @@ -22869,25 +22855,26 @@ dependencies = [ [[package]] name = "zeromq" -version = "0.5.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b32e1e46c4e278efd0c1153f2db0113924b9bc5fff9f9221853d035e2d26fadf" +checksum = "55b31ad37d1aad854ddc8c4f16b637259ce95f757f6c32f05447279c68ed9e2a" dependencies = [ "async-dispatcher", + "async-io", "async-std", "async-trait", "asynchronous-codec", - "bytes 1.11.1", + "bytes 1.12.1", "crossbeam-queue", "futures 0.3.34", + "futures-channel", "log", - "num-traits", - "once_cell", "parking_lot", - "rand 0.9.4", + "rand 0.10.2", "regex", "scc", - "thiserror 1.0.69", + "socket2 0.6.5", + "thiserror 2.0.17", "uuid", ] diff --git a/Cargo.toml b/Cargo.toml index 2c21684341f..c4063a24293 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -684,8 +684,8 @@ itertools = "0.14.0" js-sys = "0.3" jsonschema = { version = "0.51", default-features = false } jsonwebtoken = { version = "10.0", default-features = false } -jupyter-protocol = "1.4.0" -jupyter-websocket-client = "1.1.0" +jupyter-protocol = "2.0.3" +jupyter-websocket-client = "3.0.0" libc = "0.2" libsqlite3-sys = { version = "0.30.1", features = ["bundled"] } libwebrtc = "0.3.26" @@ -702,7 +702,7 @@ mime = "0.3.17" minidumper = "0.11" moka = { version = "0.12.10", features = ["sync"] } nanoid = "0.4" -nbformat = "1.2.0" +nbformat = "3.0.0" nix = "0.30" notify-rust = "4" nucleo = { package = "nucleo-matcher", version = "0.3" } @@ -882,7 +882,7 @@ resvg = { version = "0.46.0", default-features = false, features = [ "raster-images", ] } rsa = { version = "0.9", default-features = false, features = ["std", "u64_digit"] } -runtimelib = { version = "1.4.0", default-features = false, features = [ +jupyter-zmq-client = { version = "3.0.0", default-features = false, features = [ "async-dispatcher-runtime", "aws-lc-rs" ] } rust-embed = { version = "8.11", features = ["include-exclude", "compression"] } diff --git a/crates/repl/Cargo.toml b/crates/repl/Cargo.toml index b430b52d404..cccbffb029c 100644 --- a/crates/repl/Cargo.toml +++ b/crates/repl/Cargo.toml @@ -42,7 +42,7 @@ multi_buffer.workspace = true nbformat.workspace = true project.workspace = true remote.workspace = true -runtimelib.workspace = true +jupyter-zmq-client.workspace = true serde.workspace = true serde_json.workspace = true settings.workspace = true diff --git a/crates/repl/src/kernels/mod.rs b/crates/repl/src/kernels/mod.rs index 4e42eae3edd..31e22191e67 100644 --- a/crates/repl/src/kernels/mod.rs +++ b/crates/repl/src/kernels/mod.rs @@ -23,10 +23,11 @@ use std::collections::HashMap; use anyhow::Result; use futures::{FutureExt, StreamExt}; use gpui::{AppContext, AsyncWindowContext, Context}; -use jupyter_protocol::{JupyterKernelspec, JupyterMessageContent}; -use runtimelib::{ +use jupyter_protocol::{ + ExecutionState, JupyterKernelspec, JupyterMessage, JupyterMessageContent, KernelInfoReply, +}; +use jupyter_zmq_client::{ ClientControlConnection, ClientIoPubConnection, ClientShellConnection, ClientStdinConnection, - ExecutionState, JupyterMessage, KernelInfoReply, }; use ui::{Icon, IconName, SharedString}; use util::rel_path::RelPath; @@ -129,8 +130,8 @@ pub fn start_kernel_tasks( .ok(); } Err( - ref err @ (runtimelib::RuntimeError::ParseError { .. } - | runtimelib::RuntimeError::SerdeError(_)), + ref err @ (jupyter_zmq_client::RuntimeError::ParseError { .. } + | jupyter_zmq_client::RuntimeError::SerdeError(_)), ) => { let error_detail = format!("Kernel issue on {channel} channel\n\n{err}"); log::warn!("kernel: {error_detail}"); diff --git a/crates/repl/src/kernels/native_kernel.rs b/crates/repl/src/kernels/native_kernel.rs index d7ee106cab6..caf28e0f796 100644 --- a/crates/repl/src/kernels/native_kernel.rs +++ b/crates/repl/src/kernels/native_kernel.rs @@ -9,8 +9,8 @@ use jupyter_protocol::{ ExecutionState, JupyterKernelspec, JupyterMessage, KernelInfoReply, connection_info::{ConnectionInfo, Transport}, }; +use jupyter_zmq_client::dirs; use project::Fs; -use runtimelib::dirs; use smol::net::TcpListener; use std::{ env, @@ -157,20 +157,24 @@ impl NativeRunningKernel { let session_id = Uuid::new_v4().to_string(); - let iopub_socket = - runtimelib::create_client_iopub_connection(&connection_info, "", &session_id) - .await?; + let iopub_socket = jupyter_zmq_client::create_client_iopub_connection( + &connection_info, + "", + &session_id, + ) + .await?; let control_socket = - runtimelib::create_client_control_connection(&connection_info, &session_id).await?; + jupyter_zmq_client::create_client_control_connection(&connection_info, &session_id) + .await?; - let peer_identity = runtimelib::peer_identity_for_session(&session_id)?; - let shell_socket = runtimelib::create_client_shell_connection_with_identity( + let peer_identity = jupyter_zmq_client::peer_identity_for_session(&session_id)?; + let shell_socket = jupyter_zmq_client::create_client_shell_connection_with_identity( &connection_info, &session_id, peer_identity.clone(), ) .await?; - let stdin_socket = runtimelib::create_client_stdin_connection_with_identity( + let stdin_socket = jupyter_zmq_client::create_client_stdin_connection_with_identity( &connection_info, &session_id, peer_identity, diff --git a/crates/repl/src/kernels/remote_kernels.rs b/crates/repl/src/kernels/remote_kernels.rs index 69a41e85acc..3def0ef3741 100644 --- a/crates/repl/src/kernels/remote_kernels.rs +++ b/crates/repl/src/kernels/remote_kernels.rs @@ -247,11 +247,11 @@ impl Debug for RemoteRunningKernel { } impl RunningKernel for RemoteRunningKernel { - fn request_tx(&self) -> futures::channel::mpsc::Sender { + fn request_tx(&self) -> futures::channel::mpsc::Sender { self.request_tx.clone() } - fn stdin_tx(&self) -> futures::channel::mpsc::Sender { + fn stdin_tx(&self) -> futures::channel::mpsc::Sender { self.stdin_tx.clone() } @@ -259,19 +259,19 @@ impl RunningKernel for RemoteRunningKernel { &self.working_directory } - fn execution_state(&self) -> &runtimelib::ExecutionState { + fn execution_state(&self) -> &jupyter_protocol::ExecutionState { &self.execution_state } - fn set_execution_state(&mut self, state: runtimelib::ExecutionState) { + fn set_execution_state(&mut self, state: jupyter_protocol::ExecutionState) { self.execution_state = state; } - fn kernel_info(&self) -> Option<&runtimelib::KernelInfoReply> { + fn kernel_info(&self) -> Option<&jupyter_protocol::KernelInfoReply> { self.kernel_info.as_ref() } - fn set_kernel_info(&mut self, info: runtimelib::KernelInfoReply) { + fn set_kernel_info(&mut self, info: jupyter_protocol::KernelInfoReply) { self.kernel_info = Some(info); } diff --git a/crates/repl/src/kernels/ssh_kernel.rs b/crates/repl/src/kernels/ssh_kernel.rs index 0317270b2ad..c82c307c6ad 100644 --- a/crates/repl/src/kernels/ssh_kernel.rs +++ b/crates/repl/src/kernels/ssh_kernel.rs @@ -8,8 +8,8 @@ use futures::{ io::BufReader, }; use gpui::{App, Entity, Task, Window}; +use jupyter_protocol::{ExecutionState, JupyterMessage, KernelInfoReply}; use project::Project; -use runtimelib::{ExecutionState, JupyterMessage, KernelInfoReply}; use std::path::PathBuf; use util::ResultExt; @@ -206,7 +206,7 @@ impl SshRunningKernel { )?; // Parse connection info and create ZMQ connections - let connection_info_struct: runtimelib::ConnectionInfo = + let connection_info_struct: jupyter_protocol::ConnectionInfo = serde_json::from_value(local_connection_info)?; let session_id = uuid::Uuid::new_v4().to_string(); @@ -214,7 +214,7 @@ impl SshRunningKernel { let max_retries = 5; let mut retry = 0; loop { - match runtimelib::create_client_iopub_connection( + match jupyter_zmq_client::create_client_iopub_connection( &connection_info_struct, "", &session_id, @@ -243,8 +243,8 @@ impl SshRunningKernel { } }; - let peer_identity = runtimelib::peer_identity_for_session(&session_id)?; - let shell_socket = runtimelib::create_client_shell_connection_with_identity( + let peer_identity = jupyter_zmq_client::peer_identity_for_session(&session_id)?; + let shell_socket = jupyter_zmq_client::create_client_shell_connection_with_identity( &connection_info_struct, &session_id, peer_identity.clone(), @@ -252,10 +252,10 @@ impl SshRunningKernel { .await .context("failed to create shell connection")?; let control_socket = - runtimelib::create_client_control_connection(&connection_info_struct, &session_id) + jupyter_zmq_client::create_client_control_connection(&connection_info_struct, &session_id) .await .context("failed to create control connection")?; - let stdin_socket = runtimelib::create_client_stdin_connection_with_identity( + let stdin_socket = jupyter_zmq_client::create_client_stdin_connection_with_identity( &connection_info_struct, &session_id, peer_identity, diff --git a/crates/repl/src/kernels/wsl_kernel.rs b/crates/repl/src/kernels/wsl_kernel.rs index b4f6d356bf2..f994551c8c6 100644 --- a/crates/repl/src/kernels/wsl_kernel.rs +++ b/crates/repl/src/kernels/wsl_kernel.rs @@ -13,8 +13,8 @@ use jupyter_protocol::{ ExecutionState, JupyterMessage, KernelInfoReply, connection_info::{ConnectionInfo, Transport}, }; +use jupyter_zmq_client::dirs; use project::Fs; -use runtimelib::dirs; use smol::net::TcpListener; use std::{ fmt::Debug, @@ -322,7 +322,7 @@ impl WslRunningKernel { Err(_) => {} } - let output_socket = runtimelib::create_client_iopub_connection( + let output_socket = jupyter_zmq_client::create_client_iopub_connection( &client_connection_info, "", &session_id, @@ -330,8 +330,8 @@ impl WslRunningKernel { .await .context("Failed to create iopub connection. Is `ipykernel` installed in the WSL environment? Try running `pip install ipykernel` inside your WSL distribution.")?; - let peer_identity = runtimelib::peer_identity_for_session(&session_id)?; - let shell_socket = runtimelib::create_client_shell_connection_with_identity( + let peer_identity = jupyter_zmq_client::peer_identity_for_session(&session_id)?; + let shell_socket = jupyter_zmq_client::create_client_shell_connection_with_identity( &client_connection_info, &session_id, peer_identity.clone(), @@ -339,10 +339,10 @@ impl WslRunningKernel { .await?; let control_socket = - runtimelib::create_client_control_connection(&client_connection_info, &session_id) + jupyter_zmq_client::create_client_control_connection(&client_connection_info, &session_id) .await?; - let stdin_socket = runtimelib::create_client_stdin_connection_with_identity( + let stdin_socket = jupyter_zmq_client::create_client_stdin_connection_with_identity( &client_connection_info, &session_id, peer_identity, diff --git a/crates/repl/src/notebook/cell.rs b/crates/repl/src/notebook/cell.rs index 055b49f40ef..97e06a56e59 100644 --- a/crates/repl/src/notebook/cell.rs +++ b/crates/repl/src/notebook/cell.rs @@ -7,10 +7,10 @@ use gpui::{ App, Entity, EventEmitter, Focusable, Hsla, InteractiveElement, RetainAllImageCache, StatefulInteractiveElement, Task, prelude::*, }; +use jupyter_protocol::{JupyterMessage, JupyterMessageContent}; use language::{Buffer, Language, LanguageRegistry}; use markdown::{Markdown, MarkdownElement, MarkdownFont, MarkdownStyle}; use nbformat::v4::{CellId, CellMetadata, CellType}; -use runtimelib::{JupyterMessage, JupyterMessageContent}; use settings::Settings as _; use ui::{CommonAnimationExt, IconButtonShape, prelude::*}; use util::ResultExt; diff --git a/crates/repl/src/notebook/notebook_ui.rs b/crates/repl/src/notebook/notebook_ui.rs index 2467c7e3161..a36ccedb85c 100644 --- a/crates/repl/src/notebook/notebook_ui.rs +++ b/crates/repl/src/notebook/notebook_ui.rs @@ -38,8 +38,8 @@ use crate::kernels::{ use crate::notebook::MovementDirection; use crate::repl_store::ReplStore; +use jupyter_protocol::{ExecuteRequest, JupyterMessage, JupyterMessageContent}; use picker::Picker; -use runtimelib::{ExecuteRequest, JupyterMessage, JupyterMessageContent}; use ui::PopoverMenuHandle; use zed_actions::editor::{MoveDown, MoveUp}; use zed_actions::notebook::{ @@ -565,7 +565,7 @@ impl NotebookEditor { cx: &mut Context, ) { if let Kernel::RunningKernel(kernel) = &self.kernel { - let interrupt_request = runtimelib::InterruptRequest {}; + let interrupt_request = jupyter_protocol::InterruptRequest {}; let message: JupyterMessage = interrupt_request.into(); kernel.request_tx().try_send(message).ok(); cx.notify(); @@ -1698,19 +1698,7 @@ impl project::ProjectItem for NotebookItem { } }; - match notebook { - nbformat::Notebook::V4(notebook) => notebook, - // 4.1 - 4.4 are converted to 4.5 - nbformat::Notebook::Legacy(legacy_notebook) => { - // TODO: Decide if we want to mutate the notebook by including Cell IDs - // and any other conversions - - nbformat::upgrade_legacy_notebook(legacy_notebook)? - } - nbformat::Notebook::V3(v3_notebook) => { - nbformat::upgrade_v3_notebook(v3_notebook)? - } - } + upgrade_notebook(notebook)? }; let id = project @@ -1956,19 +1944,9 @@ impl Item for NotebookEditor { } let file_content = serde_json::to_string(&json)?; - let notebook = nbformat::parse_notebook(&file_content); - let notebook = match notebook { - Ok(nbformat::Notebook::V4(notebook)) => notebook, - Ok(nbformat::Notebook::Legacy(legacy_notebook)) => { - nbformat::upgrade_legacy_notebook(legacy_notebook)? - } - Ok(nbformat::Notebook::V3(v3_notebook)) => { - nbformat::upgrade_v3_notebook(v3_notebook)? - } - Err(e) => { - anyhow::bail!("Failed to parse notebook: {:?}", e); - } - }; + let notebook = nbformat::parse_notebook(&file_content) + .context("Failed to parse notebook") + .and_then(upgrade_notebook)?; this.update_in(cx, |this, window, cx| { let mut cell_order = vec![]; @@ -2053,6 +2031,19 @@ impl KernelSession for NotebookEditor { } } +fn upgrade_notebook(notebook: nbformat::Notebook) -> anyhow::Result { + match notebook { + nbformat::Notebook::V4(notebook) => Ok(notebook), + nbformat::Notebook::V4QuirksMode(notebook) => { + log::warn!("Repairing notebook cell IDs: {:?}", notebook.quirks()); + Ok(notebook.repair()) + } + nbformat::Notebook::Legacy(notebook) => nbformat::upgrade_legacy_notebook(notebook), + nbformat::Notebook::V3(notebook) => nbformat::upgrade_v3_notebook(notebook), + _ => anyhow::bail!("Unsupported notebook format"), + } +} + #[cfg(test)] mod tests { use super::*; @@ -2088,6 +2079,39 @@ mod tests { ] }"#; + #[test] + fn test_upgrade_notebook_repairs_missing_cell_ids() -> anyhow::Result<()> { + let mut value: serde_json::Value = serde_json::from_str(NOTEBOOK_WITH_ONE_CODE_CELL)?; + value["cells"][0] + .as_object_mut() + .context("cell is not an object")? + .remove("id"); + let notebook = nbformat::parse_notebook(&serde_json::to_string(&value)?)?; + assert!(matches!(notebook, nbformat::Notebook::V4QuirksMode(_))); + let repaired = upgrade_notebook(notebook)?; + let serialized = nbformat::serialize_notebook(&nbformat::Notebook::V4(repaired))?; + assert!(matches!( + nbformat::parse_notebook(&serialized)?, + nbformat::Notebook::V4(_) + )); + let saved: serde_json::Value = serde_json::from_str(&serialized)?; + assert_eq!(saved["cells"][0]["source"], value["cells"][0]["source"]); + assert!( + saved["cells"][0]["id"] + .as_str() + .is_some_and(|id| !id.is_empty()) + ); + Ok(()) + } + + #[test] + fn test_upgrade_notebook_preserves_cell_ids() -> anyhow::Result<()> { + let notebook = upgrade_notebook(nbformat::parse_notebook(NOTEBOOK_WITH_ONE_CODE_CELL)?)?; + let value = serde_json::to_value(notebook)?; + assert_eq!(value["cells"][0]["id"], "cell-one"); + Ok(()) + } + /// When the configured interpreter doesn't exist (e.g. Python isn't installed), /// running a cell must not leave it stuck in the executing state. It should /// instead surface the kernel launch error as an error output on the cell. diff --git a/crates/repl/src/outputs.rs b/crates/repl/src/outputs.rs index 54c058bb32f..bb75dbc4830 100644 --- a/crates/repl/src/outputs.rs +++ b/crates/repl/src/outputs.rs @@ -35,9 +35,9 @@ use editor::{Editor, MultiBuffer}; use gpui::{AnyElement, ClipboardItem, Entity, EventEmitter, Render, WeakEntity}; +use jupyter_protocol::{ExecutionState, JupyterMessage, JupyterMessageContent, Media, MediaType}; use language::Buffer; use menu; -use runtimelib::{ExecutionState, JupyterMessage, JupyterMessageContent, MimeBundle, MimeType}; use ui::{CommonAnimationExt, CopyButton, IconButton, Tooltip, prelude::*}; mod image; @@ -65,15 +65,15 @@ use crate::repl_settings::ReplSettings; use settings::Settings; /// When deciding what to render from a collection of mediatypes, we need to rank them in order of importance -fn rank_mime_type(mimetype: &MimeType) -> usize { +fn rank_mime_type(mimetype: &MediaType) -> usize { match mimetype { - MimeType::DataTable(_) => 7, - MimeType::Html(_) => 6, - MimeType::Json(_) => 5, - MimeType::Png(_) => 4, - MimeType::Jpeg(_) => 3, - MimeType::Markdown(_) => 2, - MimeType::Plain(_) => 1, + MediaType::DataTable(_) => 7, + MediaType::Html(_) => 6, + MediaType::Json(_) => 5, + MediaType::Png(_) => 4, + MediaType::Jpeg(_) => 3, + MediaType::Markdown(_) => 2, + MediaType::Plain(_) => 1, // All other media types are not supported in Zed at this time _ => 0, } @@ -390,42 +390,43 @@ impl Output { } pub fn new( - data: &MimeBundle, + data: &Media, display_id: Option, window: &mut Window, cx: &mut App, ) -> Self { match data.richest(rank_mime_type) { - Some(MimeType::Json(json_value)) => match JsonView::from_value(json_value.clone()) { + Some(MediaType::Json(json_value)) => match JsonView::from_value(json_value.clone()) { Ok(json_view) => Output::Json { content: cx.new(|_| json_view), display_id, }, Err(_) => Output::Message("Failed to parse JSON".to_string()), }, - Some(MimeType::Plain(text)) => Output::Plain { + Some(MediaType::Plain(text)) => Output::Plain { content: cx.new(|cx| TerminalOutput::from(text, window, cx)), display_id, }, - Some(MimeType::Markdown(text)) => { + Some(MediaType::Markdown(text)) => { let content = cx.new(|cx| MarkdownView::from(text.clone(), cx)); Output::Markdown { content, display_id, } } - Some(MimeType::Png(data)) | Some(MimeType::Jpeg(data)) => match ImageView::from(data) { + Some(MediaType::Png(data)) | Some(MediaType::Jpeg(data)) => match ImageView::from(data) + { Ok(view) => Output::Image { content: cx.new(|_| view), display_id, }, Err(error) => Output::Message(format!("Failed to load image: {}", error)), }, - Some(MimeType::DataTable(data)) => Output::Table { + Some(MediaType::DataTable(data)) => Output::Table { content: cx.new(|cx| TableView::new(data, window, cx)), display_id, }, - Some(MimeType::Html(html_content)) => match html::html_to_markdown(html_content) { + Some(MediaType::Html(html_content)) => match html::html_to_markdown(html_content) { Ok(markdown_text) => { let content = cx.new(|cx| MarkdownView::from(markdown_text, cx)); Output::Markdown { @@ -591,7 +592,7 @@ impl ExecutionView { } JupyterMessageContent::ExecuteReply(reply) => { for payload in reply.payload.iter() { - if let runtimelib::Payload::Page { data, .. } = payload { + if let jupyter_protocol::Payload::Page { data, .. } = payload { let output = Output::new(data, None, window, cx); self.outputs.push(output); } @@ -659,7 +660,7 @@ impl ExecutionView { pub fn update_display_data( &mut self, - data: &MimeBundle, + data: &Media, display_id: &str, window: &mut Window, cx: &mut Context, @@ -844,9 +845,9 @@ impl Render for ExecutionView { mod tests { use super::*; use gpui::TestAppContext; - use runtimelib::{ + use jupyter_protocol::{ ClearOutput, ErrorOutput, ExecutionState, InputRequest, JupyterMessage, - JupyterMessageContent, MimeType, Status, Stdio, StreamContent, + JupyterMessageContent, MediaType, Status, Stdio, StreamContent, }; use settings::SettingsStore; use std::path::Path; @@ -854,13 +855,13 @@ mod tests { #[test] fn test_rank_mime_type_ordering() { - let data_table = MimeType::DataTable(Box::default()); - let html = MimeType::Html(String::new()); - let json = MimeType::Json(serde_json::json!({})); - let png = MimeType::Png(String::new()); - let jpeg = MimeType::Jpeg(String::new()); - let markdown = MimeType::Markdown(String::new()); - let plain = MimeType::Plain(String::new()); + let data_table = MediaType::DataTable(Box::default()); + let html = MediaType::Html(String::new()); + let json = MediaType::Json(serde_json::json!({})); + let png = MediaType::Png(String::new()); + let jpeg = MediaType::Jpeg(String::new()); + let markdown = MediaType::Markdown(String::new()); + let plain = MediaType::Plain(String::new()); assert_eq!(rank_mime_type(&data_table), 7); assert_eq!(rank_mime_type(&html), 6); @@ -880,8 +881,8 @@ mod tests { #[test] fn test_rank_mime_type_unsupported_returns_zero() { - let svg = MimeType::Svg(String::new()); - let latex = MimeType::Latex(String::new()); + let svg = MediaType::Svg(String::new()); + let latex = MediaType::Latex(String::new()); assert_eq!(rank_mime_type(&svg), 0); assert_eq!(rank_mime_type(&latex), 0); diff --git a/crates/repl/src/outputs/table.rs b/crates/repl/src/outputs/table.rs index fc5ccaf75a5..e1d33dd03e3 100644 --- a/crates/repl/src/outputs/table.rs +++ b/crates/repl/src/outputs/table.rs @@ -55,8 +55,7 @@ //! display(df) //! ``` use gpui::{AnyElement, ClipboardItem, TextRun}; -use runtimelib::datatable::TableSchema; -use runtimelib::media::datatable::TabularDataResource; +use jupyter_protocol::media::datatable::{FieldType, TableSchema, TabularDataResource}; use serde_json::Value; use settings::Settings; use theme_settings::ThemeSettings; @@ -200,16 +199,16 @@ impl TableView { .zip(self.widths.iter()) .map(|(field, width)| { let container = match field.field_type { - runtimelib::datatable::FieldType::String => div(), + FieldType::String => div(), - runtimelib::datatable::FieldType::Number - | runtimelib::datatable::FieldType::Integer - | runtimelib::datatable::FieldType::Date - | runtimelib::datatable::FieldType::Time - | runtimelib::datatable::FieldType::Datetime - | runtimelib::datatable::FieldType::Year - | runtimelib::datatable::FieldType::Duration - | runtimelib::datatable::FieldType::Yearmonth => v_flex().items_end(), + FieldType::Number + | FieldType::Integer + | FieldType::Date + | FieldType::Time + | FieldType::Datetime + | FieldType::Year + | FieldType::Duration + | FieldType::Yearmonth => v_flex().items_end(), _ => div(), }; diff --git a/crates/repl/src/repl.rs b/crates/repl/src/repl.rs index 299641c47d8..85a27096fab 100644 --- a/crates/repl/src/repl.rs +++ b/crates/repl/src/repl.rs @@ -13,8 +13,8 @@ use std::{sync::Arc, time::Duration}; use async_dispatcher::{Dispatcher, Runnable, set_dispatcher}; use gpui::{App, PlatformDispatcher, Priority, RunnableMeta}; +pub use jupyter_protocol::ExecutionState; use project::Fs; -pub use runtimelib::ExecutionState; pub use crate::jupyter_settings::JupyterSettings; pub use crate::kernels::{Kernel, KernelSpecification, KernelStatus, PythonEnvKernelSpecification}; diff --git a/crates/repl/src/session.rs b/crates/repl/src/session.rs index 9b7bd759504..2f99fd1a210 100644 --- a/crates/repl/src/session.rs +++ b/crates/repl/src/session.rs @@ -32,12 +32,12 @@ use futures::FutureExt as _; use gpui::{ Context, Entity, EventEmitter, Render, Subscription, Task, WeakEntity, Window, div, prelude::*, }; -use language::Point; -use project::Fs; -use runtimelib::{ +use jupyter_protocol::{ ExecuteRequest, ExecutionState, InputReply, InterruptRequest, JupyterMessage, JupyterMessageContent, KernelInfoRequest, ReplyStatus, ShutdownRequest, }; +use language::Point; +use project::Fs; use settings::Settings as _; use std::{env::temp_dir, ops::Range, sync::Arc, time::Duration}; use theme::ActiveTheme;