IPython: Python at your fingertips

Type:
Talk
Audience level:
Intermediate
Category:
Useful libraries
March 9th 2 p.m. – 2:40 p.m.

Description

IPython is widely used in the scientific community, but its various tools can be used in any context. IPython gets you as close as possible to the Python language, with an array of tools for productive work: at the terminal, in GUIs, through a web browser, and in high-level parallel computing. This talk will explain the design of IPython and provide short, hands-on demos of its main features.

Abstract

IPython started as a better interactive Python interpreter in 2001, but over the last decade it has grown into a rich and powerful set of interlocking tools aimed at maximizing developer productivity with Python while using the language interactively.

Today, IPython consists of a kernel executing user code and capable of communicating (using ZeroMQ for networking and through a well-documented protocol) with a variety of clients. This enables IPython to support, from a single codebase, a rich variety of usage scenarios through user-facing applications and an API for embedding:

  • An interactive, terminal-based shell with many capabilities far beyond the default Python interactive interpreter (this is the default application opened by the ipython command that most users are familiar with).

  • A Qt console that provides the look and feel of a terminal, but adds support for inline figures, graphical calltips, a persistent session that can survive crashes (even segfaults) of the kernel process, and more. A user-based review of some of these features can be found here.

  • A web-based notebook that can execute code and also contain rich text and figures, mathematical equations and arbitrary HTML. This notebook presents a document-like view with cells where code is executed but that can be edited in-place, reordered, mixed with explanatory text and figures, etc. A detailed review of this system can be found here.

  • A high-performance, low-latency system for parallel computing that supports the control of a cluster of IPython engines communicating over ZeroMQ, with optimizations that minimize unnecessary copying of large objects (especially numpy arrays).

In this talk, I will briefly describe IPython's architecture and will then show hands-on demos of the main applications.

An outline of the talk follows:

  • Motivation: why interactive Python and why is the default >>> shell not enough.
  • IPython basics at the terminal: the magic command system, system access, object introspection and more.
  • A rich GUI console: embedded plots, persistent help, multi-kernel control, HTML and PDF session saving.
  • The IPython web notebook: code, results, text, math and rich HTML in one document, accessible through any modern web browser.
  • Parallelism with IPython: architectural overview and simple examples of high-level parallelism that leverage the same tools and protocols as the interactive clients..

For full details about IPython including documentation, previous presentations and videos of talks, please see the project website.