jupyter / jupyter/nbformat

"norun" cell metadata

Open
#20 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
313
Forks
176
PR merge metrics
No merged PRs in 30d

Description

It occurred to me that it would be useful to have a `norun` code-cell metadata flag, that used to:
- Prevent the cell from being executed in the notebook interface when _Run All_ is chosen — you have to run the cell explicitly with shift-enter etc.
- Prevent the cell from being executed when it the notebook is included in another notebook via the `%run` magic in IPython.
- Prevent the cell from being executed when the notebook is included in other contexts, e.g. in my [NBInclude](https://github.com/stevengj/NBInclude.jl) package for including IJulia notebooks in Julia programs.

I have been thinking about [literate programming](https://en.wikipedia.org/wiki/Literate_programming) styles based on the notebook format, which is why I made NBInclude so that notebooks can be first-class collections of Julia code (as an alternative/supplement to `.jl` files). If I'm developing code in a notebook, I might want runnable code examples and tests mixed with the "production" code, but I wouldn't want those snippets to be executed along with the rest of the file when I include the file elsewhere.

The UI in the notebook could be a checkable "Skip Cell in Run All" menu item in the `Cell` menu, and perhaps the `norun` cells could be displayed slightly differently, e.g. with a darker-gray background.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.