ptpython
Python REPL build on top of prompt_toolkit
What it is and what it does
ptpython is a drop-in replacement for the standard Python REPL that adds modern terminal features: syntax highlighting via pygments, multiline editing with proper indentation handling, intelligent autocompletion through jedi, and support for both Vi and Emacs key bindings. It runs on Linux, BSD, macOS, and Windows, and can be invoked as a standalone command or embedded directly into Python applications.
The package depends on prompt_toolkit for terminal UI, pygments for syntax coloring, jedi for code completion, and appdirs for platform-aware configuration file discovery. It supports asyncio event loops for top-level await, custom color schemes, mouse input, and bracketed paste mode. You can customize behavior through a config.py file or command-line flags, and it integrates with IPython (via ptipython) and Django's shell_plus command.
Use it for:
- Replace your default Python REPL with a more productive interactive shell for daily development and exploration.
- Embed ptpython in a Python application to provide users with an advanced debugging or inspection interface.
- Use ptipython to get IPython's magic functions and shell integration alongside ptpython's UI enhancements.
- Configure Vi or Emacs key bindings to match your editor workflow in the interactive shell.
- Debug asyncio code interactively with top-level await support via the --asyncio flag.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
ptpython is an advanced interactive Python shell that replaces the standard REPL with syntax highlighting, multiline editing, autocompletion, and configurable key bindings.
Yes. ptpython is a mature, well-maintained tool with low install friction and no known vulnerabilities. The aging maintenance status (267 days since last release) is not alarming given the active repository and stable feature set. Install it if you spend significant time in the Python REPL and want syntax highlighting, autocompletion, and better editing—it's a straightforward quality-of-life upgrade.
Install
ptpython on PyPI
pip
pip install ptpythonuv
uv add ptpythonpoetry
poetry add ptpythonInstalling ptpython
Before you install
Low install friction with a pure Python wheel. Maintenance is aging—the last release was 267 days ago—but the repository remains active with recent commits and a solid user base of 5446 stars.
License in practice
Licensed under BSD (permissive), so you can use and modify ptpython freely in both open-source and commercial projects without significant legal constraints.
Quickstart
pip install ptpython
ptpython
# Or embed in your application:
from ptpython.repl import embed
embed(globals(), locals())
Requires Python 3.8 or later; config file support only works when invoking ptpython directly, not when embedded.
Verify before relying
- Whether the aging maintenance status affects stability or feature development going forward
- Performance characteristics when handling very large histories or complex autocompletion scenarios
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — appdirs, jedi, prompt_toolkit, pygments |
| Maintenance | aging — 267 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,768,201/month — #3,575 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: ptpython-3.0.32-py3-none-any.whl
Tags
More Terminals packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
richRich renders styled text, tables, progress…
permissive · top 100 on PyPI
coloramaColorama makes ANSI escape sequences for…
permissive · top 100 on PyPI
wcwidthMeasures the displayed width of Unicode strings…
permissive · top 1,000 on PyPI
ptyprocessRun a subprocess in a pseudo terminal (pty) and…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
bpythonbpython is an enhanced Python interactive…
permissive · top 15,000 on PyPI
prompt_toolkitprompt_toolkit is a Python library for building…
permissive · top 1,000 on PyPI
pyvimA Vi/Vim-like text editor implemented entirely…
permissive · top 15,000 on PyPI
click-replAdds an interactive REPL mode to Click…
permissive · top 1,000 on PyPI
ipythonIPython is an enhanced interactive Python shell…
permissive · top 1,000 on PyPI
ipython-pygments-lexersProvides Pygments syntax highlighters for…
permissive · top 1,000 on PyPI
flask-shell-ipythonReplaces Flask's default shell command with an…
unclear · top 5,000 on PyPI
find-libpythonLocates the libpython dynamic library path for…
permissive · top 5,000 on PyPI
libtmuxlibtmux provides a typed Python API to control…
permissive · top 5,000 on PyPI
cheap-reprProvides short, fast, configurable string…
permissive · top 15,000 on PyPI