How to share an IPython notebook
Run notebook server:
or, if you use matplotlib,
ipython2 notebook --pylab inline
You need to install python2-tornado to use notebooks (it's an optional IPython dependency).
An app page will open.
- Create a notebook.
- Use it as usual. It is more or less similar to normal IPython.
When ready to publish:
- choose File -> Save in the notebook menu
- in the directory where you run the notebook, find .ipynb file (or do File -> Download as -> IPython (.ipynb)); it is a JSON file
- paste this JSON on http://gist.github.com/ or other pastebin service
- go to http://nbviewer.ipython.org/ and insert Gist's URL (any public URL works)
- et voilà!
- https://gist.github.com/2352771 ⇒ http://nbviewer.ipython.org/2352771/
I just tried it (https://gist.github.com/3793147 ⇒ http://nbviewer.ipython.org/3793147/). It works for me with IPython 0.13.
Update 2015-10-06: Since this year, GitHub is rendering IPython/Jupyter notebooks directly (both on GitHub repository and on GitHub Gists): http://blog.jupyter.org/2015/05/07/rendering-notebooks-on-github/