diff --git a/README.md b/README.md index 97293ac..7a2d0e3 100644 --- a/README.md +++ b/README.md @@ -20,20 +20,29 @@ ## 安装 -使用 [uv](https://docs.astral.sh/uv/) 管理: +本项目不发布到 PyPI,始终通过 git 源码 + tag 管理。要求 Python ≥ 3.12。 + +**在你自己的项目里引用**(用 [uv](https://docs.astral.sh/uv/)): ```bash -uv sync +# 指定 tag(推荐) +uv add 'git+https://git.vercanti.com/yellowdog/mouse_control.git@v0.1.0' + +# 跟随 main +uv add 'git+https://git.vercanti.com/yellowdog/mouse_control.git' + +# 指定 commit +uv add 'git+https://git.vercanti.com/yellowdog/mouse_control.git@' ``` -或从构建产物安装: +**本仓库内开发**: ```bash -uv pip install dist/mouse_control-0.1.0-py3-none-any.whl +uv sync # 安装依赖(含 dev 组的 pytest) +uv run pytest # 跑测试 +uv build # 产出 wheel + sdist ``` -要求 Python ≥ 3.12。 - ## 项目结构 ``` @@ -137,7 +146,7 @@ cv::Mat output = net.forward("output"); // 输出 1*10*2 std::cout << output.at(0, 8, 0) << std::endl; ``` -## 打包发布 +## 打包 ```bash uv build @@ -146,3 +155,21 @@ uv build ``` wheel 内含 `assets/mouse.onnx` 预训练模型,安装后直接 `mc.load_model()` 即可使用。 + +## 发版(tag 驱动) + +`pyproject.toml` 里的 `version` 字段是手动维护的,必须和 git tag 保持同步。 +发版步骤: + +```bash +# 1. 改版本号 +$EDITOR pyproject.toml # version = "0.2.0" + +# 2. 提交并打 tag +git add pyproject.toml +git commit -m "Release v0.2.0" +git tag v0.2.0 +git push && git push --tags +``` + +下游再 `uv add 'git+...@v0.2.0'` 就拿到对应版本。