how to interrupt & restart kernel, then run 1st cell automatically #16445
takbal
started this conversation in
Tips, Tricks and Workarounds
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Sharing in case somebody else also suffering with this.
I organize my Python notebooks so that the first cell initializes the environment, and imports code from the libraries I am working on. Edits in the libraries are not refreshed in the kernel instance, so I need to restart whenever I modify the code outside the notebook.
This means that, during my work somewhere in the middle of the notebook, I find myself unhealthy times clicking on (optionally) interrupt, restart, then scrolling up to the top - which is painfully slow due to often skipping large figures - click execution on the first cell, then scroll back to the place I was. All extremely annoying. Perhaps the execution group feature in powertoys is intended to fix this, but it seems broken for me, and it is still three button presses.
Spending a day on this, I finally found a workaround keybind, using the seriously under-documented commands of the extension:
{ "key": "ctrl+shift+space", "command": "runCommands", "args": { "commands": [ "jupyter.interruptkernel", "jupyter.restartkernel", { "command": "notebook.cell.execute", "args": { "ranges": [{ "start": 0, "end": 1 }] } } ] }, "when": "notebookEditorFocused" }
Beta Was this translation helpful? Give feedback.
All reactions