- 添加 Windows 平台依赖验证结果到 docs/upgrade-deps-prompt.md - 更新 openspec 配置,移除 pyproject.toml 相关说明 - 同步 upgrade-deps 变更的 delta specs 到主规范 - multi-platform-dependencies: 新增平台验证和版本文档化要求 - uv-with-dependency-management: 新增命令验证和版本一致性要求 - 归档 upgrade-deps 变更至 openspec/changes/archive/2026-03-19-upgrade-deps/
127 lines
4.4 KiB
Markdown
127 lines
4.4 KiB
Markdown
# 依赖版本优化流程提示词
|
||
|
||
## 任务概述
|
||
|
||
重新梳理 `scripts/config.py` 中 `DEPENDENCIES` 的版本号和 python 版本。
|
||
|
||
## 核心原则
|
||
|
||
1. **default 的 python 版本始终使用 None**,即默认 python 版本
|
||
2. **实在需要指定 python 版本时**,才在具体的系统依赖(如 Darwin-x86_64)中指定 python 版本,而不是改 default 中的 python 版本
|
||
3. **dependencies 中的依赖都需要指定版本**
|
||
- 以当前时间点的最新版本指定
|
||
- 如果最新版本无法满足,才在指定系统依赖中探索能运行的最新依赖版本号
|
||
|
||
## 推荐流程
|
||
|
||
### 阶段 1:规范梳理
|
||
|
||
1. 确定需要检查的依赖列表
|
||
2. 确定版本查询方法(如 PyPI JSON API)
|
||
3. 确定测试验证流程
|
||
|
||
### 阶段 2:版本探索(实现阶段)
|
||
|
||
1. **先移除所有特定当前平台配置**,只保留 default
|
||
2. **default 配置使用最新版本作为标杆**
|
||
3. **逐个文件类型测试**
|
||
- 先测试 default 配置
|
||
- 若 default 失败,再添加特定平台配置并探索可运行的最新版本
|
||
4. **所有依赖(无论之前是否指定版本)都重新探索**
|
||
|
||
### 阶段 3:配置更新
|
||
|
||
1. 修改 `default.python = None`
|
||
2. 更新所有依赖到指定版本
|
||
3. 保留/调整特定平台的特殊配置
|
||
|
||
## 关键文件
|
||
|
||
- `scripts/config.py` - DEPENDENCIES 配置
|
||
- `run_tests.py` - 测试运行器(包含 TEST_FIXTURE_DEPENDENCIES)
|
||
- `openspec/changes/` - OpenSpec 变更目录
|
||
|
||
## 常用 PyPI 版本查询
|
||
|
||
使用 Python 查询 PyPI 最新版本:
|
||
|
||
```python
|
||
import json
|
||
import urllib.request
|
||
|
||
def get_latest_version(package):
|
||
try:
|
||
url = f'https://pypi.org/pypi/{package}/json'
|
||
with urllib.request.urlopen(url, timeout=15) as f:
|
||
data = json.load(f)
|
||
return data['info']['version']
|
||
except Exception as e:
|
||
return f'error: {e}'
|
||
```
|
||
|
||
## Windows 平台验证结果(2026-03-19)
|
||
|
||
### 验证状态:✓ 通过
|
||
|
||
**测试结果:**
|
||
- 所有文件类型的依赖安装测试通过
|
||
- 功能测试:295/303 测试通过
|
||
- 8 个已知失败(中文字符 PDF 解析、LibreOffice DOCX)
|
||
|
||
**验证通过的依赖:**
|
||
- PDF: docling 2.80.0, unstructured[pdf] 0.21.5, markitdown[pdf] 0.1.5, pypdf 6.9.0, markdownify 1.2.2
|
||
- DOCX: docling 2.80.0, unstructured[docx] 0.21.5, markitdown[docx] 0.1.5, pypandoc-binary 1.17, python-docx 1.2.0
|
||
- XLSX: docling 2.80.0, unstructured[xlsx] 0.21.5, markitdown[xlsx] 0.1.5, pandas 3.0.1, openpyxl 3.1.5
|
||
- PPTX: docling 2.80.0, unstructured[pptx] 0.21.5, markitdown[pptx] 0.1.5, python-pptx 1.0.2
|
||
- HTML: trafilatura 2.0.0, domscribe 0.1.3, markitdown 0.1.5, html2text 2025.4.15, beautifulsoup4 4.14.3
|
||
- XLS: unstructured[xlsx] 0.21.5, markitdown[xls] 0.1.5, pandas 3.0.1, xlrd 2.0.2, olefile 0.47
|
||
- PPT: docling 2.80.0, unstructured[pptx] 0.21.5, markitdown[pptx] 0.1.5, python-pptx 1.0.2, olefile 0.47
|
||
|
||
**已知问题:**
|
||
1. 中文字符在临时 PDF 生成中显示为 `<!-- image -->`(测试环境字体问题,不影响实际使用)
|
||
|
||
## 本次(2026-03-17)的经验总结
|
||
|
||
### Darwin-x86_64 平台的已知问题
|
||
|
||
1. **torch 无 Darwin-x86_64 wheel**(docling 2.80.0 依赖 torch)
|
||
- 解决:使用 docling 2.40.0 + docling-parse 4.0.0 + numpy<2
|
||
2. **onnxruntime 无 Darwin-x86_64 + Python 3.14 wheel**(markitdown 依赖)
|
||
- 解决:指定 python 3.12
|
||
3. **pyppeteer 2.0.0 与 selenium 4.41.0 的 urllib3 版本冲突**
|
||
- 解决:selenium 降级到 4.25.0
|
||
4. **pandas 3.0.1 与 fixtures 依赖 pandas<3.0.0 冲突**
|
||
- 解决:特定平台使用 pandas<3.0.0
|
||
|
||
### 当前依赖版本列表(截止 2026-03-19,Windows 验证通过)
|
||
|
||
| 依赖 | 版本 |
|
||
|------|------|
|
||
| docling | 2.80.0 (default) / 2.40.0 (Darwin-x86_64) |
|
||
| docling-parse | 5.5.0 (default) / 4.0.0 (Darwin-x86_64) |
|
||
| unstructured[...] | 0.21.5 |
|
||
| markitdown[...] | 0.1.5 |
|
||
| pypdf | 6.9.0 |
|
||
| markdownify | 1.2.2 |
|
||
| pypandoc-binary | 1.17 |
|
||
| python-docx | 1.2.0 |
|
||
| pandas | 3.0.1 (default) / <3.0.0 (Darwin-x86_64) |
|
||
| tabulate | 0.10.0 |
|
||
| openpyxl | 3.1.5 |
|
||
| python-pptx | 1.0.2 |
|
||
| trafilatura | 2.0.0 |
|
||
| domscribe | 0.1.3 |
|
||
| html2text | 2025.4.15 |
|
||
| beautifulsoup4 | 4.14.3 |
|
||
| httpx | 0.28.1 |
|
||
| chardet | 7.1.0 |
|
||
| pyppeteer | 2.0.0 |
|
||
| selenium | 4.25.0 (Darwin-x86_64) |
|
||
| xlrd | 2.0.2 |
|
||
| olefile | 0.47 |
|
||
| numpy | <2 (Darwin-x86_64) |
|
||
|
||
## 创建 OpenSpec 变更
|
||
|
||
使用 `/opsx:new` 或 `/opsx:ff` 创建变更,使用 spec-driven 工作流。
|