Tweets by @spascoe

Blogging with IPython-notebook

I have a new blogging engine to play with. This time I'm going with Pelican which generates static HTML, making it very easy to redeploy. So far I've been stunned at how quickly I can pull content into this blogging system. In particular it was very easy to convert IPython notebooks into blog entries. This is just perfect for me as I'm finding doing ad-hoc analyses in IPython to be a great way of communicating my work. So here's a quick recipe for turning a notebook into an article in Pelican.

  1. Convert the .ipynb file into reStructuredText with nbconvert. I'm using the github master right now. I know the code is being completely redone now IPython has funding but for simple notebooks with code snippets and embedded images the stable branch works fine.
  2. Copy the resulting .rst file into your Pelican content directory.
  3. Copy the <notebook-name>_files directory into somewhere which is configured as one of your STATIC_PATHS in pelicanconf.py
  4. Edit the .rst file to add any article metadata and otherwise clean up the content. This is a lot easier to do in reStructuredText than it would be in html. Also convert all image references to use the linking content feature of Pelican.

You can see the results right here.

Comments !

blogroll

social