# Python Debugpy

Debug Python with pdb, breakpoint(), post-mortem inspection, and debugpy remote or...

- Repository: https://github.com/EKKOLearnAI/ekko-studio (11634 stars)
- Category: Testing
- License: see repository
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add EKKOLearnAI/ekko-studio --skill python-debugpy -g -a claude-code -y`
Codex: `npx skills add EKKOLearnAI/ekko-studio --skill python-debugpy -g -a codex -y`
Cursor: `npx skills add EKKOLearnAI/ekko-studio --skill python-debugpy -g -a cursor -y`
Gemini CLI: `npx skills add EKKOLearnAI/ekko-studio --skill python-debugpy -g -a gemini-cli -y`

## Description

Debug Python with pdb, breakpoint(), post-mortem inspection, and debugpy remote or headless attach.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Python Debugging

Use when Python code needs interactive debugging: hidden locals, confusing state mutation, failing tests, subprocesses, long-running services, or remote attach.

Choose the smallest debugger that reaches the bad frame:

- `breakpoint()`: local code where source edits are acceptable.
- `python3 -m pdb`: launch from the beginning without editing source.
- `python3 -m pdb -c continue`: stop at an unhandled exception.
- `debugpy`: remote/headless processes, DAP clients, an existing PID, or startup races.

## Commands

```bash
python3 -m pdb path/to/script.py arg1
python3 -m pdb -c continue path/to/script.py
python3 -c "import debugpy" || python3 -m pip install debugpy
python3 -m debugpy --listen 127.0.0.1:5678 --wait-for-client path/to/script.py
python3 -m debugpy --listen 127.0.0.1:5678 --wait-for-client -m package.module
python3 -m debugpy --listen 127.0.0.1:5678 --pid <pid>
```

Source-edit attach:

```python
import debugpy

debugpy.listen(("127.0.0.1", 5678))
debugpy.wait_for_client()
debugpy.breakpoint()
```

Post-mortem inspection:

```python
import pdb
import sys

try:
    run()
except Exception:
    pdb.post_mortem(sys.exc_info()[2])
    raise
```

## pdb commands

- Flow: `n`, `s`, `r`, `c`, `q`.
- Stack and source: `w`, `u`, `d`, `a`, `l`, `ll`.
- Values: `p expr`, `pp expr`, `display expr`.
- Breakpoints: `b file.py:42`, `b func`, `b file.py:42, condition`, `cl <num>`.
- Evaluate or mutate: `!statement`; full REPL: `interact`.

## Rules

The rest: https://github.com/EKKOLearnAI/ekko-studio/blob/HEAD/packages/ekko-agent/skills/python-debugpy/SKILL.md
