Skip to main content

IPython In Depth

Brian Granger (Cal Poly San Luis Obispo), Fernando Perez (UC Berkeley and Lawrence Berkeley National Laboratory)
Data Science
Ballroom E
Tutorial Please note: to attend, your registration must include Tutorials on Tuesday.
Average rating: ****.
(4.44, 9 ratings)

Tutorial Prerequisites

Users should have basic knowledge of the Python programming language and the terminal/command prompt.

During the tutorial, attendees are strongly encouraged to follow along with the content on their own laptops. To do this, they will need to have IPython and all of its dependencies installed. The easiest way of getting all of these things is using the Anaconda Python distribution that can be downloaded for free here:

https://store.continuum.io/cshop/anaconda/

This distribution includes IPython 1.1 (with the Notebook and Parallel computing tools) along with 100+ other popular Python packages for data science and visualization. This download is large (275MB) so attendees should download+install it before coming. It is installed in a single directory that can be deleted after the tutorial if desired.

It is important that attendees have IPython 1.1 and not our latest pre-release of 2.0, which has many changes that will not be covered in this tutorial.

The tutorial content itself can be found in this git repo on GitHub:

https://github.com/ipython/ipython-in-depth

This contains all of the lectures/examples in the form of IPython Notebooks. We will continue to update this repo as the tutorial approaches.

We will spend a few minutes at the beginning of the tutorial making sure that everyone has IPython installed and working.

Tutorial Description

IPython started in 2001 simply as a better interactive Python shell. Over the last decade it has grown into a powerful set of interlocking components that maximize developer productivity while working interactively with code and data. These components include:

  • The IPython Kernel: a standalone process that executes user’s code, provides features for namespace manipulation/introspection and returns output in various formats using a well specified message protocol. This is the foundation of the IPython architecture and any of the following user interfaces can connect to a kernel to leverage its capabilities.
  • The IPython Shell: an enhanced interactive shell for Python. This provides a terminal-based user interface to the Kernel for interactive work and is the traditional IPython command line experience.
  • The IPython Qt Console: provides the look and feel of a terminal, but adds support for inline plotting/figures, graphical tooltips, persistent sessions and can be embedded in other Qt applications.
  • The IPython Notebook: a web based interactive computing environment that can execute code on server-side IPython Kernels and allows the user to author documents that contain live code and its output, text, JavaScript/HTML, equations, figures and videos. These documents, which tell the complete story of a computation, can be shared online, version controlled and converted to different formats.
  • NBViewer: a website for sharing and viewing IPython Notebook online
  • NBConvert: a tool for converting IPython Notebooks to different formats including static HTML, LaTeX, slideshows, PDF, etc.
  • IPython.parallel: A high-performance, low-latency system for parallel computing that supports the control of a cluster of IPython Kernels running on a large cluster or in the cloud. This allows parallel computations to be done interactively and reproducibly from any of the IPython user interfaces, including the Notebook.

In this hands-on, in-depth tutorial, we will briefly describe IPython’s architecture and will then show how to use the above components for a highly productive interactive computing workflow in Python.

An outline of the tutorial follows:

  • Core IPython: Interactive use with the terminal-based Shell and Qt Console. IPython basics: magic commands, shell aliases, system shell access, the history system, variable caching, object introspection tools. Development workflow: combining the interpreter session with python files via the %run command, timing, profiling, debugging.
  • The IPython Notebook: Interactive usage of the notebook: The IPython display protocol: defining custom display methods for your own objects (HTML, Images, JavaScript). Integration with plotting and visualization libraries. Building and using interactive widgets that communicate between Python and JavaScript using JSON data.
  • NBConvert: Converting notebooks to other formats for sharing, blogging and publication. Command line and programmatic conversions.
  • Configuring IPython: How to configure and customize IPython’s various components using configuration files, extensions and command line options. IPython configuration profiles.
  • Parallelism with IPython: Description of the basic architecture and a few examples of its usage. This tutorial will not have time to go into much detail on this topic.

This tutorial will be very hands-on, with students encouraged to install IPython on their laptops and follow along with examples and exercises. It will be presented by two IPython core developers and project leaders.

Photo of Brian Granger

Brian Granger

Assistant Professor, Cal Poly San Luis Obispo

Brian Granger is an Assistant Professor of Physics at Cal Poly State
University in San Luis Obispo, CA. He has a background in theoretical
atomic, molecular and optical physics, with a Ph.D from the University of Colorado. His current research interests include quantum computing, parallel and distributed computing and interactive computing environments for scientific and technical computing. He is a core developer of the IPython project and is an active contributor to a number of other open source projects focused on scientific computing in Python. He is @ellisonbg on Twitter and GitHub.

Photo of Fernando Perez

Fernando Perez

Associate Researcher, UC Berkeley and Lawrence Berkeley National Laboratory

Fernando Pérez is a research scientist at UC Berkeley, working at the
intersection of brain imaging and open tools for scientific computing. He
created IPython while a PhD student in Physics at the University of Colorado in
Boulder. Today, with all the hard work done by a talented team, he continues
to lead IPython’s development as the interface between the humans at the
keyboard and the bits in the machine.

He is a founding member of NumFOCUS, a PSF member, and received the 2012 Award for the Advancement of Free Software for IPython and contributions to
scientific Python.

Comments on this page are now closed.

Comments

Picture of Brian Granger
Brian Granger
02/04/2014 1:14am PST

Only a very basic level of Python knowledge is required. If you have installed the Notebook and played with it, you should be fine.

Picture of Eric Pugh
Eric Pugh
02/03/2014 9:23pm PST

How much Python expertise is required? I’m more of a Rubyiest, but I’ve at least installed iPython and slightly played with it. How much of a background do you expect?