'"Run All Below" action in JupyterLab programatically
Is there a functionality in JupyterLab to programmatically run all the cells below a specific one? I have found this answer on StackOverflow but couldn't find out how can I integrate it into my individual JupyterLab.
Solution 1:[1]
In Jupyterlab using Python, you can create a Button (ipywidgets) to execute a script and with ipylab you can execute backend commands in frontend, like this:
from ipylab import JupyterFrontEnd
import ipywidgets as widgets
app = JupyterFrontEnd()
def run_all(ev):
app.commands.execute('notebook:run-all-below')
button = widgets.Button(description="Run all below")
button.on_click(run_all)
display(button)
The "ipylab" is more powerful than this, that can run all backend JupyterLab commands or you can create your own commands (Like a matplotlib instruction)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Sergio Gao |