Testing jupyter notebooks CI

Are there any recommendations/tools to test jupyter notebooks on travis CI?

I plan to use a Project.toml to declare all dependencies and then to use the exit code of the command:

jupyter-nbconvert --to notebook --execute --output foo JuliaIntroduction.ipynb

to check for errors.

Are there any examples?
Thanks a lot.

Maybe you can use https://github.com/stevengj/NBInclude.jl instead?

Or, since I am the author of Literate.jl I have to suggest this; maybe you don’t have to test notebooks at all, instead write testable Julia source files that you generate notebooks from :slight_smile:

4 Likes

Thank for your suggestion about NBInclude.jl, however I am a bit hesitant to add a new dependency (without removing another dependency :slight_smile: )

I know about you nice work with Literate.jl, and I am sure that this will work much better with CI and version control. I will consider it for new project as the notebooks are already written.

(NBInclude is a lot more lightweight a dependency than requiring all of of Jupyter to be installed and working, and a lot less likely to break. It hasn’t been updated recently, but that’s because it is so simple that it has required hardly any maintenance — it works fine on Julia 1.2.)

4 Likes

Ok, it was not clear to me that NBInclude.jl does not depend on IJulia which makes it of course very lightweight compared to Jupiter.

If you intend to emulate running the notebooks, make sure to use softscope=true option in order to use the IJulia patch for global scope issues.

2 Likes