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

Scratch pad in side panel for line-by-line execution #3453

Closed
BoPeng opened this issue Dec 21, 2017 · 6 comments
Closed

Scratch pad in side panel for line-by-line execution #3453

BoPeng opened this issue Dec 21, 2017 · 6 comments

Comments

@BoPeng
Copy link
Collaborator

@BoPeng BoPeng commented Dec 21, 2017

This topic is split from #2815

The basic execution units of Jupyter are cells so there is no easy way to execute, tweak, and re-execute pieces of the code for debugging purposes (StackOverflow Question, Jupyter Issue 1094). The problem here is not how to execute parts of the cell content (which is almost trivial to implement), but where to execute the code and display the output. There is a scratchpad extension to execute scratch cells but this is still less convenient than the line-by-line execution mode in other IDEs.

Given that JupyterLab already has a side panel, I would propose that we integrate a scratchpad to the side panel and provide a shortcut for line by line execution. The following figure demonstrates how this feature works in SoS Notebook:

line by line execution

This feature should work for other kernels because no kernel-level change is needed. SoS Notebook uses shortcut Ctrl-Shift-Enter to send current line or selected text to side panel for execution although its implementation has multi-kernel and auto-preview support.

@ellisonbg
Copy link
Contributor

@ellisonbg ellisonbg commented Jan 5, 2018

Yes, this type of usage case is important. The way we are handling it in JupyterLab right now is through the Code Console, which is essentially this type of transient scratchpad or playground. You can either start a Code Console using the Launcher:

jan-05-2018 07-17-04

or using the kernel of a notebook:

jan-05-2018 07-18-26

@BoPeng
Copy link
Collaborator Author

@BoPeng BoPeng commented Jan 5, 2018

But the Code Consoles are not linked to the main notebook, right? I mean, in the scratchpad extension and in SoS Notebook, the scratch cell shares the kernel with the notebook so that it can execute statements from the main notebook. When the main notebook has

# main notebook
a = 'long_statement'

the Code Console has to repeat the statement to inspect a

a = 'long_statement'
a

while the scratch cell can simply run

a

This makes a big difference in the usability of Code Consoles without even considering the trouble to copy/paste code from notebook to Code Consoles.

@ellisonbg
Copy link
Contributor

@ellisonbg ellisonbg commented Jan 5, 2018

The Code Console can share the kernel with the Notebook. The change kernel dialog in JupyterLab for any document or activity allows you to pick kernels from any other document or activity:

screen shot 2018-01-05 at 10 00 48 am

When you use the "Create Console for Notebook" it automatically sets up a shared kernel.

@BoPeng
Copy link
Collaborator Author

@BoPeng BoPeng commented Jan 5, 2018

I see. Then a shortcut is the only missing part. How about a shortcut for

  1. Creating a code console with shared kernel if not already exist.
  2. Displaying code console if hidden (side by side with notebook?)
  3. Sending current line or selected text to code console for evaluation.

@idoDavid
Copy link

@idoDavid idoDavid commented Mar 25, 2018

@BoPeng @ellisonbg A shortcut that will do the 1,2,3 above would be great!

@BoPeng
Copy link
Collaborator Author

@BoPeng BoPeng commented Oct 3, 2019

Already implemented.

@BoPeng BoPeng closed this Oct 3, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Nov 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants