pydoit_nb.notebook_run#
Notebook running
NotebookExecutionException#
rewrite_notebook_default#
- rewrite_notebook_default(raw_notebook, unexecuted_notebook, fmt='ipynb')[source]#
Re-write notebooks from raw to unexecuted
This is our default implementation to use in
run_notebook().- Parameters:
raw_notebook (
pathlib.Path) – Path from which to read the raw notebookunexecuted_notebook (
pathlib.Path) – Path in which to write the unexecuted notebookfmt (
str) – Format in which to write the unexecuted notebook
- Return type:
run_notebook#
- run_notebook(raw_notebook, unexecuted_notebook, executed_notebook, notebook_parameters=None, notebook_rewriter=None, notebook_executor=None)[source]#
Run a notebook
This loads the notebook
raw_notebookusing jupytext, then writes it as an.ipynbfile tounexecuted_notebook. It then runs this unexecuted notebook with papermill, writing it toexecuted_notebook.- Parameters:
raw_notebook (
pathlib.Path) – Notebook from which to startunexecuted_notebook (
pathlib.Path) – Where to write the unexecuted notebookexecuted_notebook (
pathlib.Path) – Where to write the executed notebooknotebook_parameters (
typing.Optional[dict[str,str]]) –Parameters to pass to the target notebook
These parameters will replace the contents of a cell tagged “parameters”. See the papermill documentation for more information about parameterizing a notebook.
notebook_rewriter (
typing.Optional[typing.Callable[[pathlib.Path,pathlib.Path],None]]) – Function to use to re-write the raw notebooks as unexecuted notebooks that can be executed by notebook_executor. We use jupytext for this (specificallyrewrite_notebook_default()) by default and you shouldn’t need to change this.notebook_executor (
typing.Optional[typing.Callable[[pathlib.Path,pathlib.Path,dict[str,typing.Any]],typing.Any]]) – Function to use to execute the notebooks. We use papermill.execute_notebook for this by default and you shouldn’t need to change this.
- Return type: