Being even more productive with IPython notebooks

IPython notebooks are an awesome tool for exploring data. Currently there are a few issues with the software which the community are working through.


Particularly useful is the ability to be able to create slides from your notebooks using reveal.js:

python3 nbconvert --to slides BeigeBook.ipynb --post serve

But we need to follow these steps in order for the formatting to work correctly:

  1. Add this custom.css file:
  2. Run this little snippet:
  3. Add ?print.pdf to the end of the url
  4. Print to pdf, use Landscape orientation


The JSON format of IPython notebooks is great, however there is no need to save Base64 encoded binary data in Git. We can strip out the binary blobs with Git filters. Add the following somewhere on your path:, then add the following in .git/config:

[filter "stripoutput"]
    clean = "/path/to/nbstripout"

And a .gitattributes file in your project root with the following contents:

*.ipynb filter=stripoutput

You will not notice any changes to your local .ipynb file when you commit (as the content is being filtered, not replaced as a pre-commit hook would do). Once committed, delete the file and checkout again and you will see a .ipynb file sans output. Also the numbering of cells will start continuously from 1 - great!