1

I am trying to check if .ipynb files can be executed through cmd line, I have looked at runipy and papermill. I am more specifically looking for exit code 0, but none of the packages mentioned above check if the code fails anywhere. Papermill still returns exit code 0 even after a python exception. Are there any other packages that do this?

I am looking at something like

some_pkg execute-notebook my_notebook.ipynb

which could give me an exit code based on if the entire code is run successfully or not.

amipro
  • 378
  • 3
  • 14

2 Answers2

1

You can use the following cli instruction from the cmd line: jupyter nbconvert --execute your_notebook.ipynb

For that, you will need to install the package jupyter_contrib_nbextensions with pip install jupyter_contrib_nbextensions

This way should give you an error message if it fails.

HenriChab
  • 513
  • 1
  • 3
  • 10
1

One option is to use nbmake and pytest.

pip install pytest nbmake

pytest --nbmake **/*ipynb

Brian Spiering
  • 1,002
  • 1
  • 9
  • 18