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

Command to "Run cells in section" for current cell's section in notebook. #209653

Open
asford opened this issue Apr 5, 2024 · 4 comments
Open
Assignees
Labels
feature-request Request for new features or functionality notebook-toc-outline
Milestone

Comments

@asford
Copy link

asford commented Apr 5, 2024

Searched for "Run cells in section", had filed as microsoft/vscode-jupyter#15501, maybe it belongs here.

The new "Run cells in section" feature is fantastic for organizing notebooks,
particularly where you may have a section of "heavy IO" before a block of EDA or interactive analysis.

We often have notebooks with two sections:

  1. A "data load" block that loads data from a backend warehouse, potentially running some expensive post-processing.
  2. A "analysis" block, where we reshape the data, define some helper functions and run some lighter post-processing or tidy the dataset.

The "run in section" feature is great inside an analysis block, because we can easily rerun the lightweight helper definitions and generate EDA plots without triggering the heavier IO section of the notebook. Wow! Much rapid feedback. Much workflow ease. Nice.

However, unlike the (also great) "Run Precedent Cells" feature, there doesn't appear to be a way to trigger this from the command palette (and therefor keyboard shortcut) for the selected cell or section.

It would be good to add a editor command "Execute Section Cells"...

...selectable by the standard command palette
...targetable by keyboard shortcuts
...(ideally) in the extended run dropdown

...that detects the section of the currently selected cell or cells
...then runs the entire section (or sections) in the needful way (as if I clicked this on the section header in outline)

Examples of where in the UI I would expect this to show up...
image
image

I noted, in the keyboard shortcuts section, notebook.section.runCells, however this doesn't appear to have an effect when bound to a key.

@amunger
Copy link
Contributor

amunger commented Apr 11, 2024

Doesn't jupyter.runcurrentcell do this? The command name doesn't suggest it, but when I press ctrl+enter or shift+enter with multiple cells selected, those cells are run.

@asford
Copy link
Author

asford commented Apr 25, 2024

Yes, you're correct that that command has those semantics and runs multiple selected cells.

The specific ask here is to lift the "run cells in section" command,
which is currently only exposed as a dropdown from the outline view.

image

In to a command that will (conceptually):

  • Get the enclosing section of the currently selected cell.
  • Collect all the cells in that section.
  • Execute all the cells in that section.

I think this is probably equivalent to adding a command that will:

  • Identify the enclosing section(s) header for the currently selected cell(s).
  • Execute the "Run Cells in Section" logic on those sections.

@amunger amunger assigned Yoyokrazy and unassigned rebornix Apr 29, 2024
@Yoyokrazy Yoyokrazy added feature-request Request for new features or functionality notebook-toc-outline labels Apr 29, 2024
@vscodenpa vscodenpa added this to the Backlog Candidates milestone Apr 29, 2024
@vscodenpa
Copy link

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@Yoyokrazy Yoyokrazy modified the milestones: Backlog Candidates, Backlog Apr 29, 2024
@dbwtx
Copy link

dbwtx commented Aug 28, 2024

Is there any update to this? It would be very convienent to be able to map a keyboard shortcut to this functionality, and it is odd that the notebook.section.runCells shortcut doesn't work, even though the name implies it would do this desired function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality notebook-toc-outline
Projects
None yet
Development

No branches or pull requests

6 participants