pdbr: Pdb with Rich Library

0.9.7 · active · verified Thu Apr 09

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.

Warnings

Install

Imports

Quickstart

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.

import pdbr

def divide(a, b):
    try:
        result = a / b
    except ZeroDivisionError:
        print("Error: Division by zero detected, entering debugger...")
        pdbr.set_trace() # Program execution will pause here
        result = 0
    return result

if __name__ == "__main__":
    print(f"10 / 2 = {divide(10, 2)}")
    print(f"5 / 0 = {divide(5, 0)}") # This call will trigger the debugger

view raw JSON →