ptpython
Interactive Python REPL with autocompletion
TLDR
Start a REPL (interactive shell)
Execute a specific Python file
Execute a specific Python file and start a REPL
Open the menu
Open the history page
Toggle paste mode
Quit
SYNOPSIS
ptpython [options] [file]
PARAMETERS
--help
Show help message and exit.
--version
Show version information and exit.
--vi
Use Vi keybindings.
--emacs
Use Emacs keybindings (default).
[file]
Execute the given Python file.
DESCRIPTION
Ptpython is an advanced interactive Python REPL (Read-Eval-Print Loop) built on top of the prompt_toolkit library. It offers features such as syntax highlighting, autocompletion, multiline editing, and support for displaying rich content. Ptpython enhances the standard Python interpreter, making it a more powerful and user-friendly tool for interactive coding, debugging, and exploration.
It aims to improve productivity for both beginner and experienced Python programmers by providing a more intuitive and feature-rich interactive environment. It's often used for quickly testing code snippets, experimenting with libraries, and interactively exploring Python codebases. Ptpython's configurability allows customization to fit different coding styles and preferences. Keybindings are also customizable to suit emacs or vim users.
Features like auto-completion show docstrings of objects. Showing the type of the object being referred to helps improve developer experience. Showing the source code location, when available, simplifies the job of exploration.
CONFIGURATION
Ptpython can be configured through a configuration file. This allows customization of key bindings, color schemes, and other aspects of the user interface. The configuration file location is typically ~/.ptpython/config.py. Check the official documentation for examples.
KEY BINDINGS
Ptpython supports both Emacs and Vi keybindings. To switch between them, use the --vi or --emacs command-line options.
Keybindings can also be defined within the configuration file allowing for extensive customization.
HISTORY
Ptpython was created to address the limitations of the standard Python REPL and other alternatives, such as IPython, by providing a more customizable and feature-rich experience built on the prompt_toolkit library. It has gained popularity due to its advanced autocompletion and its highly customizable interface. The goal was to create a modern, user-friendly REPL that leverages the capabilities of terminal-based user interfaces.