con un clic
python-debugpy
Python debugging with pdb, debugpy, and remote attach
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Menú
Python debugging with pdb, debugpy, and remote attach
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
| name | python-debugpy |
| description | Python debugging with pdb, debugpy, and remote attach |
| alwaysInclude | false |
| requiredBins | ["python3"] |
| platforms | ["darwin","linux"] |
| version | 1.0.0 |
| tenantIds | [] |
Debug Python applications using pdb (built-in), debugpy (VS Code protocol), and remote attach workflows. Covers breakpoints, post-mortem debugging, and profiling.
# Run script under pdb
python3 -m pdb script.py
# Post-mortem on crash
python3 -c "
import mymodule
try:
mymodule.run()
except Exception:
import pdb; pdb.post_mortem()
"
# Insert in source code (Python 3.7+)
breakpoint()
# Or explicitly
import pdb; pdb.set_trace()
| Command | Action |
|---|---|
n / next | Step over |
s / step | Step into |
c / continue | Continue execution |
r / return | Continue until function returns |
l / list | Show source around current line |
ll | Show full source of current function |
p expr | Print expression value |
pp expr | Pretty-print expression value |
w / where | Print stack trace |
u / up | Move up one frame |
d / down | Move down one frame |
b file:line | Set breakpoint |
cl num | Clear breakpoint |
commands num | Set commands to run at breakpoint |
interact | Start interactive interpreter in current frame |
# Break only when condition is true
import pdb; pdb.set_trace() if len(items) > 100 else None
# In pdb prompt:
# b 42, x > 10 # break at line 42 when x > 10
pip install debugpy
# Listen for attach (pauses until client connects)
python3 -m debugpy --listen 0.0.0.0:5678 --wait-for-client script.py
# Listen without waiting
python3 -m debugpy --listen 5678 script.py
# Attach to running process by PID
python3 -m debugpy --listen 5678 --pid 12345
import debugpy
# Start debug server
debugpy.listen(("0.0.0.0", 5678))
print("Waiting for debugger attach...")
debugpy.wait_for_client()
debugpy.breakpoint()
# Now run your code
main()
Connect any DAP-compatible client to the debug server:
{
"type": "debugpy",
"request": "attach",
"connect": { "host": "localhost", "port": 5678 },
"pathMappings": [
{ "localRoot": "${workspaceFolder}", "remoteRoot": "/app" }
]
}
# Profile script and sort by cumulative time
python3 -m cProfile -s cumulative script.py
# Save profile data
python3 -m cProfile -o profile.stats script.py
# Analyze saved profile
python3 -c "
import pstats
p = pstats.Stats('profile.stats')
p.sort_stats('cumulative')
p.print_stats(20)
"
pip install line_profiler
# Decorate functions with @profile, then:
kernprof -l -v script.py
pip install memory_profiler
# Decorate functions with @profile, then:
python3 -m memory_profiler script.py
# Django with debugpy
python3 -m debugpy --listen 5678 manage.py runserver --noreload
# Drop into pdb on failure
python3 -m pytest --pdb
# Drop into pdb on first failure then quit
python3 -m pytest -x --pdb
# Use debugpy with pytest
python3 -m debugpy --listen 5678 -m pytest tests/
# Expose debug port
EXPOSE 5678
CMD ["python3", "-m", "debugpy", "--listen", "0.0.0.0:5678", "app.py"]
breakpoint() over import pdb; pdb.set_trace() for Python 3.7+.--wait-for-client when you need to debug startup code.--noreload with Django to avoid debugger disconnects on file changes.PYTHONBREAKPOINT env var — it controls what breakpoint() calls.Decompose and route work through multi-agent Kanban systems
Task lifecycle management and workspace handoff for Kanban workers
Terminal-based Node.js debugging via V8 inspector protocol
Root-cause investigation methodology before applying fixes
Enforce RED-GREEN-REFACTOR TDD cycle
Extract YouTube transcripts and transform into structured content