python-debugpy

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

5|2|Updated Mar 12, 2026
One-click install
npx skills add https://github.com/AjayRajan05/VoiceOS --skill python-debugpy-ajayrajan05
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: python-debugpy
Source: https://github.com/AjayRajan05/VoiceOS/tree/main/skills/bundled/community/software-development/python-debugpy
Command: npx skills add https://github.com/AjayRajan05/VoiceOS --skill python-debugpy-ajayrajan05

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires debugpy, remote-pdb.

What problem does it solve? Diagnosing why Python code fails is hard when tracebacks alone don't reveal wrong values, when tests hang under pytest-xdist, or when long-running processes like gateways and daemons misbehave and cannot be restarted. This Skill provides concrete recipes for interactive debugging with pdb, post-mortem analysis, and remote debugging of running processes via debugpy and remote-pdb. ## Core Features & Use Cases - Local pdb debugging: Insert breakpoint() for an interactive REPL, launch scripts with python -m pdb, or drop into pdb on pytest failures with --pdb and -p no:xdist. - Post-mortem inspection: Catch exceptions and inspect locals at the crash site using pdb.post_mortem or python -m pdb -c continue. - Remote debugging: Attach to already-running processes (gateways, daemons, subprocess workers) using debugpy's DAP protocol or the simpler remote-pdb over netcat. - Use Case: A VoiceOS gateway subprocess deadlocks on an async handler. Add remote_pdb.set_trace() at the handler entry, 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 suspect line in my Python file and show me how to inspect 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 pauses there with a (Pdb) prompt. Use commands like n to step, p to print expressions, w for the stack trace, and interact for a full Python REPL in the current scope.

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 is simpler: call set_trace() and connect with nc to get a standard pdb prompt.

debugpy vs remote-pdb: which should I use?▼

Use remote-pdb when you just need a terminal pdb session in a running process; it gives a plain (Pdb) prompt over netcat. Use debugpy when you need IDE integration via DAP, thread-aware debugging, or attach-by-PID to an already-running process.

Why does pdb not work with pytest-xdist?▼

pdb does not function under pytest-xdist because tests run in worker processes without an interactive terminal, so the prompt never appears and the test hangs. Run with -p no:xdist or -n 0, or invoke pytest directly on a single test with --pdb.

Why does debugpy attach to PID fail on Linux?▼

Attach-by-PID fails on hardened kernels because ptrace_scope restricts process injection; Ubuntu's default of 1 only allows ptrace of child processes. 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 a Python debugger?▼

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