# Send LSP Python to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "lsp-python",
    "name": "LSP Python",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/genify/lsp-python",
    "canonicalUrl": "https://clawhub.ai/genify/lsp-python",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/lsp-python",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=lsp-python",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "SKILL.md",
      "references/lsp-protocol.md",
      "references/pep8-guide.md",
      "references/pylsp-config.md",
      "scripts/check_python.py",
      "scripts/lsp-python.py"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "slug": "lsp-python",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-04T20:39:51.395Z",
      "expiresAt": "2026-05-11T20:39:51.395Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=lsp-python",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=lsp-python",
        "contentDisposition": "attachment; filename=\"lsp-python-1.1.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "lsp-python"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/lsp-python"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/lsp-python",
    "downloadUrl": "https://openagent3.xyz/downloads/lsp-python",
    "agentUrl": "https://openagent3.xyz/skills/lsp-python/agent",
    "manifestUrl": "https://openagent3.xyz/skills/lsp-python/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/lsp-python/agent.md"
  }
}
```
## Documentation

### LSP Python 技能

使用 Python Language Server Protocol (LSP) 进行代码质量检查和智能分析。

### 1. 检查代码问题

# 单个文件
python3 scripts/lsp-service.py check <文件路径>

# 批量检查 (推荐)
python3 scripts/check_python.py <文件或目录>

# 批量检查并自动修复
python3 scripts/check_python.py --auto-fix <文件或目录>

示例:

python3 scripts/lsp-service.py check my_script.py
python3 scripts/check_python.py src/
python3 scripts/check_python.py --auto-fix src/

### 2. 获取代码补全

python3 scripts/lsp-service.py complete <文件> <行号> <字符位置>

### 3. 查看符号信息

python3 scripts/lsp-service.py info <文件> <行号> <字符位置>

### 依赖

Python 3.x
pylsp: pip install python-lsp-server
可选插件:

pip install python-lsp-server[all] - 完整插件集
pip install pylsp-mypy - 类型检查
pip install pylsp-black - black 格式化

### 代码诊断 (check)

检查 Python 文件中的错误和警告:

pyflakes - 代码错误检测 (未使用导入、未定义变量等)
pycodestyle - PEP8 风格检查 (格式、行长、空白等)

输出示例:

⚠️ 第 3 行 [pyflakes]: 'os' imported but unused
⚠️ 第 6 行 [pycodestyle]: E302 expected 2 blank lines, found 1
✅ 没有发现问题

### 代码补全 (complete)

获取指定位置的代码补全建议:

python3 scripts/lsp-service.py complete script.py 5 10

输出:

补全建议:
  • json (模块)
  • jsonpatch (模块)
  • requests (模块)

### 悬停提示 (info)

查看函数签名、文档字符串等信息:

python3 scripts/lsp-service.py info script.py 10 5

### 跳转定义 (goto)

查找符号的定义位置:

python3 scripts/lsp-service.py goto script.py 15 10

### 清理未使用的导入

pip install autoflake
autoflake --remove-all-unused-imports --in-place --recursive .

### 格式化代码

pip install black
black .

### 完整修复流程

# 1. 备份
cp -r project/ project.backup

# 2. 清理导入
autoflake --remove-all-unused-imports --in-place --recursive project/

# 3. 格式化
black project/

# 4. 验证
python3 scripts/lsp-service.py check project/main.py

### 诊断严重性级别

级别代码含义❌1Error (错误)⚠️2Warning (警告)ℹ️3Information (信息)💡4Hint (提示)

### 常见问题代码

代码含义修复方法E402导入不在文件顶部移动导入到文件开头E501行太长 (>79 字符)拆分长行或使用括号W293空行包含空白字符删除行尾空格E302缺少空行函数/类定义前加 2 个空行E712布尔比较风格if x is True → if x

### 在 OpenClaw 中使用

exec: python3 /path/to/lsp-python/scripts/lsp-service.py check <file>

### 批量检查项目

# 检查所有 Python 文件
find . -name "*.py" -exec python3 scripts/lsp-service.py check {} \\;

# 仅显示有问题的文件
for f in $(find . -name "*.py"); do
  result=$(python3 scripts/lsp-service.py check "$f" 2>&1)
  if ! echo "$result" | grep -q "✅ 没有发现问题"; then
    echo "=== $f ==="
    echo "$result"
  fi
done

### 参考资料

LSP 协议详解: 见 references/lsp-protocol.md
pylsp 配置: 见 references/pylsp-config.md
代码风格指南: 见 references/pep8-guide.md

### pylsp 无法启动

# 检查安装
which pylsp
pylsp --version

# 重新安装
pip install --upgrade python-lsp-server

### 检查超时

增加脚本中的 LSP_TIMEOUT 值 (默认 10 秒)。

### 中文字符问题

确保文件使用 UTF-8 编码，脚本已设置 ensure_ascii=False。
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: genify
- Version: 1.1.0
## Source health
- Status: healthy
- Item download looks usable.
- Yavira can redirect you to the upstream package for this item.
- Health scope: item
- Reason: direct_download_ok
- Checked at: 2026-05-04T20:39:51.395Z
- Expires at: 2026-05-11T20:39:51.395Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/lsp-python)
- [Send to Agent page](https://openagent3.xyz/skills/lsp-python/agent)
- [JSON manifest](https://openagent3.xyz/skills/lsp-python/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/lsp-python/agent.md)
- [Download page](https://openagent3.xyz/downloads/lsp-python)