pdb++ (pdbpp)
pdb++ (pdbpp) is a robust, drop-in replacement for the standard Python debugger, `pdb`. It enhances the debugging experience with features like colorful TAB completion (via fancycompleter), optional syntax highlighting (via Pygments), a persistent 'sticky' mode that always shows the current code context, and smart command parsing. It aims for full compatibility with `pdb` while adding significant quality-of-life improvements. The current version is 0.12.1, with ongoing maintenance and updates.
Warnings
- gotcha Leaving `pdb.set_trace()` calls in production code will halt program execution unexpectedly. Always remove or comment out breakpoints before deploying.
- gotcha pdb++'s 'smart command parsing' prioritizes local variables over debugger commands if they share the same name (e.g., a variable `c` vs. the `continue` command).
- breaking Older versions of `pdbpp` experienced compatibility issues with `python -m pdb` when running on Python 3.11 and newer versions.
- gotcha When `pdbpp` is used in remote debugging setups (e.g., with `remote-pdb`), advanced features like 'sticky mode' and TAB completion may not function correctly due to terminal environment differences.
- gotcha Some online resources might suggest that `pdbpp` is unmaintained. This is often a misunderstanding; while `pdbp` (a separate project) builds upon `pdbpp` and offers its own enhancements, `pdbpp` itself continues to be actively maintained with recent releases and GitHub activity.
Install
-
pip install pdbpp -
conda install -c conda-forge pdbpp
Imports
- set_trace
import pdb; pdb.set_trace()
Quickstart
import pdb
def my_function(a, b):
result = a + b
pdb.set_trace() # Execution will pause here
return result
if __name__ == '__main__':
print(my_function(5, 3))