Rechercher

PythonReactSEOPDF
OpenClaw

lsp-python

Python code quality checking and LSP integration using pylsp. Provides code diagnostics, completion, hover tips, and style analysis. Use when: checking Python errors/warnings, getting code completions, viewing function signatures, analyzing code quality, or fixing style issues.

genify0 installations selon la source☆ 0 Étoiles du dépôt

Installation

Suivez les instructions du dépôt pour votre agent. Consultez les fichiers et dépendances avant l’installation.

SkillHub CLI

skillhub install genify/lsp-python

Examinez la source et la compatibilité, puis suivez les étapes d’installation.

Donnez le lien à votre agent et demandez-lui d’examiner instructions et dépendances avant d’expliquer les étapes.

Voir la source ↗Guides

Instructions

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 --r...

Informations sur la source

Source
github
Repository
openclaw/skills
Path
skills/genify/lsp-python
Version
—
Commit
7cbfc3fa7c13e8c4e4cab6c7c3d1882206f83898
Source de classification
rules
Statut
active
Visibilité
public

Ces informations proviennent de l’analyse indexée et peuvent être anciennes. Vérifiez les fichiers actuels.

Contenu extrait

SKILL.md
# LSP Python 技能

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

## 快速开始

### 1. 检查代码问题

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

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

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

示例:
```bash
python3 scripts/lsp-service.py check my_script.py
python3 scripts/check_python.py src/
python3 scripts/check_python.py --auto-fix src/
```

### 2. 获取代码补全

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

### 3. 查看符号信息

```bash
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)

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

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

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

### 悬停提示 (info)

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

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

### 跳转定义 (goto)

查找符号的定义位置:

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

## 自动修复代码问题

### 清理未使用的导入

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

### 格式化代码

```bash
pip install black
black .
```

### 完整修复流程

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

# 2. 清理导入
autoflake --remove-all-unused-imports --in-place --r...

Skills associés

OpenClaw

x402hub

capncoconut

Register, communicate, and earn on the x402hub AI agent marketplace. Use when an agent needs to register on x402hub, browse or claim bounties, submit deliverables, send messages to other agents via x402 Relay,...

OpenClaw

claw

capevace

Real-time event bus for AI agents. Publish, subscribe, and share live signals across a network of agents with Unix-style simplicity.

OpenClaw

captchas-openclaw

captchasco

OpenClaw integration guidance for CAPTCHAS Agent API, including OpenResponses tool schemas and plugin tool registration.