惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

IT之家
IT之家
Y
Y Combinator Blog
月光博客
月光博客
Blog — PlanetScale
Blog — PlanetScale
GbyAI
GbyAI
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
美团技术团队
雷峰网
雷峰网
酷 壳 – CoolShell
酷 壳 – CoolShell
Last Week in AI
Last Week in AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
有赞技术团队
有赞技术团队
博客园 - 司徒正美
V
Visual Studio Blog
小众软件
小众软件
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
Tailwind CSS Blog
Apple Machine Learning Research
Apple Machine Learning Research
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
A
About on SuperTechFans
The Cloudflare Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
feat(skills): add python debugpy skill · openclaw/opencla...
steipete · 2026-05-17 · via Recent Commits to openclaw:main

@@ -0,0 +1,73 @@

1+

---

2+

name: python-debugpy

3+

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

4+

metadata: { "openclaw": { "requires": { "bins": ["python3"] } } }

5+

---

6+7+

# Python Debugpy

8+9+

Use when Python code needs interactive debugging: hidden locals, confusing state mutation, failing tests, subprocesses, long-running services, or remote/headless attach.

10+11+

Pick the smallest debugger that reaches the bad frame.

12+13+

## Choose

14+15+

- `breakpoint()`: local code, source edits ok, fastest path.

16+

- `python3 -m pdb`: no source edit, launch from the beginning.

17+

- `python3 -m pdb -c continue`: stop at an unhandled exception.

18+

- `debugpy`: remote/headless process, DAP client, already-running PID, or service startup race.

19+20+

## Commands

21+22+

```bash

23+

python3 -m pdb path/to/script.py arg1

24+

python3 -m pdb -c continue path/to/script.py

25+

python3 -c "import debugpy" || python3 -m pip install debugpy

26+

python3 -m debugpy --listen 127.0.0.1:5678 --wait-for-client path/to/script.py

27+

python3 -m debugpy --listen 127.0.0.1:5678 --wait-for-client -m package.module

28+

python3 -m debugpy --listen 127.0.0.1:5678 --pid <pid>

29+

```

30+31+

For source-edit attach:

32+33+

```py

34+

import debugpy

35+36+

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

37+

debugpy.wait_for_client()

38+

debugpy.breakpoint()

39+

```

40+41+

For post-mortem:

42+43+

```py

44+

import pdb, sys

45+46+

try:

47+

run()

48+

except Exception:

49+

pdb.post_mortem(sys.exc_info()[2])

50+

raise

51+

```

52+53+

## pdb

54+55+

- Flow: `n`, `s`, `r`, `c`, `q`.

56+

- Stack/source: `w`, `u`, `d`, `a`, `l`, `ll`.

57+

- Values: `p expr`, `pp expr`, `display expr`.

58+

- Breakpoints: `b file.py:42`, `b func`, `b file.py:42, condition`, `cl <num>`.

59+

- Mutate/evaluate: `!statement`; full REPL: `interact`.

60+61+

## Rules

62+63+

- Reproduce with the smallest command/test first.

64+

- Disable parallel test workers for pdb; interactive stdin usually breaks inside worker pools.

65+

- Keep `debugpy` in the active env; do not add it as a project dependency unless the project already wants it.

66+

- Bind debug servers to `127.0.0.1`; do not expose `0.0.0.0` unless isolated or tunnelled.

67+

- Use unique ports for parallel sessions.

68+

- Treat `debugpy --pid` as injection; avoid security-sensitive or production targets unless explicitly approved.

69+

- If PID attach fails on Linux, check ptrace/container privileges before changing the target.

70+

- Cleanup before commit: `rg -n 'breakpoint\\(|pdb\\.set_trace|debugpy\\.' --type py`.

71+

- Rerun the normal project test/gate without the debugger.

72+

- `PYTHONBREAKPOINT=0` disables `breakpoint()`.

73+

- If a process is stuck after debugger detach, confirm it is not still paused at a breakpoint.