python-debugpy

Debug Python code using pdb breakpoints, post-mortem inspection, and debugpy remote DAP attach.

Updated Sep 10, 2026
One-click install
npx skills add https://github.com/loteiron/ZeusAgent --skill python-debugpy-loteiron
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: python-debugpy
Source: https://github.com/loteiron/ZeusAgent/tree/main/skills/software-development/python-debugpy
Command: npx skills add https://github.com/loteiron/ZeusAgent --skill python-debugpy-loteiron

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires debugpy, remote-pdb.

What problem does it solve? Diagnosing why Python code fails is hard when tracebacks alone don't reveal wrong values, and long-running processes like gateways or daemons can't simply be restarted to add print statements. This Skill provides structured recipes for interactive debugging with pdb and remote debugging with debugpy. ## Core Features & Use Cases - Local pdb debugging: Insert breakpoint() for an interactive REPL, launch scripts under python -m pdb, or trap pytest failures with --pdb and --trace. - Post-mortem inspection: Catch exceptions and inspect locals at the crash site using pdb.post_mortem or a custom sys.excepthook. - Remote debugging with debugpy: Attach to already-running processes via DAP on port 5678, with patterns for source-edit listen, -m debugpy launch, and PID injection. - Use Case: A gateway subprocess misbehaves in production-like conditions. Add remote_pdb.set_trace() in the suspect handler, trigger it, then connect with nc 127.0.0.1 4444 to inspect the suspended frame and pending asyncio tasks. ## Quick Start Ask the agent to add a breakpoint in the failing Python function and walk you through inspecting the local variables when it hits.

Frequently Asked Questions about python-debugpy

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I debug Python code with pdb breakpoints?▼

Add `breakpoint()` in the source where you want to pause, then run the code normally to land in an interactive pdb REPL with full access to locals. Use commands like `n` to step, `pp expr` to inspect values, and `w` for the stack trace.

How to attach a debugger to a running Python process?▼

Use debugpy with `python -m debugpy --listen 127.0.0.1:5678 --pid <pid>` to inject into a running process, then attach a DAP client. Alternatively, add `remote_pdb.set_trace()` in the code and connect via `nc 127.0.0.1 4444` for a plain pdb prompt.

debugpy vs remote-pdb for terminal debugging?▼

remote-pdb gives a standard pdb prompt over a netcat connection and is the cleaner choice for terminal-based agents. Use debugpy only when you need IDE integration through the DAP protocol, such as attaching from VS Code or Cursor.

Why does pdb not work under pytest-xdist or parallel test runners?▼

Parallel and output-capturing runners hide the pdb prompt, so the test just hangs silently. Run pytest directly on a single file with `python -m pytest tests/foo_test.py::test_bar --pdb` for interactive debugging.

Why is my breakpoint() not hitting in Python?▼

Check whether `PYTHONBREAKPOINT=0` is set in the environment, which disables all breakpoint calls. Also verify you are not running under a capturing test runner and that execution actually reaches the line.

Can pdb debug multithreaded or asyncio Python code?▼

pdb only debugs the current thread and does not follow forks. For multithreaded code use debugpy's thread-aware DAP, and for asyncio use `interact` mode or `asyncio.all_tasks()` to inspect pending coroutines.