Next: Installation
Up: IPython An enhanced Interactive
Previous: IPython An enhanced Interactive
Subsections
One of Python's most useful features is its interactive interpreter. This system
allows very fast testing of ideas without the overhead of creating test files as
is typical in most programming languages. However, the interpreter supplied with
the standard Python distribution is somewhat limited for extended interactive use.
IPython is a free software project (released under the GNU LGPL1) which tries to:
- Provide an interactive shell superior to Python's default. IPython has many features
for object introspection, system shell access, and its own special command system
for adding functionality when working interactively. It tries to be a very efficient
environment both for Python code development and for exploration of problems using
Python objects (in situations like data analysis).
- Serve as an embeddable, ready to use interpreter for your own programs. IPython
can be started with a single call from inside another program, providing access
to the current namespace. This can be very useful both for debugging purposes and
for situations where a blend of batch-processing and interactive exploration are
needed.
- Offer a flexible framework which can be used as the base environment for other
systems with Python as the underlying language. Specifically scientific environments
like Mathematica, IDL and Mathcad inspired its design, but similar ideas can be
useful in many fields.
- Dynamic object introspection. One can access docstrings, function definition prototypes,
source code, source files and other details of any object accessible to the interpreter
with a single keystroke ('?').
- Numbered input/output prompts with command history (persistent across sessions),
full searching in this history and caching of all input and output.
- Macro system for quickly re-executing multiple lines of previous input with a single
name.
- Session logging (you can then later use these logs as code in your programs).
- Session restoring: logs can be replayed to restore a previous session to the state
where you left it.
- User-extensible 'magic' commands. A set of commands prefixed with @ is
available for controlling IPython itself and provides directory control, namespace
information and many aliases to common system shell commands.
- Alias facility for defining your own system aliases.
- Complete system shell access. Lines starting with ! are passed directly to the
system shell.
- Completion in the local namespace, by typing TAB at the prompt. This works for
keywords, methods, variables and files in the current directory. This is supported
via the readline library, and full access to configuring readline's behavior is
provided.
- Automatic indentation (optional) of code as you type (trhough the readline library).
- Verbose and colored exception traceback printouts. Easier to parse visually, and
in verbose mode they produce a lot of useful debugging information (basically a
terminal version of the cgitb module).
- Auto-parentheses: callable objects can be executed without parentheses: 'sin
3' is automatically converted to 'sin(3)'.
- Auto-quoting: using ',' as the first character forces auto-quoting of the rest
of the line: ',my_function a b' becomes automatically 'my_function("a","b")'.
- Extensible input syntax. You can define filters that pre-process user input to
simplify input in special situations. This allows for example pasting multi-line
code fragments which start with '>>>'
or '...' such as those from other python sessions or the standard Python
documentation.
- Flexible configuration system. It uses a configuration file which allows permanent
setting of all command-line options, module loading, code and file execution. The
system allows recursive file inclusion, so you can have a base file with defaults
and layers which load other customizations for particular projects.
- Embeddable. You can call IPython as a python shell inside your own python programs.
This can be used both for debugging code or for providing interactive abilities
to your programs with knowledge about the local namespaces (very useful in data
analysis situations, for example).
- Easy debugger access. You can set IPython to call up the Python debugger (pdb)
every time there is an uncaught exception. This drops you inside the code which
triggered the exception with all the data live and its possible to navigate the
stack to rapidly isolate the source of a bug.
- Profiler support. You can run single statements (similar to profile.run())
or complete programs under the profiler's control.
Developed under Linux, should work under most unices (tested OK under
Solaris).
Mac OS X: it works, apparently without any problems (thanks to Jim Boyle
at Lawrence Livermore for the information).
CygWin: I would guess this environment is Unix enough for IPython to work
unchanged (any comments welcome).
Windows: It works reasonably well under Windows XP, and I suspect NT and
Win2000 should work similarly. Windows 9x support has been added but has seen very
little testing, as I don't have access to a machine with that operating system.
Please note, however, that I have very little access to and experience with Windows
development. For this reason, Windows-specific bugs tend to linger far longer than
I would like, and often I just can't find a satisfactory solution. If any Windows
user wants to join in with development help, all hands are always welcome.
MacOS Classic: it may work (I have no idea), and if not it should be reasonably
easy to port it. But someone else will have to do that, since I have no access
to a Macintosh.
IPython requires Python version 2.1 or newer. It has been tested with Python 2.2
and showed no problems.
IPython is generously hosted at http://ipython.scipy.org by the SciPy project.
This site offers downloads, CVS access, mailing lists and a bug tracking system.
I am very grateful to the SciPy team for their contribution.
Next: Installation
Up: IPython An enhanced Interactive
Previous: IPython An enhanced Interactive
Fernando Perez
2003-08-25