Hacker News new | ask | show | jobs
by fulafel 2671 days ago
Is there a way to run notebooks automatically, so you could regenerate notebooks like this after some library code changes or dependency upgrades and check that everything stillw orks?
4 comments

Yep, Jupyter notebooks have an execution API, you can find more of it here - https://nbconvert.readthedocs.io/en/latest/execute_api.html. Hosted notebooks as a service is a growing area of investment and those services presumably use this API.
I built ReviewNB [1] to see visual diff for Jupyter Notebook changes & do a code review on it (by writing comments on cell changes etc.).

One of the next feature for ReviewNB is a CI pipeline for Jupyter Notebooks on GitHub. The idea is to make it easy for users to specify notebook "tests"/"checks" that can then be run on every change.

Given the nature of Notebooks, it's a bit hard to design CI for it in a clean way, but I appreciate any inputs or use cases that you might want to see fulfilled.

[1] https://www.reviewnb.com/

There's the nbval plugin for pytest. https://nbval.readthedocs.io/en/latest/ I've used that in one of my packages (https://github.com/qucontrol/krotov) to verify example notebooks on every push, on Travis CI
At the very least you can use the command line tool to run/export them.