LinuxCommandLibrary

ipython

Interactive Python shell for enhanced development

TLDR

Start a REPL (interactive shell)

$ ipython
copy

Enter an interactive IPython session after running a Python script
$ ipython -i [script.py]
copy

Create default IPython profile
$ ipython profile create
copy

Print the path to the directory for the default IPython profile
$ ipython locate profile
copy

Clear the IPython history database, deleting all entries
$ ipython history clear
copy

SYNOPSIS

ipython [options] [script [arguments ...]]

PARAMETERS

-h, --help
    Show help message and exit

-V, --version
    Show IPython's version number

--ipython-dir=DIR
    IPython profile directory

--profile=PROFILE
    Name of IPython profile to use

-i
    Enter interactive mode after script execution

--pdb
    Enter postmortem PDB on exceptions

-d, --debug
    Enable debug/verbose mode

--gui=GUI
    Backend for GUI event loop integration (e.g., tk, qt)

--pylab [=gui]
    Enable %pylab mode for interactive plotting

-c cmd
    Execute command as input

-m module
    Run module as a script

DESCRIPTION

IPython is a powerful interactive shell and command-line interface for Python. It provides enhanced introspection, tab completion, rich media support, and additional features like magic commands (% and %% prefixes for special functions), history management, and profiling. Designed for interactive computing, scientific computing, data analysis, and prototyping, IPython extends the standard Python REPL with syntax highlighting, auto-completion, and inline plotting via Matplotlib integration.

Key features include: tab-completion for variables, functions, and file paths; history browser (? for help, ?? for source code); magic commands like %timeit for timing code, %run for executing scripts, %pdb for debugging; and system shell access via ! prefix. It supports multiple frontends, including console, Qt, and now integrates with Jupyter notebooks.

Originally created to overcome limitations of the standard Python shell, IPython boosts productivity for developers, researchers, and educators. It can run scripts with -i flag to drop into interactive mode post-execution and supports profiles for customized environments.

CAVEATS

IPython requires Python 3.3+; Python 2 support ended with v5.0. Modern usage favors jupyter console for new projects. Some features like GUI backends may need additional packages.

MAGIC COMMANDS

Prefix with % (line) or %% (cell): %timeit, %run, %debug, %matplotlib. List with %lsmagic.

PROFILES

Custom configs in ~/.ipython/profile_name/. Auto-load startup scripts.

EMBEDDING

Embed IPython in applications via IPython.embed() for runtime debugging.

HISTORY

Developed by Fernando Pérez in 2001 at UC Berkeley as an enhanced Python shell. Reached v1.0 in 2013 with major improvements. In 2014, IPython donated its kernel to the Jupyter project; core IPython now focuses on interactive console (v8.0+ as of 2023). Widely used in scientific Python ecosystem (SciPy, NumPy).

SEE ALSO

python(1), jupyter(1), python3(1)

Copied to clipboard