Community코딩 & 개발github.com

Python Debugpy

pdb, breakpoint(), 사후 검사 및 debugpy 원격 연결을 사용하여 Python 코드를 디버깅합니다.

Python Debugpy란 무엇인가요?

이 스킬은 개발자가 Python 코드에서 발생하는 다양한 버그와 문제를 효율적으로 디버깅할 수 있도록 돕습니다. 숨겨진 지역 변수, 혼란스러운 상태 변이, 실패하는 테스트, 서브프로세스, 장기 실행 서비스, 원격/헤드리스 환경 등 여러 시나리오에서 대화형 디버깅을 제공합니다. 스킬의 핵심 디버깅 방법으로는 breakpoint(), python3 -m pdb, debugpy 원격 연결이 있으며, 상황에 따라 가장 적합한 방법을 선택하도록 안내합니다. 특히 debugpy는 원격 프로세스에 연결하거나 이미 실행 중인 프로세스(PID)에 디버거를 주입할 수 있어, Docker 컨테이너나 원격 서버에서 실행되는 Python 코드를 디버깅하는 데 매우 유용합니다. 또한 pdb의 주요 명령어(단계 실행, 스택 검사, 표현식 평가, 중단점 관리 등)와 함께, 디버깅 종료 후 코드 정리 및 테스트 재실행과 같은 모범 사례를 제공하여 안정적인 개발 워크플로우를 지원합니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/clawdbot/clawdbot/tree/main/skills/python-debugpy

Installed? Explore more 코딩 & 개발 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

Python Debugpy은(는) 무엇을 하나요?

Python 코드에 대화형 디버깅이 필요할 때 사용합니다: 숨겨진 지역 변수, 혼란스러운 상태 변이, 실패하는 테스트, 서브프로세스, 장기 실행 서비스, 원격/헤드리스 연결.

잘못된 프레임에 도달할 수 있는 가장 작은 디버거를 선택하세요.

선택

  • breakpoint(): 로컬 코드, 소스 편집 가능, 가장 빠른 경로.
  • python3 -m pdb: 소스 편집 불필요, 처음부터 실행.
  • python3 -m pdb -c continue: 처리되지 않은 예외에서 중지.
  • debugpy: 원격/헤드리스 프로세스, DAP 클라이언트, 이미 실행 중인 PID, 또는 서비스 시작 경합.

명령어

python3 -m pdb path/to/script.py arg1
python3 -m pdb -c continue path/to/script.py
python3 -c "import debugpy" || python3 -m pip install debugpy
python3 -m debugpy --listen 127.0.0.1:5678 --wait-for-client path/to/script.py
python3 -m debugpy --listen 127.0.0.1:5678 --wait-for-client -m package.module
python3 -m debugpy --listen 127.0.0.1:5678 --pid <pid>

소스 편집 연결의 경우:

import debugpy

debugpy.listen(("127.0.0.1", 5678))
debugpy.wait_for_client()
debugpy.breakpoint()

사후 검사의 경우:

import pdb, sys

try:
    run()
except Exception:
    pdb.post_mortem(sys.exc_info()[2])
    raise

pdb

  • 흐름: n, s, r, c, q.
  • 스택/소스: w, u, d, a, l, ll.
  • 값: p expr, pp expr, display expr.
  • 중단점: b file.py:42, b func, b file.py:42, condition, cl <num>.
  • 변형/평가: !statement; 전체 REPL: interact.

규칙

  • 가장 작은 명령/테스트로 먼저 재현하세요.
  • pdb의 경우 병렬 테스트 워커를 비활성화하세요. 대화형 stdin은 일반적으로 워커 풀 내에서 중단됩니다.
  • debugpy를 활성 환경에 유지하고, 프로젝트가 이미 원하지 않는 한 프로젝트 종속성으로 추가하지 마세요.
  • 디버그 서버를 127.0.0.1에 바인딩하고, 격리되거나 터널링되지 않은 경우 0.0.0.0을 노출하지 마세요.
  • 병렬 세션에는 고유한 포트를 사용하세요.
  • debugpy --pid는 실행 중인 프로세스에 주입합니다. 연결하기 전에 대상 PID를 확인하세요.
  • Linux에서 PID 연결이 실패하면 대상 변경 전에 ptrace/컨테이너 권한을 확인하세요.
  • 커밋 전 정리: rg -n 'breakpoint\(|pdb\.set_trace|debugpy\.' --type py.
  • 디버거 없이 일반 프로젝트 테스트/게이트를 다시 실행하세요.
  • PYTHONBREAKPOINT=0은 breakpoint()를 비활성화합니다.
  • 디버거 분리 후 프로세스가 멈춘 경우, 여전히 중단점에서 일시 중지되지 않았는지 확인하세요.

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

1password

Set up and use 1Password CLI for sign-in, desktop integration, and reading or injecting secrets.

acp-router

Route plain-language requests for Claude Code, Cursor, Copilot, OpenClaw ACP, OpenCode, Gemini CLI, Grok Build, Qwen, Kiro, Kimi, iFlow, Factory Droid, Kilocode, or explicit ACP harness work into either OpenClaw ACP runtime sessions or direct acpx-driven sessions ("telephone game" flow). For coding-agent thread requests, read this skill first, then use only `sessions_spawn` for thread creation. Codex chat binding defaults to the native Codex app-server plugin unless ACP is explicit or background spawn needs ACP.

add-model-provider

Add and live-prove a model provider with non-interactive config one-liners, without exposing credentials.

agent-transcript

Requested GitHub PR/issue agent transcripts: redact, trim, preview, and insert safely.

apple-notes

Create, view, edit, delete, search, move, or export Apple Notes via the memo CLI on macOS.

apple-reminders

List, add, edit, complete, or delete Apple Reminders and reminder lists via remindctl.

auto-qa

Run OpenClaw-wide autonomous QA and live/stress campaigns across independent subsystem lanes, with verified fixes and a resumable evidence report.

autoreview

Structured code review through the shared OpenClaw agent-skills installation.

bear-notes

Create, search, and manage Bear notes via grizzly CLI.

blacksmith-testbox

Run Blacksmith Testbox for CI-parity checks, secrets, hosted services, migrations, or builds local cannot reproduce.

block-kit

Use proactively for structured or interactive Slack replies, and when asked to author or validate native Slack Block Kit JSON.

blogwatcher

Monitor blogs and RSS/Atom feeds for updates using the blogwatcher CLI.

blucli

BluOS CLI (blu) for discovery, playback, grouping, and volume.

bluebubbles

Send and manage iMessages via BlueBubbles, including attachments, tapbacks, edits, replies, and groups.

browser-automation

Use when controlling web pages with the OpenClaw browser tool, especially multi-step flows, login checks, tab management, or recovery from stale refs/timeouts.

camsnap

Capture frames or clips from RTSP/ONVIF cameras and local webcams, including USB pan/tilt/zoom control.

canvas

Present HTML on connected OpenClaw node canvases, navigate/eval/snapshot, and debug canvas host URLs.

channel-message-flows

Use when running QA Lab channel message flow evidence.

clawdtributor

Clawtributor PRs here, last week or another window: discover conversation refs, recheck GitHub, rank by impact.

clawhub

Search ClawHub for plugins by default, or skills when explicitly requested; install, verify, update, uninstall, publish, or sync skills.

관련 스킬