skillpi/
├── src/skillpi/ # Python 源代码
│ ├── __init__.py # 包初始化
│ ├── models.py # 数据模型定义
│ ├── cli.py # 命令行接口
│ ├── scrapers/ # 文档爬虫模块
│ │ ├── __init__.py
│ │ ├── base.py # 爬虫基类
│ │ ├── github.py # GitHub 爬虫
│ │ ├── pypi.py # PyPI 爬虫
│ │ └── biorxiv.py # bioRxiv 爬虫
│ ├── generators/ # 文档生成器
│ │ ├── __init__.py
│ │ └── mkdocs_gen.py # MkDocs 生成器
│ └── wrappers.py # Snakemake wrappers
├── pipelines/ # Snakemake workflows
│ └── Snakefile
├── scripts/ # Pipeline 脚本
│ ├── fetch_github.py
│ ├── fetch_pypi.py
│ ├── merge_skills.py
│ └── generate_docs.py
├── data/
│ ├── sources.yaml # 数据源配置
│ └── skills/ # 生成的技能数据
├── docs/ # 文档网站
│ ├── index.md
│ └── about.md
├── tests/ # 测试文件
│ ├── test_models.py
│ ├── test_scrapers.py
│ ├── test_cli.py
│ └── conftest.py
├── pyproject.toml # 项目配置
├── mkdocs.yml # MkDocs 配置
└── config.yaml # SkillPI 配置
# 克隆仓库
git clone https://github.com/yourusername/skillpi.git
cd skillpi
# 创建虚拟环境
python -m venv venv
source venv/bin/activate # Linux/Mac
# or
.\venv\Scripts\activate # Windows
# 安装开发依赖
pip install -e ".[dev,pipeline]"编辑 data/sources.yaml 添加新工具:
github_repos:
- url: "https://github.com/new/tool"
type: tool
category: new_category
priority: highcd pipelines
snakemake --cores allmkdocs serve
# 访问 http://localhost:8000pytest -vblack src/ tests/
ruff check src/ tests/- 在
src/skillpi/scrapers/创建新的爬虫文件 - 继承
BaseScraper类 - 实现
scrape_tool,scrape_workflow,scrape_concept方法 - 在
__init__.py中导出
示例:
from .base import BaseScraper
class NewScraper(BaseScraper):
def scrape_tool(self, url: str):
# 实现抓取逻辑
pass- 在
src/skillpi/generators/创建新的生成器 - 实现
generate()方法 - 在 CLI 中添加新的生成选项
# 更新版本号 (src/skillpi/__init__.py)
# 创建 tag
git tag -a v0.1.0 -m "Release v0.1.0"
git push origin v0.1.0
# GitHub Actions 会自动发布到 PyPIA: 使用 logging 模块添加调试信息:
import logging
logging.basicConfig(level=logging.DEBUG)A: 在 config.yaml 中设置 rate_limit_wait: true,或在爬虫中添加延迟:
import time
time.sleep(1) # 请求间延迟 1 秒A:
- Fork 仓库
- 创建功能分支 (
git checkout -b feature/amazing-feature) - 提交更改 (
git commit -m 'Add amazing feature') - 推送到分支 (
git push origin feature/amazing-feature) - 创建 Pull Request