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] [file]

PARAMETERS

--autoedit
    Automatically open files edited with %edit in an external editor.

--colors
    Specify color scheme (NoColor, LightBG, Linux, Neutral).

--config-dir
    Use a different config directory.

--debug
    Show extra debugging information.

--existing
    Connect to an existing kernel.

--gui
    Enable GUI event loop integration (e.g., qt, gtk, wx, tk).

--matplotlib
    Configure matplotlib integration (e.g., inline, notebook).

--profile
    Launch with a specific profile.

--quick
    Enable quick startup.

--version
    Show IPython's version number and exit.

[file]
    Execute a Python file after startup.

DESCRIPTION

IPython provides a rich architecture for interactive computing with: A powerful interactive Python shell. A kernel for Jupyter. Support for interactive data visualization and use of GUI toolkits. Flexible, embeddable interpreters to load into your own projects. Easy to use, high performance tools for parallel computing.

IPython is designed to maximize your productivity in both interactive exploration and development. It encourages an 'execute-explore-repeat' workflow, replacing the conventional 'edit-compile-run' cycle. This is accomplished by giving you a powerful environment for data analysis, scientific computing, and general-purpose Python development. It offers features beyond the standard Python interpreter, such as tab completion, object introspection, magic commands, and a rich history mechanism. It's especially useful within Jupyter notebooks, providing the computational backend. It is commonly used by data scientists, researchers, and developers who need an efficient and interactive Python environment.

MAGIC COMMANDS

IPython offers 'magic commands' which are special functions prefixed with '%' or '%%'. They provide shortcuts for common tasks, such as measuring execution time (%timeit), running external commands (!), and loading code from files (%load). Line magics (%) operate on a single line, while cell magics (%%) operate on an entire cell in a Jupyter notebook.

OBJECT INTROSPECTION

IPython's introspection capabilities allow you to quickly inspect the properties and methods of Python objects using '?' and '??'. For example, typing 'object?' will display information about the object, while 'object??' will display its source code (if available). This is invaluable for understanding how code works and exploring unfamiliar libraries.

HISTORY

IPython was originally created by Fernando Perez in 2001 as a better interactive Python shell. It grew from a personal project into a widely used tool for scientific computing and data science. The development of the Jupyter Notebook evolved from IPython, expanding its capabilities into a full-fledged interactive computing environment.

Initially focused on improving interactivity and usability, IPython gradually incorporated features like tab completion, history, and magic commands to enhance the user experience. Over time, it integrated more deeply with scientific libraries such as NumPy, SciPy, and matplotlib, becoming a central component in the Python scientific ecosystem. The project benefited from community contributions and open-source development practices to improve over time. Today, IPython continues to evolve, with ongoing efforts to refine performance, expand its features, and improve its integration with the broader scientific computing community.

SEE ALSO

python(1), jupyter(1)

Copied to clipboard