TUI Python debugger.
Find a file
Stefan von Buddenbrock 77265cba49 Add example script for testing long-running functions
Created long_running_example.py to test debugger behavior with:
- Single slow calculation (5 second sleep)
- Multiple items processing with delays (2 seconds each)
- Breakpoints before and after long operations

This helps test how the debugger handles time.sleep() and other
blocking operations.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 13:45:26 +02:00
example_scripts Add example script for testing long-running functions 2025-11-22 13:45:26 +02:00
src/lazy_pdb Fix stepping mode being cleared when hitting breakpoints 2025-11-22 13:43:20 +02:00
tests Move test_output.py to tests directory 2025-11-22 13:28:52 +02:00
.gitignore Initial commit: Set up lazy-pdb TUI debugger project 2025-11-22 09:37:03 +02:00
CLAUDE.md Initial commit: Set up lazy-pdb TUI debugger project 2025-11-22 09:37:03 +02:00
pyproject.toml Initial commit: Set up lazy-pdb TUI debugger project 2025-11-22 09:37:03 +02:00
README.md Initial commit: Set up lazy-pdb TUI debugger project 2025-11-22 09:37:03 +02:00
uv.lock Initial commit: Set up lazy-pdb TUI debugger project 2025-11-22 09:37:03 +02:00

lazy-pdb

A modern Python debugger with a terminal user interface (TUI) built with Textual.

Features

  • Beautiful TUI for debugging Python code
  • Integrates with Python's built-in breakpoint() function
  • Can debug scripts and modules from the command line
  • Modern interface with syntax highlighting and interactive controls

Installation

Using UV (recommended):

uv pip install -e .

Or with pip:

pip install -e .

Running Without Installation

If you want to run lazy-pdb without installing it, you need to add the src directory to your PYTHONPATH:

Command-line usage

# With UV (recommended)
PYTHONPATH=src uv run python -m lazy_pdb script.py [args...]
PYTHONPATH=src uv run python -m lazy_pdb -m module.name [args...]

# Or with regular Python
PYTHONPATH=src python -m lazy_pdb script.py [args...]
PYTHONPATH=src python -m lazy_pdb -m module.name [args...]

Using with breakpoint()

# With UV (recommended)
PYTHONPATH=src PYTHONBREAKPOINT=lazy_pdb.set_trace uv run python your_script.py

# Or with regular Python
PYTHONPATH=src PYTHONBREAKPOINT=lazy_pdb.set_trace python your_script.py

Optional: Create a shell alias

Add to your ~/.bashrc or ~/.zshrc:

# With UV
alias lazy-pdb='PYTHONPATH=src uv run python -m lazy_pdb'

# Or with regular Python
alias lazy-pdb='PYTHONPATH=src python -m lazy_pdb'

Then you can use it like:

lazy-pdb script.py [args...]

Usage

Using with breakpoint()

Set the environment variable to use lazy-pdb as your debugger:

export PYTHONBREAKPOINT=lazy_pdb.set_trace
python your_script.py

Then use breakpoint() anywhere in your code:

def my_function():
    x = 42
    breakpoint()  # lazy-pdb will start here
    return x

Command-line debugging

Debug a script:

lazy-pdb script.py [args...]

Debug a module:

lazy-pdb -m module.name [args...]

Development

Install development dependencies:

uv pip install -e ".[dev]"

Run tests:

pytest

Run linter:

ruff check .

Run type checker:

ty check src/lazy_pdb