[U] Wrap into uv tool.

This commit is contained in:
2026-03-20 20:19:33 +08:00
parent db20b739cd
commit ca9e32763e
14 changed files with 844 additions and 433 deletions

View File

@@ -35,6 +35,7 @@ config-man/
│ └── test_data/ # 测试数据目录
├── docs/ # 文档目录
│ ├── README.md # 文档说明
│ ├── uv-tool.md # uv tool 使用与发布说明
│ ├── USAGE.md # 使用说明
│ ├── progress-tracker.md # 进度跟踪
│ ├── requirements.md # 需求文档
@@ -110,7 +111,7 @@ config-man/
### 4. 标准化
- 遵循Python项目标准结构
- 使用现代Python工具链
- 支持pip安装和开发模式
- 支持 `uv tool` 分发和标准包构建
## 开发工作流
@@ -125,40 +126,46 @@ config-man/
### 2. 运行测试
```bash
# 运行所有测试
pytest
uv run pytest
# 运行单元测试
pytest tests/unit/
uv run pytest tests/unit/
# 运行集成测试
pytest tests/integration/
uv run pytest tests/integration/
# 生成覆盖率报告
pytest --cov=src/config_man
uv run pytest --cov=src/config_man
```
### 3. 代码质量检查
```bash
# 代码格式化
black src/ tests/
uv run black src/ tests/
# 类型检查
mypy src/
uv run mypy src/
# 代码检查
flake8 src/ tests/
uv run flake8 src/ tests/
```
### 4. 安装和发布
```bash
# 开发模式安装
pip install -e .
# 从源码临时运行 CLI
uv tool run --from . config-man --help
# 安装为本地工具
uv tool install --from . config-man
# 构建包
python -m build
uv build
# 发布到PyPI
twine upload dist/
# 验证 wheel 产物
uv tool run --from dist/*.whl config-man --help
# 发布到包索引(按你的发布方式选择)
uv publish
```
## 最佳实践
@@ -177,6 +184,7 @@ twine upload dist/
- 代码和文档同步更新
- 提供完整的使用示例
- 保持文档结构清晰
- 优先保证 `README.md``docs/uv-tool.md``docs/USAGE.md` 中的命令入口一致
### 4. 版本控制
- 合理的.gitignore配置