At Quantego, we do most high-level work that supports energy analysts in Jupyter Notebooks. This allows us to pull several Java and Python packages together for a highly productive work environment.
Sample notebooks are hosted on Github and distributed with our Docker images. Of course we prefer for our sample notebooks to work, when people run them. They also uncover potential problems, by running at a very high level and thus using almost all available features.
If you have a similar setup – for example in a data analytics-driven environment – the following could work for you as well:
- Make sure your notebooks run correctly when running “Run All”. When testing you may try different things and run cells out of order. For automatic testing to work, they should run all in sequence.
- Test locally with
jupyter nbconvert --to=html --ExecutePreprocessor.enabled=True my-notebook.ipynb
This will convert your notebooks to HTML. We’re not intersted in the output, only potential errors during conversion. This only works with Jupyter and iPython >=4. Previous versions simply ignore errors.
- Next you could just run the same command in an isolated Docker container or in a CI step
docker run my_container /bin/sh -c \ "/usr/local/bin/jupyter nbconvert \ --to=html --ExecutePreprocessor.enabled=True \ --ExecutePreprocessor.timeout=3600 \ samples/my-sample.ipynb"