python-debugpy

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

Updated Aug 21, 2026
One-click install
npx skills add https://github.com/ewtodd/son-of-anton --skill python-debugpy-ewtodd
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: python-debugpy
Source: https://github.com/ewtodd/son-of-anton/tree/main/skills/software-development/python-debugpy
Command: npx skills add https://github.com/ewtodd/son-of-anton --skill python-debugpy-ewtodd

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires debugpy, remote-pdb.

What problem does it solve? Diagnosing why Python code fails is slow when tracebacks alone don't reveal wrong values, and long-running processes like daemons and gateways can't simply be restarted with a print statement. This Skill provides a decision framework and concrete recipes for interactive debugging with pdb, post-mortem analysis, and remote debugging of live processes via debugpy and remote-pdb. ## Core Features & Use Cases - Local debugging with pdb: Insert breakpoint() for an interactive REPL, launch scripts under python -m pdb without source edits, and use the full pdb command set (step, conditional breakpoints, interact mode). - Test and post-mortem debugging: Drop into pdb on pytest failures with --pdb, or catch any exception with pdb.post_mortem to inspect locals at the crash frame. - Remote debugging of running processes: Attach to long-lived processes (gateways, daemons, subprocess workers) using debugpy's DAP listener, PID injection, or the simpler remote-pdb over netcat. - Use Case: A gateway subprocess misbehaves in production-like conditions. Add remote_pdb.set_trace() at the suspect handler, trigger it, connect with nc 127.0.0.1 4444, and inspect the live call stack and variables without restarting anything. ## Quick Start Add a breakpoint() call at the suspicious line in my Python file and walk me through inspecting the 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 pdb breakpoints?▼

Add 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 over, s to step into, pp to print expressions, and w to view the call stack.

How to debug a running Python process remotely?▼

Use debugpy by adding debugpy.listen(("127.0.0.1", 5678)) and debugpy.wait_for_client() in the code, or launch with python -m debugpy --listen 127.0.0.1:5678. For terminal-only workflows, remote-pdb with nc is simpler than debugpy's DAP protocol.

debugpy vs remote-pdb for terminal debugging?▼

remote-pdb is the better terminal choice: call set_trace() in code and connect with nc to get a standard pdb prompt. Use debugpy only when you need IDE integration via DAP, thread-aware debugging, or attach-to-PID injection.

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

Output-capturing runners like pytest-xdist and subprocess-based wrappers swallow the pdb prompt, so the test hangs silently. Run pytest directly on a single file with python -m pytest tests/foo.py::test_bar --pdb for interactive debugging.

Why does debugpy attach to PID fail on Linux?▼

Hardened kernels block ptrace-based injection when /proc/sys/kernel/yama/ptrace_scope is 1, allowing only parent-child tracing. Fix it with echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope, or launch the process under debugpy from the start.

When should I not use a Python debugger?▼

Skip the debugger when print() or logging solves the problem in under a minute, or when pytest --showlocals --tb=long already reveals the issue. Also avoid committing breakpoint() calls, since they hang CI and non-TTY environments.