Robin's Blog

The new iPython is awesome!

If you use Python you should use iPython.

If you use iPython, particularly if you do work with matplotlib or with parallel programming, you should use the latest release.

It. Is. Great.

For those who don’t know, iPython is a replacement console for Python that offers many improvements over the standard console. For example, everything has tab completion, syntax highlighting is available, there are many magic commands (eg. %run, %edit etc), you can run standard terminal commands simply by adding ! to the beginning (eg. !wget and much more. With the latest (admittedly still unstable) release there are two major new features:

  • Parallel Programming support – you can create a team of python worker processes which can then be, very easily, set tasks to do. It even has support for automatic load-balancing (something which even some very fancy parallel programming environments can’t do!). As nearly all computers are multicore these days, and as many scientists have access to fairly sophisticated supercomputers, this is a great step for Python
  • GUI console – you can now use iPython in a GUI. So what? you ask – I like the terminal! Well, I like the terminal too, but having a GUI means two things:
    • Tooltips – as soon as you type a function name and an open bracket a tooltip will pop up giving you the list of parameters for the function and the doc-string (or at least as much of as it which will fit).
    • Embedding of graphics – yes, now you can embed plots from matplotlib in your console just like Matlab or Mathematica users can. What’s more, you can also export the whole console session (with both the figures and the text) to a HTML file – great for teaching use (I’m already planning how I can do this…)
iPython was always great – now it’s even better!
For more details please see here, and follow SciPyTip on Twitter to get regular tips and news for SciPy users.
I haven’t had chance to try it yet, but I’m wondering whether libraries like the Python Imaging Library or Spectral Python will also be able to put figures directly into the iPython GUI terminal. Maybe I need to work on some integration for those – that’d be great for my remote sensing teaching!


Categorised as: Python

One Comment

  1. Ilan Schnell says:

    And the new ipython is already part of the Enthought Python distribution (EPD), including pyzmq, Qt and PySide.

Leave a Reply

Your email address will not be published. Required fields are marked *