forked from denoland/deno
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deno-jupyter: support confirm and prompt in notebooks
Supports `confirm` and `prompt` with custom versions used when inside a Jupyter Notebook with Deno kernel. The desired behavior (per python reference and docs): * confirm or prompt will trigger kernel to request the frontend to get user's input and return it to backend for processing We accomplish this by creating custom versions of confirm and prompt that call into an op_jupyter_input rust function with access to the stdin_socket. `confirm` and `prompt` are instantiated in the jupyter specific TS interface, so they only override the standard functions in jupyter context. Jupyter requires us to clone zmq_identities for this "input_request" message as documented in comments: ``` * Using with_identities() because of jupyter client docs instruction * Requires cloning identities per : * https://jupyter-client.readthedocs.io/en/latest/messaging.html#messages-on-the-stdin-router-dealer-channel * The stdin socket of the client is required to have the * same zmq IDENTITY as the client’s shell socket. * Because of this, the input_request must be sent with the same IDENTITY * routing prefix as the execute_reply in order for the frontend to receive the message. ```
- Loading branch information
Showing
5 changed files
with
106 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters