Open brian-rose opened 1 year ago
yes, there is an issue for that
https://github.com/executablebooks/jupyter-book/issues/1691
a PR would be great
I found a simple workaround, which is to put the following in the _config.yml
file:
sphinx:
config:
nb_execution_raise_on_error: true
Context
Currently it seems that if we set in the
_config.yml
file:then notebook execution will halt when a notebook cell raises an exception. However the
jupyter-book build
process will still complete.I'm interested in the use case where we want
jupyter-book build
to report failure if there are any exceptions raised during notebook execution, rather than just giving warnings. The context is for the regular CI testing of notebook-based content for Project Pythia Cookbooks.It seems like myst-nb has the appropriate config option
nb_execution_raise_on_error
, e.g. in the docs here. But I don't see any way to pass this flag to myst-nb from jupyter-book.I'm looking at this code where the mapping between jupyter-book config keys and sphinx keys is set, and there is no mention of the
nb_execution_raise_on_error
option.Maybe this has just not yet been implemented?
Proposal
Add an option to the JupyterBook configuration like
(default to false to match the default value in myst-nb)
Pass this on to sphinx and myst-nb so the user has the option of allowing
jupyter-book build
to fail when a notebook raises an exception by settingraise_on_error: true
in the JupyterBook config file.If this is a sensible approach, I'm happy to work on PR to implement this. But it's also very possible that this functionality exists and I'm just missing something, in which case I'm happy to work on some improvements to documentation.
Tasks and updates
No response