chore: migrate to uv pyproject.toml for dependency management
- Add pyproject.toml with project dependencies - Remove inline script metadata from yaml2pptx.py - Update openspec/config.yaml development guidelines - Update README.md and README_DEV.md documentation - Archive change: migrate-to-uv-package-management
This commit is contained in:
@@ -186,7 +186,7 @@ python yaml2pptx.py input.yaml output.pptx
|
||||
```
|
||||
|
||||
**依赖管理**:
|
||||
- 所有依赖在 `yaml2pptx.py` 的 `/// script` 头部声明
|
||||
- 所有依赖在 `pyproject.toml` 的 `[project.dependencies]` 中声明
|
||||
- uv 会自动安装依赖,无需手动 `pip install`
|
||||
|
||||
### 2. 命令行接口
|
||||
@@ -519,22 +519,20 @@ uv run yaml2pptx.py preview temp/test.yaml --no-browser
|
||||
|
||||
### Q: 为什么不能直接使用 python 运行脚本?
|
||||
|
||||
A: 项目使用 uv 的 Inline script metadata 来管理依赖。直接使用 python 会导致依赖缺失。必须使用 `uv run yaml2pptx.py`。
|
||||
A: 项目使用 uv 和 pyproject.toml 来管理依赖。直接使用 python 会导致依赖缺失。必须使用 `uv run yaml2pptx.py`。
|
||||
|
||||
### Q: 如何添加新的依赖?
|
||||
|
||||
A: 在 `yaml2pptx.py` 的 `/// script` 头部添加:
|
||||
```python
|
||||
# /// script
|
||||
# requires-python = ">=3.8"
|
||||
# dependencies = [
|
||||
# "python-pptx",
|
||||
# "pyyaml",
|
||||
# "flask",
|
||||
# "watchdog",
|
||||
# "new-dependency", # 添加新依赖
|
||||
# ]
|
||||
# ///
|
||||
A: 在 `pyproject.toml` 的 `[project.dependencies]` 中添加:
|
||||
```toml
|
||||
[project]
|
||||
dependencies = [
|
||||
"python-pptx",
|
||||
"pyyaml",
|
||||
"flask",
|
||||
"watchdog",
|
||||
"new-dependency", # 添加新依赖
|
||||
]
|
||||
```
|
||||
|
||||
### Q: 为什么元素使用 dataclass 而不是普通字典?
|
||||
|
||||
Reference in New Issue
Block a user