ipython
Interactive Python shell for enhanced development
TLDR
Start a REPL (interactive shell)
Enter an interactive IPython session after running a Python script
Create default IPython profile
Print the path to the directory for the default IPython profile
Clear the IPython history database, deleting all entries
SYNOPSIS
ipython [options] [files]
PARAMETERS
--help, -h
Display a help message and exit, showing all available options and their usage.
--version
Show program's version number and exit, providing the installed ipython version.
--profile=<name>
Specify a profile to load for custom configuration. Profiles allow users to define specific settings like startup scripts, color schemes, and backend integrations.
--script=<path>
Run the given file as a Python script within the ipython environment, enabling access to ipython's magic commands and enhanced features.
--pdb
Enable the IPython debugger (Pdb) on startup, allowing for interactive debugging of code during execution.
--gui=<backend>
Enable integration with a specific graphical user interface (GUI) event loop for interactive plotting or application development (e.g., qt, tk, gtk, wx, osx, inline).
--colors=<scheme>
Set the color scheme for syntax highlighting and output in the terminal (e.g., NoColor, LightBG, Linux).
--matplotlib[=<backend>]
Enable Matplotlib integration, allowing interactive plotting within the ipython session. An optional backend can be specified (e.g., qt, inline).
DESCRIPTION
ipython is an advanced interactive shell for the Python programming language, providing significant enhancements over the standard Python interpreter. It offers a more robust and user-friendly environment for interactive computing, data exploration, and scientific programming.
Key features include powerful introspection capabilities, comprehensive command history, intelligent tab completion for variables, functions, and files, and a rich set of "magic commands" for common tasks (e.g., %run to execute scripts, %timeit for performance timing, and ! for system shell commands). It supports rich media output in Jupyter environments and integrates seamlessly with debuggers and profiling tools. ipython is a foundational component of the broader Jupyter ecosystem, serving as the primary kernel for Python in Jupyter notebooks and providing a flexible, extensible platform for interactive scientific computing.
CAVEATS
While ipython significantly enhances interactive Python development, its unique features like magic commands are specific to the ipython environment and will not function if the code is run directly with a standard Python interpreter. For robust, production-ready applications, it's often advisable to rely on standard Python libraries and practices.
MAGIC COMMANDS
ipython introduces a powerful concept called "magic commands," which are special commands that extend the interpreter's functionality. They are prefixed with a single percent sign (%) for 'line magics' (operating on a single line) or double percent signs (%%) for 'cell magics' (operating on multiple lines of code). These commands allow users to perform various tasks such as running external scripts (%run), timing code execution (%timeit), interacting with the system shell (! or %sc), or managing variables (%who). They provide a concise and efficient way to interact with the environment without writing full Python code.
JUPYTER INTEGRATION
ipython serves as the foundational Python kernel for the Jupyter project. While ipython itself is an interactive terminal application, its kernel component is what powers Jupyter Notebooks and JupyterLab. This means that when you write and execute Python code in a Jupyter Notebook or JupyterLab environment, it's the ipython kernel running in the background, providing all the rich features like introspection, magic commands, and rich output capabilities that make Jupyter such a powerful platform for data science and interactive research.
HISTORY
ipython was originally created by Fernando Pérez in 2001, aiming to provide a more advanced and user-friendly interactive computing environment for Python than the default interpreter. It rapidly gained popularity due to its powerful features like enhanced introspection, tab completion, and the introduction of 'magic commands'. A significant milestone was the development of the IPython Notebook in 2010, which later evolved into the language-agnostic Jupyter Notebook in 2014. This led to the separation of the core ipython kernel from the notebook interface. Today, ipython continues to be actively developed as a standalone interactive shell and remains the default Python kernel for the broader Jupyter project, serving as a cornerstone of interactive scientific computing.