• Tryolabs
Read time: 3 minutes

IPython Notebook

Last PyCon US (2013) I attended, there were many interesting talks, but if I had to talk about what’s happening, what’s the trend, between other things I would mention IPython Notebook.

In a few words: it’s an excellent tool, you can have an IPython console within your web browser where you can write code snippets and run them, and also render the results within the browser (not only text, also graphics, plots, rich media, etc). These code snippets are called “cells” and in addition you can add formatted text cells between your code cells. These text cells can be used to clarify, comment and explain your code, like you would read in a book.

Moreover, you can save your notebooks in files, they are saved with an ipynb file extension. Basically it stores your code and text in a json format. Simple and powerful.

So, why it’s so cool? There are many applications, for example, in the PyCon many of the presentations where made directly with an IPython Notebook. The speaker has his/her presentation previously created with an IPython notebook, it has text to describe things, and code that can be ran on the fly to show the audience how it works. Nice. Very nice for technical presentations (and decreases the chances to suffer a demo effect) .

Not only for technical presentations, but for education, I’m thinking how useful could be for a teacher to use this tool to run code snippets with their students, and how clarifying for the students could be. In fact, I attended some tutorials at the PyCon that were taught with IPython Notebook, and as a “student” it was very useful and easy to follow, also I have the notebooks to look back at the code samples and modify or run them again.

But, there’s more, I suppose you’re like every mortal who makes some trials (not tests, trials) to check if some snippet works as expected, try some ideas, do some proof of concept, play with stuff, check the results in an interactive way, etc. Some time ago, you would use a Python console. Then perhaps you started to use an IPython console, which gave you more introspection. Now, try using an IPython notebook, save your trials, and share with the rest of the team in your project. I think it’s an excellent tool to record trials, and let others to view and execute them; they could clarify much more how your code works. Also for you, when you have to go back to an ancient code, looking at your IPython notebooks would be a good way to refresh your memory.

Personally, for my projects, I’m starting to have a separate directory within the project for my “trials” with my IPython notebooks, as one would have another directory for “tests”.

Start playing with the notebooks, and check some cool ones at http://nbviewer.ipython.org/

Enjoy IPython Notebook!


Comments powered by Disqus

Code Tips, Tricks, and Freebies. Delivered Monthly.

Signup to our newsletter.

No spam, ever. We'll never share your email address and you can opt out at any time.

Hire us

Let's build a great product together.
Get in touch with us.

Subscribe to receive news and blog updates.