ipynb2viewer - Afternoon hack

ipython nbconvert has lot of handy options to convert ipynb to markdown, html etc… But I wanted to upload ipynb to gist.github.com and create a link in nbviewer.ipython.org. Started with curl and soon realized, it is getting messy. So wrote a small python program ipynb2viewer, Source code.

Install

  • pip install ipynb2viewer

Usage

Upload all ipynb files in the given path to gist.github.com and return nbviewer urls.

  • ipynb2viewer all <path>

Upload mentioned file to gist.github.com and return nbviewer url.

  • ipynb2viewer file <filename>

Upload mentioned file to gist.github.com and open nbviewer url in webbrowser.

  • ipynb2viewer file <filename> --open

Upload all ipynb files in the given path to gist.github.com and open nbviewer urls in webbrowser.

  • ipynb2viewer all <path> --open

Example

➜  ipynb2viewer git:(master) ipynb2viewer all tests --open

Uploaded test.ipynb file to gist https://gist.github.com/8081202
nbviewer url: http://nbviewer.ipython.org/gist/anonymous/8081202
Uploaded try.ipynb file to gist https://gist.github.com/8081203
nbviewer url: http://nbviewer.ipython.org/gist/anonymous/8081203

See also

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Powered by Buttondown.