Josh Barratt's Blog

A collection of uploaded thoughts

Herding IPython Notebooks February 27, 2014

I’ve recently been using IPython Notebook a lot. Enough that, if it was a chemical substance, people might be thinking about staging an intervention.

It’s the ideal tool for a lot of the work I end up doing – ad-hoc data analysis (and conversion), illustrated examples of techniques, coaching/training, and so on.

One issue that it currently has (at least in the stable v1 series) is that you run an ipython notebook in a directory, and that lets you see all your notebooks just in that directory. This is actually really nice for keeping your work separate; keep a few notepads for python experiments in a private repo, keep the notepads you’re using for a given work project in another, and so on.

However, I hit the situation enough that I hopped into a directory of notebooks and wondered ‘am I already running a notebook server here?’ that I created a quick tool, that I share with you, dear reader.

You can grab nblist from as a gist, and drop it in an executable directory.

It allows you to do

$ nblist | /Users/me/work/notebooks | /Users/me/work/otherproject | /Users/me/work/employer/thirdproject

in a terminal. Bonus tip: ⌘–click on a URL in will open it in the default system browser.

Update 2014-08-22: My original version of nblist was OSX only and depended on scraping through processes, looking at their environments, and checking which had open ports –which worked, but was janky. Thanks to some feedback from Thomas Kluyver on the mailing list, it’s been improved so it will work on all POSIX systems using techniques that will be exposed in IPython 3.x.