compute_notebook

nbreport.compute.compute_notebook(notebook, dirname=None, kernel_name='', timeout=None)

Compute a notebook object.

Parameters:
notebook : nbformat.NotebookNode

Notebook instance.

dirname : pathlib.Path or str, optional

Directory to use for computing the directory. If one is not provided a temporary directory is created.

kernel_name : str, optional

Name of the Jupyter kernel to use when computing the notebook. When not specified, the default Python kernel is used.

timeout : int, optional

Cell execution timeout. By default there is no timeout.

Returns:
notebook : nbformat.NotebookNode

Notebook instance with cell outputs computed.

Raises:
nbconvert.preprocessors.CellExecutionError

Raised if there is an error running the notebook itself.