Is there an extension that prohibits out-of-order cell execution?

Last year at a Jupyter Community Workshop, the discussion touched on how to manage out-of-order execution. Fernando put it well (per my notes):

Out of order execution is like leaving your hammer and your screwdriver on the workbench. It’s OK, you’re getting things done, you know where it is. The problem is when you come back the next week and you don’t remember where anything is.

In the context of data acquisition where we are steering real hardware to measure real samples, the confusion resulting from out of order execution can lead to expensive mistakes. But if used well, the notebook can serve as useful guide or “walk-through” and a lab notebook recording what was done.

Is there a way to constrain users to linear, top-to-bottom cell execution? Such a tool should allow users to append cells and to skip cells, but once a cell has been executed, it should not be allowed to execute any of the cells above it (until the kernel is restarted).

Has this been done? Two related projects I know of are nodebook and gather but neither of them do precisely this.

If such an extension does not yet exist, what would the right extension point(s) be? I imagine a labextension and/or nbextension would be needed to provide UI changes, but where would the actual constraint be implemented?

1 Like

I don’t know of any such plugins, but I imagine it would depends on whether you mean just linear top to bottom execution. If so, my guess is you could make code cells non-editable and non-executable just with the UI. What I’ve done in the past to do this is by iterating through code cells using the INotebookTracker interface.

You would also need to have a sense of cell ordering within the notebook. I’m not precisely sure how you’d do that though. Especially if the user re-orders the cells.

There is a prototype for the classical notebook there