iPyNbViewer: Standalone App for IPython Notebook

If you love IPython Notebook, you probably find it annoying that there is no standalone offline app to open .ipynb files. You need to open a terminal, switch to the folder, and exec a command:

ipython notebook your_ipynb_file.ipynb

I wrote an Applescript-based app to solve this inefficiency. It does two things:

  1. When you directly launch it, it will open a dialog to ask you if you want to open an existing .ipynb file or start a notebook session in a “folder”.
  • If “file”, a Finder dialog will show up for you to locate your file, then open the .ipynb file you choose in iTerm2 and your default browser.
  • If “folder”, a Finder dialog will show up for you to locate your working folder, an ipython notebook session will be launched from that folder.
  1. When you click a .ipynb file, and choose this app iPyNbViewer to open it (can be setup as “always”), it will launch iTerm2 and your default browser to open the file.
notebook
Download

Download iPyNbViewer (Mac OS X only)

Requirement: iTerm2.

Update 06.21.2016:

Robin Dinse noticed me that:

I’ve updated the script to be compatible with the latest version of iTerm2 (3.0.0). I haven’t thoroughly tested it and most of it is adapted from the Alfred TerminalFinder Workflow, but it should give an idea about what changed in the iTerm AppleScript API.

Here is the code he sent me. I haven’t tested yet. Once I tested, I will update the app.

07.17.2016 I have reviewed, tested, and revised his code. I changed every ipython notebook to jupyter notebook. Now the updated downloadable app v3.1 contains the following code:

Update 09.17.2015:

Dan Hickstein noticed me that:

You should change “POSIX path” to “quoted form of POSIX path” in the script. Then it will work even if there are spaces in the filename.

I have updated the code below as well as the downloadable app above.

For your interest, the code is below: