Fancy Completer
Fancy Completer (fancycompleter) is a Python module that enhances the interactive Python prompt with colorful, context-aware TAB completion, extending the functionality of the standard library's `rlcompleter`. It highlights different types of completions (strings, functions, numbers, etc.) with distinct colors, improving readability and user experience. The current version is 0.11.1 and it appears to be actively maintained with recent updates and discussions around its integration into CPython.
Warnings
- gotcha When enabling `fancycompleter` via a `PYTHONSTARTUP` script, the `fancycompleter.interact()` call typically uses a `sys.exit()` upon console termination. This means any Python code written *after* `fancycompleter.interact()` in the startup script might not be executed. It's recommended to place it as the last line.
- gotcha Colorized completion may not work out-of-the-box on some CPython installations, particularly older versions on Linux/OSX (< Python 3.13) that rely on GNU `readline`, as `readline` often strips escape sequences. PyPy and CPython 3.13+ are noted to work out of the box. For other CPython versions, `pyrepl` is typically installed as a dependency for colors.
- gotcha Unlike the standard `rlcompleter`, `fancycompleter` explicitly disables the behavior of automatically adding an open parenthesis `(` when completing a callable name. This is an intentional design choice to reduce annoyance.
Install
-
pip install fancycompleter
Imports
- fancycompleter
import fancycompleter
Quickstart
import fancycompleter # To start the fancycompleter-enhanced interactive console: fancycompleter.interact(persist_history=True) # Alternatively, to enable it automatically upon Python startup, # you can run 'python -m fancycompleter install' once, # which typically creates/updates your PYTHONSTARTUP script.