callmephilip
callmephilip3w ago

Deno + Jupyter - a couple of hiccups: jupyter execute and tests

First things first, Deno + Jupyter is amazing - kudos to the team. A couple of things that did not work out for me which I would like some more context to understand and try to fix/report on. I've originally reported on them here (https://github.com/rgbkrk/denotebooks/issues/8) and here (https://github.com/rgbkrk/denotebooks/issues/9). jupyter execute fails for certain notebooks Trying to run jupyter execute (e.g. jupyter execute --kernel_name=deno hello.ipynb) on some notebooks fails with the following error (more info: https://github.com/rgbkrk/denotebooks/issues/8):
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.11.10/x64/bin/jupyter-execute", line 8, in <module>
[.........]
line 1103, in process_message
display_id = content.get("transient", {}).get("display_id", None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.11.10/x64/bin/jupyter-execute", line 8, in <module>
[.........]
line 1103, in process_message
display_id = content.get("transient", {}).get("display_id", None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'
tests inside notebooks Failing tests inside notebooks do not cause actual runtime errors but simply print error output. This effectively means that when you run jupyter execute on a notebook, it exits normally instead of reporting an error
import { assert } from "jsr:@std/assert";

Deno.test("failing test", () => {
assert(false);
});
import { assert } from "jsr:@std/assert";

Deno.test("failing test", () => {
assert(false);
});
3 Replies
callmephilip
callmephilipOP7d ago
More context on the execute issue: https://github.com/jupyter/nbclient/issues/321 for tests, i ended up extracting cells containing Deno.test invocations into seperate test modules and testing using deno test ⬆️ this is now fixed in the latest release of nbclient
bartlomieju
bartlomieju7d ago
Can you open an issue about the test one? Seems like a rather straighforward fix
callmephilip
callmephilipOP6d ago
Sure thing. Here it is - https://github.com/denoland/deno/issues/27434. Is there anything else I can do to help?

Did you find this page helpful?