0

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.

akkab
  • 401
  • 1
  • 6
  • 19
  • Do you use a specific programming language with JupyterLab (e.g. Python, Julia, R), or are you looking for language-agnostic solution to integrate with an extension (which is not really such agnostic as this would be JSON/JavaScript). – krassowski Jul 30 '21 at 10:28
  • Well, I will leave https://github.com/jtpio/ipylab just in case but this question really needs more focus. – krassowski Jul 30 '21 at 20:05
  • I am using Python in JupyterLab and I am would preferably look for a solution based on Python, as I am not that experienced with JS. – akkab Aug 03 '21 at 04:21

1 Answers1

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)

Sergio Gao
  • 311
  • 3
  • 5