python-debugpy

Debug Python applications with breakpoints, variable inspection, and remote process attachment.

Updated Oct 23, 2024
One-click install
npx skills add https://github.com/lenadlm/docker --skill python-debugpy-lenadlm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-debugpy
Source: https://github.com/lenadlm/docker/tree/main/hermes-skills/skills/software-development/python-debugpy
Command: npx skills add https://github.com/lenadlm/docker --skill python-debugpy-lenadlm

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill equips you with comprehensive Python debugging tools, helping you efficiently trace, analyze, and resolve issues in your code.

Core Features & Use Cases

  • Local & Interactive Debugging: Utilize breakpoint() and pdb for step-by-step code analysis and inspection.
  • Remote Debugging: Use debugpy to attach to running processes, making it ideal for long-running or headless environments.
  • Post-Mortem Analysis: Gain insights into production crashes with post-mortem debugging techniques.
  • Use Case: If a Python script in your automation pipeline crashes and you need to investigate the state of variables and stack trace at the moment of failure.

Quick Start

Set a breakpoint in your Python script and use debugpy to connect and inspect variables, step through the code, and fix bugs.

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 running Python process in a remote environment?

Remote Python debugging uses debugpy to attach to running processes, enabling step-by-step execution and variable inspection in headless or long-running environments. It connects to the target process interactively to trace and resolve issues.

What is the best way to inspect variables after a Python script crashes?

Post-mortem analysis is the best way to inspect variables after a Python script crashes, allowing you to examine the stack trace and application state at the exact moment of failure. This technique helps identify the root cause of production crashes.

Can I use pdb for step-by-step code analysis in local Python applications?

Yes, you can use pdb and the breakpoint() function for step-by-step local Python debugging. This approach allows you to interactively execute code line by line, inspect variables, and analyze application behavior to resolve issues efficiently.

Do I need specific libraries to set breakpoints for interactive Python debugging?

Yes, interactive Python debugging requires the pdb and debugpy libraries to set breakpoints, perform step-by-step execution, and inspect variables. These dependencies provide the necessary protocol support for both local and remote debugging sessions.

When should I use debugpy instead of pdb for Python debugging?

Use debugpy instead of pdb when you need to attach to running remote processes or require DAP support for long-running environments. Pdb is better suited for local, interactive step-by-step code analysis and quick variable inspection.

Why does my automation pipeline crash and how do I investigate the stack trace?

Your automation pipeline may crash due to runtime errors, which you can investigate using post-mortem debugging to analyze the stack trace and variable state at the moment of failure. Setting breakpoints with debugpy helps trace the exact execution path leading to the crash.