python-debugpy

Debug Python code with pdb, breakpoint(), post-mortem inspection, and debugpy remote attach.

Updated Jun 19, 2026
One-click install
npx skills add https://github.com/AmirulAndalib/Vilvona-AI --skill python-debugpy-amirulandalib
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-debugpy
Source: https://github.com/AmirulAndalib/Vilvona-AI/tree/main/skills/python-debugpy
Command: npx skills add https://github.com/AmirulAndalib/Vilvona-AI --skill python-debugpy-amirulandalib

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires debugpy.

What problem does it solve? Python bugs involving hidden locals, confusing state mutation, failing tests, subprocesses, or long-running services are hard to diagnose with print statements alone. This Skill guides interactive debugging so you can stop at the exact bad frame and inspect real program state. ## Core Features & Use Cases - Debugger Selection: Chooses the smallest tool for the job, from breakpoint() for local code to python3 -m pdb for no-edit launches and debugpy for remote or already-running processes. - Post-Mortem Inspection: Captures tracebacks with pdb.post_mortem so you can examine state at the moment an unhandled exception occurred. - Remote Attach: Starts debugpy listeners or attaches to a running PID for headless services, containers, and DAP clients. - Use Case: A test fails only inside a subprocess worker. Launch it with python3 -m pdb -c continue to stop at the unhandled exception, inspect locals with p and w, then fix and rerun the normal test gate. ## Quick Start Ask the assistant to debug your failing Python script with pdb, or to attach debugpy to a running process on port 5678 so you can inspect its state.

Frequently Asked Questions about python-debugpy

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I debug a Python script with pdb?

Run python3 -m pdb path/to/script.py to start the script under the debugger, or add breakpoint() in your source and run it normally. Use n to step over, s to step into, c to continue, and p expr to inspect values.

How do I attach a debugger to a running Python process?

Use python3 -m debugpy --listen 127.0.0.1:5678 --pid <pid> to inject debugpy into a running process, then connect a DAP client to that port. On Linux, check ptrace and container privileges if PID attach fails.

What is the difference between pdb and debugpy?

pdb is a terminal debugger built into Python for local interactive sessions. debugpy implements the Debug Adapter Protocol, enabling remote attach, headless processes, and editor-based debugging of running services.

How do I inspect state after an unhandled Python exception?

Run python3 -m pdb -c continue script.py to stop at the unhandled exception, or call pdb.post_mortem(sys.exc_info()[2]) inside an except block. This opens the debugger at the failing frame with full locals.

Why does pdb not work inside parallel test workers?

Interactive stdin usually breaks inside worker pools, so pdb cannot accept commands there. Disable parallel test workers and run the failing test in a single process before debugging.

Is it safe to expose a debugpy debug server on all interfaces?

No. Bind debug servers to 127.0.0.1 only; exposing 0.0.0.0 allows remote code execution through the debugger. Use unique ports per session and avoid PID attach on production or security-sensitive targets without approval.