python-debugpy

Debug Python code with pdb breakpoints and debugpy remote DAP attach.

Updated Jul 3, 2026
One-click install
npx skills add https://github.com/CHENHUI-X/toolbox --skill python-debugpy-chenhui-x
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-debugpy
Source: https://github.com/CHENHUI-X/toolbox/tree/main/official-skills/software-development/python-debugpy
Command: npx skills add https://github.com/CHENHUI-X/toolbox --skill python-debugpy-chenhui-x

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires debugpy, remote-pdb.

What problem does it solve? Python bugs that tracebacks and print statements cannot explain require interactive inspection of live state, and long-running or subprocess-based programs cannot be debugged with simple local breakpoints. ## Core Features & Use Cases - Local pdb debugging: Insert breakpoint() calls, launch scripts under python -m pdb, run pytest with --pdb, and perform post-mortem inspection of exceptions with full access to locals and the call stack. - Remote debugging with debugpy: Attach to already-running processes via DAP on a TCP port, launch scripts with --wait-for-client, or inject into a live PID for daemons and gateway processes. - Terminal-friendly remote sessions: Use remote-pdb with netcat to get a standard (Pdb) prompt inside long-lived or child processes without IDE integration. - Use Case: A gateway subprocess misbehaves in production-like conditions and cannot be restarted; add a remote_pdb set_trace call in the suspect handler, trigger the code path, connect with nc, and inspect the suspended frame and pending asyncio tasks. ## Quick Start Add a breakpoint() call at the suspect line in my Python file and walk me through inspecting variables when the pdb prompt appears.

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?

Insert breakpoint() at the suspect line and run the code normally to land in a (Pdb) prompt with full access to locals. Use commands like 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.

debugpy vs remote-pdb for remote debugging?

debugpy speaks the DAP protocol and suits IDE integration with VS Code, including thread-aware debugging. remote-pdb gives a plain (Pdb) prompt over a TCP socket via nc, which is simpler for terminal-only workflows.

Why is my breakpoint() not hitting in Python?

Common causes are PYTHONBREAKPOINT=0 disabling breakpoints, running under a parallel or output-capturing test runner that hides the prompt, or execution finishing before a remote client attaches. Check the environment variable and run pytest directly on a single file.

Can pdb debug multithreaded or asyncio Python code?

pdb only debugs the current thread and does not follow forks, so each thread or child process needs its own breakpoint. For multithreaded code use debugpy's thread-aware DAP; for asyncio, pdb works in coroutines but await support varies by Python version.