python-debugpy

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires debugpy, remote-pdb.

What problem does it solve? Diagnosing why Python code misbehaves is hard when tracebacks and print statements don't reveal the root cause, especially in tests, long-running daemons, and subprocesses that can't be restarted cleanly. ## Core Features & Use Cases - Interactive pdb debugging: Drop into a REPL with breakpoint(), launch scripts under python -m pdb, and use the full pdb command set (step, breakpoints, stack navigation, expression evaluation). - Remote debugging with debugpy and remote-pdb: Attach to already-running processes via DAP on port 5678, inject into a live PID, or open a terminal pdb session over TCP with remote-pdb. - Post-mortem and test debugging: Inspect locals at crash sites with pdb.post_mortem, and debug pytest failures with --pdb while avoiding the xdist hang. - Use Case: A gateway subprocess deadlocks in production-like conditions. Add remote_pdb.set_trace() in the handler, trigger the request, connect with nc 127.0.0.1 4444, and inspect the suspended frame and pending asyncio tasks. ## Quick Start Add a breakpoint() call at the suspicious line in my Python file and walk me through inspecting variables when execution pauses there.

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 breakpoints?

Add breakpoint() at the line you want to inspect and run the code normally; execution pauses there with a pdb REPL. From the prompt use n to step, p to print expressions, w for the stack, and interact for a full Python REPL in the current scope.

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 live process, then connect a DAP client. Alternatively, add remote_pdb.set_trace() in the code and connect with nc to get a standard pdb prompt over TCP.

debugpy vs remote-pdb: which should I use?

Use remote-pdb when you want a simple terminal pdb session over a socket, which is the cleanest option for terminal-based agents. Use debugpy when you need IDE integration via DAP, thread-aware debugging, or attach support in VS Code.

Why does pdb not work when running pytest?

pdb does not work under pytest-xdist; the prompt never appears and the test hangs. Run with -p no:xdist or -n 0, or invoke a single test directly with python -m pytest tests/foo_test.py::test_bar --pdb.

Why is my breakpoint() not hitting in Python?

Check whether PYTHONBREAKPOINT=0 is set, which disables all breakpoint() calls. Also verify you are not running under pytest-xdist, and for remote debugging confirm the client attached before execution passed the breakpoint.

Can pdb debug multithreaded or asyncio Python code?

pdb only debugs the current thread and does not follow forks, so each child process needs its own breakpoint. For multithreaded code use debugpy's thread-aware DAP; for asyncio, await inside pdb requires Python 3.13+ or workarounds via interact mode.