IPython Notebook lets you do more than just program

Slashdot it! Delicious Share on Facebook Tweet! Digg!
bacho12345, 123RF.com

bacho12345, 123RF.com

Supernatural

The IPython Notebook environment offers much more than just the interactive execution of Python instructions. It can seamlessly integrate documents, programs, and tools with ease.

Python has always offered an interactive mode. The IPython Notebook environment constitutes an extremely multi-faceted and updated extension [1]. Besides many useful tools like direct shell commands, improved help functions, and runtime measurement for program parts, IPython Notebook connects source text with graphics, wiki-like texts, and everything that HTML5 has to offer in one interactive document. Users working with Python should not ignore the advantages of using Notebook.

Interactive Notebook

Entering python in the command line starts the so-called "Read-eval-print loop" (REPL) [2]. REPL delivers a result once a code line is entered. IPython, however, offers a much improved version of REPL. Although its origins are in the scientific community, many sys admins and developers should not do without IPython Notebook.

Using a shell has some disadvantages. In addition to the limitation of one entry per line, users struggle with the ephemeral nature of the input mechanism. The IPython Notebook does offer a command history that reaches across sessions so that, when restarting, the user can find all previously entered commands. Still, IPython Notebook is much more convenient because it saves all input. The output types can include text, HTML, images, and even GUI elements.

Getting Started

The ipython notebook command starts a new browser window when the IPython Notebook is installed (see the "Installation" box for details). You should select New and then Python 3 from the drop-down menu to open a new Notebook. Figure 1 shows the result.

Installation

The IPython Notebook works with Python2 and 3. There are several ways to install the software. If you use pip , then typing pip install "ipython[notebook]" will do the job.

If you would like to install other packages like NumPy or Pandas , then it is a good idea to use the Anaconda distribution. The guidelines for installation are described on the download site [5].

Of course, you can also use the package manager of your Linux distribution. Bear in mind though that your distribution will probably pack a significantly older version that may not support some of the features presented in this article.

Figure 1: A freshly installed Notebook.

The menus make for comfortable operation. The Kernel menu option indicates that Notebook is an active client, which is connected to a local server running on the machine. The software packages Tornado [3] and ZeroMQ [4] are at work in the background.

The first task is always to rename the file. Click on Untitled and then enter the name you have chosen in the window that opens. You will then find a <name>.ipynb file in the filesystem that contains all of the information about the Notebook in JSON format.

Buy this article as PDF

Express-Checkout as PDF

Pages: 4

Price $0.99
(incl. VAT)

Buy Ubuntu User

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content