🏠 back to Observable

How to run entire notebook?

#1

Is there a way to run all the cells in a notebook, as in Jupyter restart kernel and run all cells?

Run all cells sequentially?
#2

Refresh the browser. :slight_smile:

Observable notebooks are reactive, so even that will not be needed in most cases, as cells automatically recompute their values when any of the values they depend upon are changed.

Can you share a notebook with a specific example that prompted your question?

Edit: I noticed you posted this question in two separate places. It’s best to have one thread per question, so that answers can be centralized and to avoid duplication of effort.

#3

another solution is to create a “replay” button, that will send a message when clicked, then all cells that depend on it will refresh. Very useful when you want to see an algorithm unfold several times.

examples abound — see for instance https://observablehq.com/@fil/som-tsp

1 Like
#4

Jupyter notebook has an interface to run entire notebook, sequentially running all cells.

How can we do that in ObservableHQ?

#5

You could refresh the page to rerun all the cells. What’s your use case?

#6

In Observable, cells run automatically when things change, and they run in topological order (based on dependencies), rather than document order. The behavior is described here:

You can run the current cell using Shift-Enter.

1 Like
#7

Thanks, referring cell by name should help me a lot so that I can explicitly add dependencies.

In my case I wanted to demonstrate selectors by modifying the style of previously rendered HTML element via DOM, where the element itself does not automatically generate a dependency. The conceptual dependency works through DOM api, so I was running a cell the HTML element and a cell for the JavaScript code manually.