Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature-request] [jupyter] support entering a value inline, with the web standard function prompt #22633

Closed
NaitLee opened this issue Feb 29, 2024 · 1 comment · Fixed by #23592
Labels
deno jupyter Related to "deno jupyter" subcommand suggestion suggestions for new features (yet to be agreed)

Comments

@NaitLee
Copy link

NaitLee commented Feb 29, 2024

With Jupyter with ipykernel, the notebook has an input box for the Python input function:
Screenshot_20240229_200104

In Deno there’s the web standard prompt, for the same purpose as input in my mind, but with Deno as a Jupyter kernel it simply returns null instead:
Screenshot_20240229_200743
Same for Jupyter console:
Screenshot_20240229_201804

It could be better to put this function in use for Jupyter notebook, just like its behavior in Deno console and web browser :)
Screenshot_20240229_200818

@zph
Copy link
Contributor

zph commented Apr 14, 2024

I'm also interested in this functionality for deno's jupyter kernel.

Problem Statement

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.

Code Tracing

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.

@zph zph mentioned this issue Apr 14, 2024
@lucacasonato lucacasonato added suggestion suggestions for new features (yet to be agreed) deno jupyter Related to "deno jupyter" subcommand labels Jun 12, 2024
bartlomieju added a commit that referenced this issue Jul 4, 2024
Closes: #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 <[email protected]>
zebreus pushed a commit to zebreus/deno that referenced this issue Jul 8, 2024
…23592)

Closes: denoland#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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deno jupyter Related to "deno jupyter" subcommand suggestion suggestions for new features (yet to be agreed)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants