Interactive Interpreter

Interactive Python interpreters (REPL).

Exploring code is easier in IPython than in the default Python interactive interpreter. Jupyter Notebook mixes code with notes and plots.

How to choose:

  • A better terminal prompt, with help on any object and magic commands: IPython
  • Code, notes, and plots in one shareable document: Jupyter Notebook
  • A reactive notebook saved as a Python file you can run as a script or app: marimo
  • A terminal REPL with syntax highlighting, multiline editing, and Vi or Emacs keys: ptpython

Listed in editorial order. Click a column header to re-sort the whole list.

Press / to search. Tags open their category. Click a row for details.

Search and filter

Results

Row number Tags
A powerful interactive Python shell, and the kernel behind Jupyter notebooks.
ipython/github.com/ipython/ipython /16,796 stars /
A web-based notebook environment for interactive computing.
Also see: awesome-jupyter
jupyter/github.com/jupyter/notebook /13,460 stars /
A reactive notebook for Python, stored as pure Python and runnable as a script or app.
marimo-team/github.com/marimo-team/marimo /23,367 stars /
Advanced Python REPL built on top of the python-prompt-toolkit.

Interactive Interpreter guide

IPython takes whatever you'd type at the standard Python prompt and adds tab completion, object introspection, and system shell access. Its tutorial covers the everyday commands: object? shows an object's details, Tab after object_name. lists its attributes, and ! runs a shell command. Magic commands start with %: %timeit times a statement, %run runs a script and loads its variables into your session, and %debug opens the debugger after an exception.

Start Jupyter Notebook with jupyter notebook, which runs a server on your machine and opens the app in your browser. Its docs suggest you work on a problem in pieces: put related ideas into cells, and move on once the earlier ones work. Python code runs in IPython, the default kernel. Notebooks are saved as .ipynb files, and nbconvert turns them into HTML, PDF, or slides.

marimo is a reactive notebook: run a cell, and marimo runs the cells that depend on it, so code and outputs stay consistent. Each notebook is stored as a plain Python file, so you can diff it in Git, run it as a script with python, or serve it as an app with marimo run. That model comes with two rules. Each global variable is defined in only one cell, so prefix a scratch variable with _ to keep it local to its cell. And since marimo doesn't track mutations, mutate an object only in the cell that creates it. Unlike a Jupyter notebook, a marimo file doesn't store outputs like plots, and IPython magic commands and ! shell commands don't work in it.

ptpython is a better Python REPL for the terminal, built on prompt_toolkit. It adds syntax highlighting, multiline editing where the up arrow works, autocompletion, Vi or Emacs key bindings, and a configuration menu. Run ptpython to start it, or ptipython to add IPython's magic functions and shell integration.

Both terminal REPLs can also open inside your program, with that scope's variables at hand: call IPython.embed(), or ptpython's embed(globals(), locals()). For more Jupyter tools, see awesome-jupyter.

Know a project that belongs here?

Tell us what it does and why it stands out.