Jupyter Notebook

Manipulate Notebooks from the Command Line

See StackOverflow.

  • Execute notebook and save results

    jupyter nbconvert --execute --to notebook --inplace notebook.ipynb
    
    Copy to clipboard
  • Export notebook to .py

    jupyter nbconvert --to python notebook.ipynb
    
    Copy to clipboard
  • Export notebook to .html

    (Convert without execution)

    jupyter nbconvert --to html notebook.ipynb
    
    Copy to clipboard

    (Execute before conversion, with no execution time limit)

    jupyter nbconvert --execute --to html --ExecutePreprocessor.timeout=-1 notebook.ipynb
    
    Copy to clipboard

    (Execute before conversion and set output dir to ./html)

    jupyter nbconvert --execute --to html --ExecutePreprocessor.timeout=-1 --output-dir='./html' notebook.ipynb
    
    Copy to clipboard

Programmatically Create Jupyter Notebooks (with different parameters)

Specify parameters in the first cell of the source jupyter notebook (source.ipynb):

You can then use nbparameterise to programmatically replace input values in a notebook before running it.