python-debugpy

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

2|Updated Oct 20, 2017
One-click install
npx skills add https://github.com/rbudiharso/dotfiles --skill python-debugpy-rbudiharso
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: python-debugpy
Source: https://github.com/rbudiharso/dotfiles/tree/main/hermes/.hermes/skills/software-development/python-debugpy
Command: npx skills add https://github.com/rbudiharso/dotfiles --skill python-debugpy-rbudiharso

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires debugpy, remote-pdb.

What problem does it solve? Diagnosing why Python code misbehaves often requires more than print statements or tracebacks, especially for failing tests, long-running daemons, and subprocesses that cannot be restarted. This Skill provides concrete recipes for interactive debugging with pdb and remote debugging with debugpy or remote-pdb. ## Core Features & Use Cases - Local pdb debugging: Insert breakpoint() calls, launch scripts under python -m pdb, and use the full pdb command set (step, inspect, conditional breakpoints, post-mortem). - Test debugging: Run pytest with --pdb, --trace, or --showlocals to trap failures, with guidance on bypassing output-capturing test wrappers. - Remote and attach debugging: Use debugpy to listen for DAP clients, attach to running PIDs, or use remote-pdb over netcat for terminal-friendly sessions in daemons and subprocesses. - Use Case: A gateway process misbehaves in production-like conditions and cannot be restarted; inject remote_pdb.set_trace() at the suspect handler, trigger the code path, and connect via nc to inspect the live stack and locals. ## Quick Start Add breakpoint() above the failing line in my Python file and walk me through inspecting the 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 line you want to inspect and run the script normally; execution drops into a pdb REPL with full access to locals. Use n to step, p to print expressions, and w to view the stack.

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 a debug server into the running process. Then connect a DAP client such as VS Code, or use remote-pdb with nc for a plain terminal pdb session.

debugpy vs remote-pdb for remote Python debugging?▼

debugpy speaks the DAP protocol and integrates with IDEs like VS Code, supporting threads and rich breakpoints. remote-pdb exposes a plain pdb prompt over a TCP socket, which is simpler for terminal-only workflows.

Why does my breakpoint not hit under pytest?▼

Parallel or output-capturing runners like pytest-xdist swallow the interactive pdb prompt, so the test hangs silently. Run pytest directly on a single file with --pdb, and check that PYTHONBREAKPOINT is not set to 0.

Why does debugpy attach to PID fail on Linux?▼

Hardened kernels restrict ptrace via /proc/sys/kernel/yama/ptrace_scope, blocking injection into running processes. Set ptrace_scope to 0 with root privileges, or launch the process under debugpy from the start.