Add :no-execute: to cell metadata and write a nbconvert pre-parser to skip execution as an alternative to the current implementation of :class: no-execute.
class MyExecutePreprocessor(nbconvert.preprocessors.ExecutePreprocessor):
def preprocess_cell(self, cell, resources, cell_index):
"""
Executes a single code cell. See base.py for details.
To execute all cells see :meth:`preprocess`.
Checks cell.metadata for 'execute' key. If set, and maps to False,
the cell is not executed.
"""
if not cell.metadata.get('execute', True):
# Don't execute this cell in output
return cell, resources
return super().preprocess_cell(cell, resources, cell_index)
[ ] For the .. jupyter:: directive we can add :allow-error: for cell-blocks that should execute (when compiling the website) but don't execute when running the coverage test suite. In the future we could add error types such as ValueError to catch only specific error types etc. For now it will be just a boolean flag. It is also pretty self explanatory.
Add
:no-execute:
to cell metadata and write anbconvert
pre-parser to skip execution as an alternative to the current implementation of:class: no-execute
.(as per: https://stackoverflow.com/questions/26494747/simple-way-to-choose-which-cells-to-run-in-ipython-notebook-during-run-all/43584169)
.. jupyter::
directive we can add:allow-error:
for cell-blocks that should execute (when compiling the website) but don't execute when running thecoverage
test suite. In the future we could add error types such asValueError
to catch only specific error types etc. For now it will be just a boolean flag. It is also pretty self explanatory.