python-debugpy

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

Updated Jun 17, 2026
One-click install
npx skills add https://github.com/i-bebsi/hermes-agent --skill python-debugpy-i-bebsi
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: python-debugpy
Source: https://github.com/i-bebsi/hermes-agent/tree/main/hermes-config/skills/software-development/python-debugpy
Command: npx skills add https://github.com/i-bebsi/hermes-agent --skill python-debugpy-i-bebsi

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, and long-running processes like gateways or daemons can't simply be restarted to add print statements. This Skill provides structured recipes for interactive debugging with pdb and remote debugging with debugpy. ## Core Features & Use Cases - Local pdb debugging: Insert breakpoint() in source, launch scripts under python -m pdb, or drop into pdb on pytest failures with --pdb and --trace. - Remote debugging with debugpy: Attach to already-running processes via DAP on port 5678, using source-edit listeners, -m debugpy launch, or PID-based injection. - Post-mortem inspection: Catch exceptions and inspect locals at the crash site using pdb.post_mortem or a custom sys.excepthook. - Use Case: A Hermes gateway subprocess misbehaves in production. 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 the service. ## Quick Start Add a breakpoint() call at the suspicious line in my Python file and show me how to inspect 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?▼

Insert breakpoint() at the target line in your source and run the code 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 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 running process, then connect a DAP client. Alternatively, add remote_pdb.set_trace() in the code and connect via nc 127.0.0.1 4444 for a plain pdb prompt.

debugpy vs remote-pdb for terminal debugging?▼

remote-pdb gives a standard (Pdb) prompt over a netcat connection and is the cleaner choice for terminal-based agents. debugpy speaks the DAP protocol and is only needed when you require IDE integration with VS Code, Cursor, or Zed.

Why does pdb not work when running pytest?▼

pdb does not work under pytest-xdist, which many test runners enable by default with -n 4; the prompt never appears and the test hangs. Disable it with -p no:xdist or run a single test with -n 0 when using --pdb.

Why does debugpy attach to PID fail on Linux?▼

Attach fails on hardened kernels because ptrace_scope=1 (the Ubuntu default) restricts ptrace to child processes of the same user. Fix it by running echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope, or launch the process under debugpy from the start.

When should I not use pdb or debugpy for debugging?▼

Skip interactive debuggers when print() or logging.debug solves the problem in under a minute, or when pytest -vv --tb=long --showlocals already reveals the issue. pdb also cannot follow forks, so each multiprocessing child needs its own breakpoint.