python-debugpy

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

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

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 print debugging. This Skill provides recipes for local pdb sessions, pytest debugging, post-mortem analysis, and remote debugging of running processes via 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, breakpoints, stack navigation, interact mode). - Pytest and post-mortem debugging: Drop into pdb on test failures with --pdb, handle xdist conflicts, and inspect exception frames after crashes. - Remote debugging: Attach to long-running processes, daemons, and subprocesses using debugpy's DAP protocol or remote-pdb over netcat. - 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 live stack and locals. ## Quick Start Add breakpoint() 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 line you want to inspect and run the script normally; execution drops into a pdb REPL with full access to locals. Use commands like n to step, p to print expressions, and w to view the call stack.

How to debug a running Python process remotely?

Use debugpy by adding debugpy.listen() and debugpy.wait_for_client() in the code, or launch with python -m debugpy --listen. For terminal-only access, remote-pdb's set_trace() gives a standard pdb prompt over netcat.

debugpy vs remote-pdb: which should I use?

Use remote-pdb when you only need a terminal pdb prompt in a running process; it is simpler and agent-friendly. Use debugpy when you need IDE integration, thread-aware debugging, or DAP-based automation.

Why does pdb not work when running pytest?

pdb does not work under pytest-xdist, which many test runners enable by default; the prompt never appears and the test hangs. Disable it with -p no:xdist or -n 0, then use --pdb to trap failures.

Why does debugpy attach to PID fail?

Attach fails on hardened kernels where ptrace_scope restricts process injection, such as the Ubuntu default of 1. Set /proc/sys/kernel/yama/ptrace_scope to 0 with root, or launch the process under debugpy from the start.

When should I not use pdb for debugging?

Avoid pdb when print() or logging solves the problem quickly, or when pytest --showlocals --tb=long already reveals the issue. pdb also does not follow forks, so each child process needs its own breakpoint.