# IPython: The Interactive Python Shell for Developers and Researchers

> IPython extends the standard Python REPL with persistent session history, object introspection, a magic command system, and integrated debugger access. It is the foundation of the Jupyter kernel and remains the primary interactive environment for Python development outside of a notebook.

**ipython/ipython** — Official repository for IPython itself. Other repos in the IPython organization contain things like the website, documentation builds, etc.

- Repository: https://github.com/ipython/ipython
- Website: https://ipython.readthedocs.org
- Stars: 16,789 · Forks: 4,523
- Language: Python
- License: BSD-3-Clause
- Published: 2026-09-21 · Updated: 2026-09-21 · Language: en
- Canonical page: https://hysenlabs.com/projects/ipython-ipython

## What IPython Solves and Who It Targets

The standard Python REPL has three practical gaps for interactive work. It discards output history when a session ends, provides no way to inspect an object's methods without importing and calling help(), and offers no mechanism to run shell commands or time an expression without writing a wrapper script. IPython addresses all three. Every output is cached during a session with automatically generated references so you can reuse a computed result later in the same session. History is persistent across sessions: searching backward through earlier sessions is built into the shell. The magic command system exposes profiling, timing, debugging, and environment control directly at the prompt.

IPython is aimed at Python developers doing exploratory work, scientists who prototype algorithms or query data in an interactive loop, and library authors who want to embed an interactive shell inside their own applications. The README lists embeddability as a first-class feature. The project is not aimed at users who want a browser-based notebook interface: those capabilities moved to Jupyter, which the README explicitly names as a separate project built on IPython's kernel.

## The Input Transformation Pipeline and Object Introspection

IPython's core mechanism is an extensible input transformation layer that runs before Python evaluates any expression. This layer intercepts special syntax that the standard Python parser would reject. Appending `?` to any identifier triggers a docstring lookup. Appending `??` fetches the source code when it is available. Lines beginning with `!` are forwarded to the underlying system shell. Lines beginning with `%` invoke line magics, and blocks beginning with `%%` invoke cell magics that operate on the entire indented block that follows.

The README describes this as an extensible system of magic commands for controlling the environment and performing many tasks related to IPython or the operating system. The underlying architecture relies on Jedi for tab completion (declared in pyproject.toml as `jedi>=0.18.2`) and on prompt_toolkit for the interactive prompt rendering (`prompt_toolkit>=3.0.41,<3.1.0`). Syntax highlighting uses Pygments. The traitlets library powers IPython's configuration system, which the README describes as providing easy switching between different setups.

Output caching works through automatic references. The most recent output is available as `_`, the second most recent as `__`, and numbered results as `_1`, `_2`, and so on. This means a long computation that produced a value can be reused without re-running it, provided the session is still open.

## Installing IPython and Running a First Session

IPython is distributed as the `ipython` package on PyPI. The package requires Python 3.11 or newer. From setup.py: IPython 9.x supports Python 3.11 and above, following SPEC-0. Earlier minor versions of IPython 8.x supported older Python releases, but the current 9.x line does not.

Install from PyPI with:

```bash
pip install ipython
```

You can also run IPython directly from a cloned copy of the repository without installing it system-wide:

```bash
python -m IPython
```

Once running, the prompt displays `In [1]:`. Entering `import os; os.getcwd()?` (with the question mark) will print the docstring for `os.getcwd`. Running `%timeit sorted(range(1000))` measures the average execution time of that expression. Running `%run script.py` executes an external file inside the current session and makes its variables available afterward.

IPython also ships entry points `ipython` and `ipython3`, both mapped to `IPython:start_ipython` in pyproject.toml, so after installation the shell is available directly from the command line.

## Built-in Debugger Access and the Profiler

IPython provides integrated access to pdb, Python's built-in debugger, without requiring the user to insert `import pdb; pdb.set_trace()` calls into source files. The `%debug` magic drops into a pdb session at the most recent exception location. The `%pdb` magic toggles automatic pdb invocation on every unhandled exception. This is particularly useful when working with library code or with objects that are difficult to reproduce in isolation.

The profiler integration follows a similar pattern. The `%prun` magic runs a statement under cProfile and displays a sorted breakdown of call counts and cumulative time. The `%lprun` magic provides line-level profiling when the line_profiler package is installed. Both of these are available immediately at the prompt without constructing a profiling harness.

The README also notes that IPython provides access to the system shell with a user-extensible alias system. Shell aliases let you define short names for frequently used commands that are available inside the IPython session as though they were built-in functions.

## What IPython Does Not Cover: Notebook Interfaces and Kernels

IPython itself is a command-line shell. The README states explicitly: the Notebook, Qt console, and a number of other pieces are now parts of Jupyter. Anyone who wants an in-browser notebook with inline plots, multiple language kernels, or collaborative editing needs to install Jupyter separately. The IPython kernel is what Jupyter uses under the hood when running Python notebooks, but the kernel component is part of IPython while the notebook interface and server are not.

