python-debugpy

Debug Python applications with pdb and debugpy for local and remote sessions.

Updated Sep 28, 2021
One-click install
npx skills add https://github.com/XyHalcyon/config-files --skill python-debugpy-xyhalcyon
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-debugpy
Source: https://github.com/XyHalcyon/config-files/tree/main/hermes/skills/software-development/python-debugpy
Command: npx skills add https://github.com/XyHalcyon/config-files --skill python-debugpy-xyhalcyon

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires debugpy, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill simplifies debugging Python code by integrating pdb and debugpy, enabling efficient and effective debugging across local, interactive, remote, and post-mortem scenarios.

Core Features & Use Cases

  • Local Breakpoint: Integrate breakpoint() into your code to pause execution at a specific point for interactive debugging.
  • pdb Command Support: Execute common pdb commands within a debugging session for detailed inspection and control.
  • Remote Debugging: Attach to running processes or launch scripts with debugpy for non-intrusive debugging.
  • Post-Mortem Analysis: Inspect local variables at the crash site post-mortem using pdb.post_mortem.

Quick Start

To debug a Python script, insert a breakpoint() in your code, then run the script. When the breakpoint hits, you will enter the pdb REPL and can use commands like n to step over or s to step into functions.

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 locally using breakpoints?

Remote debugging with debugpy allows you to attach to running processes or launch scripts for non-intrusive debugging. This DAP-based approach facilitates interactive troubleshooting across local, remote, and post-mortem scenarios without modifying core application logic.

Can I inspect variables after a Python application crashes?

Yes, you can inspect local variables at the crash site using `pdb.post_mortem`. This post-mortem analysis technique launches the interactive pdb REPL after an exception, allowing you to examine the application state and determine the exact cause of the crash.

Do I need a specific Python version to use debugpy for debugging?

Yes, you need Python 3.7 or later to use debugpy and pdb for interactive and remote debugging. You must also ensure the `debugpy` dependency is installed in your environment to facilitate DAP protocol communication and breakpoint management.

What pdb commands can I use to step through Python code during a session?

During a pdb debugging session, you can execute common pdb commands for detailed inspection and control. For example, use `n` to step over to the next line or `s` to step into functions, enabling precise navigation through your Python code execution flow.