summaryrefslogtreecommitdiff
path: root/cli/tools/jupyter
AgeCommit message (Collapse)Author
2024-11-13feat(node): stabilize detecting if CJS via `"type": "commonjs"` in a ↵David Sherret
package.json (#26439) This will respect `"type": "commonjs"` in a package.json to determine if `.js`/`.jsx`/`.ts`/.tsx` files are CJS or ESM. If the file is found to be ESM it will be loaded as ESM though.
2024-10-18fix(jupyter): fix panics for overslow subtraction (#26371)Bartek Iwańczuk
I don't have a reliable reproduction for it, but it makes it painful to use the Jupyter kernel with semi-frequent random panics. The completions don't always work correctly anyway, so I think it's better to just not panic here for the time being. Fixes https://github.com/denoland/deno/issues/26340
2024-10-17fix(jupyter): update to the new logo (#26353)Jeremy Tuloup
Follow-up to #26084 Update to the new logo found here: https://github.com/denoland/docs/blob/main/static/img/logo.svg
2024-10-16fix(jupyter): copy kernels icons to the kernel directory (#26084)Jeremy Tuloup
2024-10-09fix(jupyter): keep running event loop when waiting for messages (#26049)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/24421
2024-09-16refactor(permissions): split up Descriptor into Allow, Deny, and Query (#25508)David Sherret
This makes the permission system more versatile.
2024-08-20feat(cli/tools): add a subcommand `--hide-stacktraces` for test (#24095)Hajime-san
2024-08-18fix: clean up flag help output (#24686)Luca Casonato
Permission flags are unified in a clearer and concise output. Unstable flags are hidden by default with exception of the `unstable` flag itself. the remaining unstable flags can be seen with a `--help=unstable`. This also cleans up to show unstable flags only for subcommands that actually need them. Also sorts flags alphabetically, and gorups various flags together in a set of categories. --------- Co-authored-by: crowlkats <crowlkats@toaxl.com>
2024-08-15refactor: `version` module exports a single const struct (#25014)Bartek Iwańczuk
This commit rewrites the internal `version` module that exported various information about the current executable. Instead of exporting several consts, we are now exporting a single const structure that contains all the necessary information. This is the first step towards cleaning up how we use this information and should allow us to use SUI to be able to patch this information in already produced binary making it easier to cut new releases. --------- Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-07-27fix: adapt to new jupyter runtime API and include session IDs (#24762)Kyle Kelley
Closes #24737, #24437.
2024-07-23fix(upgrade): do not error if config in cwd invalid (#24689)David Sherret
``` > deno upgrade error: Unsupported lockfile version 'invalid'. Try upgrading Deno or recreating the lockfile. V:\scratch > V:\deno\target\debug\deno upgrade Looking up latest version Local deno version 1.45.3 is the most recent release ``` Closes #24517 Closes #20729
2024-07-04feat(jupyter): support `confirm` and `prompt` in notebooks (#23592)Zander Hill
Closes: https://github.com/denoland/deno/issues/22633 This commit adds support for `confirm` and `prompt` APIs, that instead of reading from stdin are using notebook frontend to show modal boxes and wait for answers. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-07-03refactor(jupyter): move ZeroMQ server to a separate thread (#24373)Bartek Iwańczuk
Moves the ZeroMQ messaging server to a separate thread. This will allow to run blocking JS code and maintain communication with the notebook frontend. Towards https://github.com/denoland/deno/pull/23592 Towards https://github.com/denoland/deno/pull/24250 Closes https://github.com/denoland/deno/issues/23617
2024-06-10fix(jupyter): Avoid panicking when `DEBUG` env var is set (#24168)Nathan Whitaker
Fixes #22050. It seems very unlikely that a user would be intending to enable deno's internal debug logs by setting the DEBUG env var. If they really want that, they can set `RUST_LOG=debug` instead.
2024-06-06refactor: remove `PermissionsContainer` in deno_runtime (#24119)David Sherret
Also removes permissions being passed in for node resolution. It was completely useless because we only checked it for reading package.json files, but Deno reading package.json files for resolution is perfectly fine. My guess is this is also a perf improvement because Deno is doing less work.
2024-05-29chore: upgrade jupyter runtimelib to 0.11.0 (#24036)Kyle Kelley
Brings in: * More fully typed structures (for when we get to implementing more) * `with_metadata`, `with_buffers`, etc. from https://github.com/runtimed/runtimed/pull/99 --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-21refactor(jupyter): use runtimelib for Jupyter structures and directory paths ↵Kyle Kelley
(#23826) 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
2024-05-08chore: enable clippy::print_stdout and clippy::print_stderr (#23732)David Sherret
1. Generally we should prefer to use the `log` crate. 2. I very often accidentally commit `eprintln`s. When we should use `println` or `eprintln`, it's not too bad to be a bit more verbose and ignore the lint rule.
2024-05-01refactor(jupyter): move communication methods out of data structs (#23622)David Sherret
Moves the communication methods out of the data structs and onto the `Connection` struct.
2024-04-24feat: Add `deno serve` subcommand (#23511)Matt Mastracci
By default, `deno serve` will assign port 8000 (like `Deno.serve`). Users may choose a different port using `--port`. `deno serve /tmp/file.ts` `server.ts`: ```ts export default { fetch(req) { return new Response("hello world!\n"); }, }; ```
2024-04-16fix(cli): TestEventSender should be !Clone (#23405)Matt Mastracci
`TestEventSender` should not be Clone so we don't end up with multiple copies of the same writer FD. This is probably not the cause of the test channel lockups, but it's a lot easier to reason about.
2024-03-26fix(kernel): Do not increase counter if store_history=false (#20848)Don Jayamanne
Fixes https://github.com/denoland/deno/issues/20847 Co-authored-by: Nathan Whitaker <nathan@deno.com>
2024-03-25chore(tests): Introduce integration tests for `jupyter` subcommand (#23074)Nathan Whitaker
Before this PR, we didn't have any integration tests set up for the `jupyter` subcommand. This PR adds a basic jupyter client and helpers for writing integration tests for the jupyter kernel. A lot of the code here is boilerplate, mainly around the message format for jupyter. This also adds a few basic integration tests, most notably for requesting execution of a snippet of code and getting the correct results.
2024-03-26fix(cli): output more detailed information for steps when using JUnit ↵Yusuke Tanaka
reporter (#22797) This patch gets JUnit reporter to output more detailed information for test steps (subtests). ## Issue with previous implementation In the previous implementation, the test hierarchy was represented using several XML tags like the following: - `<testsuites>` corresponds to the entire test (one execution of `deno test` has exactly one `<testsuites>` tag) - `<testsuite>` corresponds to one file, such as `main_test.ts` - `<testcase>` corresponds to one `Deno.test(...)` - `<property>` corresponds to one `t.step(...)` This structure describes the test layers but one problem is that `<property>` tag is used for any use cases so some tools that can ingest a JUnit XML file might not be able to interpret `<property>` as subtests. ## How other tools address it Some of the testing frameworks in the ecosystem address this issue by fitting subtests into the `<testcase>` layer. For instance, take a look at the following Go test file: ```go package main_test import "testing" func TestMain(t *testing.T) { t.Run("child 1", func(t *testing.T) { // OK }) t.Run("child 2", func(t *testing.T) { // Error t.Fatal("error") }) } ``` Running [gotestsum], we can get the output like this: ```xml <?xml version="1.0" encoding="UTF-8"?> <testsuites tests="3" failures="2" errors="0" time="1.013694"> <testsuite tests="3" failures="2" time="0.510000" name="example/gosumtest" timestamp="2024-03-11T12:26:39+09:00"> <properties> <property name="go.version" value="go1.22.1 darwin/arm64"></property> </properties> <testcase classname="example/gosumtest" name="TestMain/child_2" time="0.000000"> <failure message="Failed" type="">=== RUN TestMain/child_2&#xA; main_test.go:12: error&#xA;--- FAIL: TestMain/child_2 (0.00s)&#xA;</failure> </testcase> <testcase classname="example/gosumtest" name="TestMain" time="0.000000"> <failure message="Failed" type="">=== RUN TestMain&#xA;--- FAIL: TestMain (0.00s)&#xA;</failure> </testcase> <testcase classname="example/gosumtest" name="TestMain/child_1" time="0.000000"></testcase> </testsuite> </testsuites> ``` This output shows that nested test cases are squashed into the `<testcase>` layer by treating them as the same layer as their parent, `TestMain`. We can still distinguish nested ones by their `name` attributes that look like `TestMain/<subtest_name>`. As described in #22795, [vitest] solves the issue in the same way as [gotestsum]. One downside of this would be that one test failure that happens in a nested test case will end up being counted multiple times, because not only the subtest but also its wrapping container(s) are considered to be failures. In fact, in the [gotestsum] output above, `TestMain/child_2` failed (which is totally expected) while its parent, `TestMain`, was also counted as failure. As https://github.com/denoland/deno/pull/20273#discussion_r1307558757 pointed out, there is a test runner that offers flexibility to prevent this, but I personally don't think the "duplicate failure count" issue is a big deal. ## How to fix the issue in this patch This patch fixes the issue with the same approach as [gotestsum] and [vitest]. More specifically, nested test cases are put into the `<testcase>` level and their names are now represented as squashed test names concatenated by `>` (e.g. `parent 2 > child 1 > grandchild 1`). This change also allows us to put a detailed error message as `<failure>` tag within the `<testcase>` tag, which should be handled nicely by third-party tools supporting JUnit XML. ## Extra fix Also, file paths embedded into XML outputs are changed from absolute path to relative path, which is helpful when running the test suites in several different environments like CI. Resolves #22795 [gotestsum]: https://github.com/gotestyourself/gotestsum [vitest]: https://vitest.dev/ --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-03-11chore: enable clippy unused_async rule (#22834)David Sherret
2024-02-23refactor(cli): clean up test runner channels (#22422)Matt Mastracci
Gets us closer to solving #20707. Rewrites the `TestEventSender`: - Allow for explicit creation of multiple streams. This will allow for one-std{out,err}-per-worker - All test events are received along with a worker ID, allowing for eventual, proper parallel threading of test events. In theory this should open up proper interleaving of test output, however that is left for a future PR. I had some plans for a better performing synchronization primitive, but the inter-thread communication is tricky. This does, however, speed up the processing of large numbers of tests 15-25% (possibly even more on 100,000+). Before ``` ok | 1000 passed | 0 failed (32ms) ok | 10000 passed | 0 failed (276ms) ``` After ``` ok | 1000 passed | 0 failed (25ms) ok | 10000 passed | 0 failed (230ms) ```
2024-02-07refactor: extract out `runtime::colors` to `deno_terminal::colors` (#22324)David Sherret
2024-01-18feat(jupyter): don't require --unstable flag (#21963)Bartek Iwańczuk
This commit removes the requirement for `--unstable` flag in `deno jupyter` subcommand. The process will no longer exit if this flag is not provided, however the subcommand itself is still considered unstable and might change in the future. Required for https://github.com/denoland/deno/pull/21452
2024-01-03fix(jupyter): error message when install fails due to jupyter command not ↵David Sherret
being on PATH (#21767) We were failing silently in this scenario.
2024-01-01chore: update copyright to 2024 (#21753)David Sherret
2023-11-05refactor: unify CDP types in a single module (#21094)Bartek Iwańczuk
This commit moves all Chrome Devtools Protocol messages to `cli/cdp.rs` and refactors all places using these types to pull them from a common place. No functional changes.
2023-10-30chore: remove usage of chrono::Utc::now() (#20995)Divy Srivastava
Remove usage of Chrono's clock feature which pulls in iana-time-zone -> core-foundation
2023-10-12feat(unstable): add Deno.jupyter.display API (#20819)Kyle Kelley
This brings in [`display`](https://github.com/rgbkrk/display.js) as part of the `Deno.jupyter` namespace. Additionally these APIs were added: - "Deno.jupyter.md" - "Deno.jupyter.html" - "Deno.jupyter.svg" - "Deno.jupyter.format" These APIs greatly extend capabilities of rendering output in Jupyter notebooks. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-10-06feat(unstable): Await return from `Jupyter.display` (#20807)Trevor Manz
Allows `Jupyter.display` to return a promise. Example: ```javascript class WikiPage { constructor(public name) {} async [Symbol.for("Jupyter.display")]() { let response = await fetch("https://en.wikipedia.org/wiki/" + this.name); return { "text/html": await response.text() } } } new WikiPage("Deno_(software)") ```
2023-10-06fix(jupyter): Rename logo assets so they are discoverable (#20806)Trevor Manz
Changes logo prefix from `icon-*` to `logo-*` so they are correctly discovered by Jupyter.
2023-10-05feat(jupyter): support Deno.test() (#20778)Nayeem Rahman
2023-10-05chore: update to Rust 1.73 (#20781)林炳权
2023-10-04fix(jupyter): keep `this` around (#20789)Kyle Kelley
This fixes #20767. We were losing `this` and then when an exception was happening, it didn't show up in the output because we weren't bubbling up exceptions from within a user defined function for displaying. I thought about doing a `.call(object)` but didn't want to get in the way of a bound `this` that a user or library was already putting on the function.
2023-10-04feat(jupyter): send binary data with `Deno.jupyter.broadcast` (#20755)Trevor Manz
Adds `buffers` to the `Deno.jupyter.broadcast` API to send binary data via comms. This affords the ability to send binary data via websockets to the jupyter widget frontend.
2023-09-30feat(jupyter): send Jupyter messaging metadata with `Deno.jupyter.broadcast` ↵Trevor Manz
(#20714) Exposes [`metadata`](https://jupyter-client.readthedocs.io/en/latest/messaging.html#metadata) to the `Deno.jupyter.broadcast` API. ```js await Deno.jupyter.broadcast(msgType, content, metadata); ``` The metadata is required for [`"comm_open"`](https://github.com/jupyter-widgets/ipywidgets/blob/main/packages/schema/messages.md#instantiating-a-widget-object-1) for with `jupyter.widget` target.
2023-09-28fix(jupyter): more robust Deno.jupyter namespace (#20710)Bartek Iwańczuk
2023-09-27feat(unstable): add `Deno.jupyter.broadcast` API (#20656)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/20591 --------- Co-authored-by: Kyle Kelley <rgbkrk@gmail.com>
2023-09-23fix(jupyter): await Jupyter.display evaluation (#20646)Bartek Iwańczuk
2023-09-18fix(cli): Enhanced errors for Jupyter (#20530)Kyle Kelley
2023-09-18fix(jupyter-kernel): don't log errors from objects without a ↵Kyle Kelley
`Symbol.for("Jupyter.display")` (#20546) Fast follow up to #20537. Before: ![image](https://github.com/denoland/deno/assets/836375/8a12e83d-9008-419b-bd1f-24c0ac90afd3) After: <img width="235" alt="image" src="https://github.com/denoland/deno/assets/836375/467bf381-278e-4577-a980-7b0ddb08d2af"> --------- Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-09-18fix(cli): fetch works in Jupyter (#20552)Matt Mastracci
An op2 needs to be overloaded by an op2, not an op1.
2023-09-17feat(jupyter-kernel): accept nested objects from display calls (#20537)Kyle Kelley
Closes #20535. # Screenshots ## JSON <img width="779" alt="image" src="https://github.com/denoland/deno/assets/836375/668bb1a6-3f76-4b36-974e-cdc6c93f94c3"> ## Vegalite <img width="558" alt="image" src="https://github.com/denoland/deno/assets/836375/a5e70908-6b87-42d8-85c3-1323ad52a00f"> # Implementation Instead of going the route of recursively getting all the objects under `application/.*json` keys, I went with `JSON.stringify`ing in denospace then parsing it from rust. One of the key benefits of serializing and deserializing is that non-JSON-able entries will get stripped automatically. This also keeps the code pretty simple. In the future we should _only_ do this for `application/.*json` keys. cc @mmastrac
2023-09-17set `evalue` to a one space string for truthiness on old jupyter (#20531)Kyle Kelley
"Fixes" the exception display issue of #20524 on older versions of Jupyter that required `evalue` to be truthy. For now, until we can do proper processing of the `ExceptionDetails` this will make Jupyter Notebook 6.5.1 and below happy. This is the alternative "just work now" PR to #20530
2023-09-16feat: Add "deno jupyter" subcommand (#20337)Bartek Iwańczuk
This commit adds "deno jupyter" subcommand which provides a Deno kernel for Jupyter notebooks. The implementation is mostly based on Deno's REPL and reuses large parts of it (though there's some clean up that needs to happen in follow up PRs). Not all functionality of Jupyter kernel is implemented and some message type are still not implemented (eg. "inspect_request") but the kernel is fully working and provides all the capatibilities that the Deno REPL has; including TypeScript transpilation and npm packages support. Closes https://github.com/denoland/deno/issues/13016 --------- Co-authored-by: Adam Powers <apowers@ato.ms> Co-authored-by: Kyle Kelley <rgbkrk@gmail.com>