This distinction matters when choosing where to spend time. Configuring IPython magic commands, custom completers, or session logging is useful work for the shell. Configuring Jupyter widgets, cell outputs, or notebook server extensions is entirely separate work that does not touch IPython directly. The README points to `jupyter.readthedocs.io` for installation if the notebook interface is the goal.

The stack_data package (`stack_data>=0.6.0` in pyproject.toml) provides IPython's enhanced traceback rendering, which shows the local variables and the relevant source lines at the point of an exception. This is a shell-specific improvement with no equivalent in a standard notebook traceback.

## Alternatives: bpython, ptpython, and the Standard REPL

The README lists four alternatives to IPython explicitly: bpython, mypython, ptpython and ptipython, and Xonsh. The standard Python REPL is also named.

ptpython and ptipython are built on the same prompt_toolkit library that IPython uses, but they focus more narrowly on the editing experience and multi-line editing. They do not provide the magic command system or the Jupyter kernel protocol. bpython aims for an inline syntax-highlighted experience with auto-suggestion but similarly lacks the full magic command surface. Xonsh is a cross-platform shell that uses Python syntax for shell scripting, which is a different use case than interactive Python development.

The concrete difference between IPython and ptpython for a typical user comes down to ecosystem integration. IPython's magic system, including `%timeit`, `%run`, `%matplotlib`, and `%load_ext`, is documented across a large body of tutorials and libraries. Extensions written for IPython do not work in ptpython. If your workflow depends on any IPython extension or on the `%matplotlib inline` magic for display output, IPython is the only option in this list.

## Python Version Requirements, SPEC-0 Policy, and License

IPython follows the SPEC-0 scientific Python specification for determining its minimum supported Python version. SPEC-0 defines a rolling window based on Python release dates rather than a fixed lower bound. The README notes that Python 3.11 support is additionally maintained thanks to funding from the D. E. Shaw group.

As of IPython 9.x, Python 3.11 is the minimum. The setup.py documents the version history: IPython 8.13 through 8.18 supported Python 3.9 under NEP 29, and later 8.x releases required Python 3.10. Teams running Python 3.9 or earlier need to pin to an older IPython release and will not receive updates.

The license is BSD-3-Clause. The repository's COPYING.rst documents the copyright chain back to Fernando Perez and the IPython Development Team. The BSD-3-Clause license permits use in commercial applications, modification, and redistribution provided the license notice and list of conditions are preserved. There is no copyleft requirement, so IPython can be bundled in proprietary applications or embedded in closed-source tools without triggering a disclosure obligation.

## Conclusion

IPython is the right choice for any Python developer who wants a richer interactive session than the standard REPL: object inspection, persistent history, and the magic command system are available immediately after installation. Researchers and data scientists who need to prototype against live data without a browser will find it a direct fit. It is the wrong tool for anyone who wants notebooks, inline plots, or a multi-language kernel environment: that work belongs in Jupyter, which builds on IPython's kernel infrastructure. Before adopting it, verify that your project requires Python 3.11 or newer, since IPython 9.x dropped support for earlier versions following SPEC-0. The BSD-3-Clause license allows commercial use and redistribution with attribution.

## FAQ

### What is the difference between IPython and Python?

IPython is an enhanced interactive shell that runs Python code but adds features the standard Python interpreter does not have: persistent session history, tab completion powered by Jedi, object introspection with the ? and ?? postfixes, and a magic command system. The underlying language is identical; IPython adds tooling around the interactive loop, not changes to Python itself.

### What is IPython used for?

IPython is used for interactive Python development: prototyping code, exploring APIs and objects, running profiling and timing measurements with magic commands like %timeit and %prun, and debugging exceptions with integrated pdb access. It is also the kernel that Jupyter notebooks use when running Python code.

### What are the differences between IPython and Jupyter?

IPython is a command-line interactive shell. Jupyter is a separate project that builds on IPython's kernel to provide a browser-based notebook interface, support for multiple programming languages, and tools for sharing documents. The README states that the Notebook and Qt console are now parts of Jupyter, not IPython.

### How do I install IPython on my Mac?

Install IPython on macOS with pip install ipython, which requires Python 3.11 or newer. You can also run it directly from a cloned repository without installing system-wide using python -m IPython. The package is named ipython on PyPI.

## Sources

- [ipython/ipython on GitHub](https://github.com/ipython/ipython)
- [License: BSD-3-Clause](https://github.com/ipython/ipython/blob/main/LICENSE)
- [Project website](https://ipython.readthedocs.org)
- [README](https://github.com/ipython/ipython/blob/main/README.md)
- [Releases](https://github.com/ipython/ipython/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/ipython-ipython
