pdbr is a Python debugging tool that enhances the standard `pdb` (Python Debugger) by integrating the `Rich` library, providing colorful and well-formatted terminal output. It is currently at version 0.9.7 and sees active development with frequent releases addressing compatibility and adding features. It aims to make the debugging experience more visually appealing and user-friendly by leveraging Rich's capabilities for tracebacks, variable inspection, and more.
pip install pdbrVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to insert a breakpoint using `pdbr.set_trace()`. When the `divide` function attempts division by zero, the debugger will be invoked, allowing interactive inspection of variables and program state.
Either `import pdbr` at the beginning of your script, or `os.environ["PYTHONBREAKPOINT"] = "pdbr.set_trace"` before calling `breakpoint()`.
Upgrade `pdbr` to version 0.9.2 or newer when using IPython 9.x or later: `pip install --upgrade pdbr[ipython]`.
Consult the `pdbr` documentation for the updated configuration file paths, typically moving to `~/.config/pdbr/` or similar XDG-compliant locations.
For specific thread debugging, manually instantiate `pdbr.RichPdb()` for the target thread, then call its `set_trace()` method. Example: `my_debugger = pdbr.RichPdb(); my_debugger.set_trace()`.