Closed NaitLee closed 2 months ago
I'm also interested in this functionality for deno's jupyter kernel.
Add prompt
and input
handling in Deno’s Kernel for Jupyter Notebook integration.
The experience should match what happens in a python based Jupyter Notebook when using prompt or input functions.
Where handler lives in both deno + excxr (the source for deno's jupyter integration)
Deno: https://github.com/denoland/deno/blob/main/cli/tools/jupyter/server.rs#L347 Evcxr: https://github.com/evcxr/evcxr/blob/main/evcxr_jupyter/src/core.rs#L202 and https://github.com/evcxr/evcxr/blob/main/evcxr_jupyter/src/core.rs#L217
Handling allow_stdin
is how this is done in Jupyter and the message itself will look like:
{"user_variables":[],"code":"1\n","silent":false,"allow_stdin":true,"store_history":true,"user_expressions":{}} ]
It's beyond my current proficiency in Rust to implement and port over from excxr, but I'm happy to test it out if someone else puts up a PR.
With Jupyter with ipykernel, the notebook has an input box for the Python
input
function:In Deno there’s the web standard
prompt
, for the same purpose asinput
in my mind, but with Deno as a Jupyter kernel it simply returnsnull
instead: Same for Jupyter console:It could be better to put this function in use for Jupyter notebook, just like its behavior in Deno console and web browser :)