documentationshogun

Auto generate a showroom page for python notebooks


I wanted to generate a showroom page for my jupyter notebooks using a continuous integration tool like Travis.

A perfect example is Shogun's showroom page but I don't know what they are using.


Solution

  • we are using buildbot to generate it; here's the job for it: http://buildbot.shogun-toolbox.org/builders/nightly_default/builds/44

    the content of the generate notebook is pretty straightforward:

    #!/bin/bash
    
    export PYTHONPATH=$PWD/build_install/lib/python2.7/dist-packages:$PYTHONPATH
    export LD_LIBRARY_PATH=$PWD/build_install/lib:$LD_LIBRARY_PATH
    
    find $1 -type f \( -name '*.ipynb' ! -name 'template.ipynb' \) | xargs -I{} cp '{}' $3
    find $1 -type f \( -name '*.ipynb' ! -name 'template.ipynb' \) | xargs -P $2 -I{} jupyter nbconvert --ExecutePreprocessor.timeout=600 --to html --output-dir $3 --execute '{}'
    find $3 -type f -name '*.html' | xargs -P $2 -I{} python extract_image_from_html.py '{}'