python-debugpy

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

Updated Aug 19, 2026
One-click install
npx skills add https://github.com/swcstudiospace/aimeecodes --skill python-debugpy-swcstudiospace
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: python-debugpy
Source: https://github.com/swcstudiospace/aimeecodes/tree/main/.aimee/skills/python-debugpy
Command: npx skills add https://github.com/swcstudiospace/aimeecodes --skill python-debugpy-swcstudiospace

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires debugpy, remote-pdb.

What problem does it solve? Diagnosing Python bugs in tests, scripts, and long-running processes is hard when tracebacks alone don't reveal why values are wrong, and interactive debugging often fails under test runners or in remote processes. ## Core Features & Use Cases - Local pdb debugging: Insert breakpoint() for an interactive REPL, launch scripts with python -m pdb, or run pytest with --pdb and --trace to trap failures. - Post-mortem inspection: Catch exceptions with pdb.post_mortem or python -m pdb -c continue to inspect locals at the crash site. - Remote debugging with debugpy and remote-pdb: Attach to already-running processes via DAP on port 5678, inject into a PID, or use remote-pdb with nc for a plain pdb prompt over TCP. - Use Case: A gateway subprocess misbehaves and cannot be restarted. Add remote_pdb.set_trace() in the suspect handler, trigger it, then connect with nc 127.0.0.1 4444 to inspect the live stack. ## Quick Start Add a breakpoint() call at the suspect line in my Python file and walk me through stepping through it in pdb to find why the value is wrong.

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 suspect line and run the code normally to land in an interactive pdb REPL with full access to locals. Use n to step over, s to step into, p to print expressions, and w to view the stack.

How to debug a running Python process remotely with debugpy?▼

Install debugpy, then either launch with python -m debugpy --listen 127.0.0.1:5678 --wait-for-client or attach to a PID with python -m debugpy --listen 127.0.0.1:5678 --pid <pid>. Connect a DAP client such as VS Code to port 5678.

debugpy vs remote-pdb for terminal debugging?▼

remote-pdb is the cleaner terminal choice: call set_trace(host, port) in code and connect with nc to get a standard pdb prompt. Use debugpy only when you need IDE integration or thread-aware DAP features.

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

Parallel and output-capturing runners hide the pdb prompt, so the test hangs silently. Run pytest directly on a single file with --pdb for interactive debugging, then re-confirm under the wrapper before pushing.

Why does debugpy attach to PID fail on Linux?▼

Hardened kernels block ptrace-based injection when /proc/sys/kernel/yama/ptrace_scope is 1. Set it to 0 with root privileges, or launch the process under debugpy from the start instead of attaching later.

Can pdb debug multithreaded or asyncio Python code?▼

pdb only debugs the current thread and does not follow forks. For multithreaded code use debugpy's thread-aware DAP; for asyncio, await inside pdb requires Python 3.13+ or workarounds like asyncio.ensure_future on older versions.