Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

chore(tooling): 接入 uv 安装与构建

longmeidao0be070a5fceb
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index feb92c7c4..eb2c875dd 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -44,11 +44,19 @@ jobs:
if ($env:GITHUB_REF_TYPE -eq 'tag' -and $env:GITHUB_REF_NAME -ne "v${ReleaseVersion}") { throw 'Tag 与版本不一致' }
"version=${ReleaseVersion}" >> $env:GITHUB_OUTPUT
- name: 安装构建依赖
+ uses: astral-sh/[email protected]
+ with:
+ enable-cache: true
+ cache-dependency-glob: pyproject.toml
+ - name: 创建构建环境
shell: pwsh
run: |
- python -m venv .venv
- & ./.venv/Scripts/python.exe -m pip install --no-cache-dir -e '.[build]'
- & ./.venv/Scripts/python.exe -m pip check
+ uv venv --python python .venv
+ if ($LASTEXITCODE -ne 0) { throw 'uv venv 失败' }
+ uv pip install --python .venv/Scripts/python.exe -e '.[build]'
+ if ($LASTEXITCODE -ne 0) { throw 'uv 安装依赖失败' }
+ uv pip check --python .venv/Scripts/python.exe
+ if ($LASTEXITCODE -ne 0) { throw 'uv 依赖检查失败' }
- name: 构建独立目录包
shell: pwsh
run: '& ./scripts/build_windows.ps1 -Standalone'
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 41fcd4a14..17ed54f5c 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -28,7 +28,11 @@ jobs:
- uses: actions/setup-python@v7
with:
python-version: '3.14'
- - run: python -m pip wheel . --no-deps --no-cache-dir -w wheelhouse
+ - uses: astral-sh/[email protected]
+ with:
+ enable-cache: true
+ cache-dependency-glob: pyproject.toml
+ - run: uv build --wheel --out-dir wheelhouse
- uses: actions/upload-artifact@v7
with:
name: wheel-smoke
@@ -76,17 +80,22 @@ jobs:
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python }}
- cache: pip
check-latest: true
+ - uses: astral-sh/[email protected]
+ with:
+ enable-cache: true
+ cache-dependency-glob: pyproject.toml
- name: 安装 Windows 依赖
if: runner.os == 'Windows'
shell: pwsh
run: |
- python -m venv .venv
- & .\.venv\Scripts\python.exe -m pip install --upgrade pip
- & .\.venv\Scripts\python.exe -m pip install -e ".[dev,build,vision,maintenance-115,naming]"
- & .\.venv\Scripts\python.exe -m pip check
+ uv venv --python python .venv
+ if ($LASTEXITCODE -ne 0) { throw 'uv venv 失败' }
+ uv pip install --python .venv/Scripts/python.exe -e ".[dev,build,vision,maintenance-115,naming]"
+ if ($LASTEXITCODE -ne 0) { throw 'uv 安装依赖失败' }
+ uv pip check --python .venv/Scripts/python.exe
+ if ($LASTEXITCODE -ne 0) { throw 'uv 依赖检查失败' }
- name: 运行 Windows 正式测试
if: runner.os == 'Windows'
@@ -97,10 +106,9 @@ jobs:
if: runner.os == 'macOS'
shell: bash
run: |
- python -m venv .venv
- ./.venv/bin/python -m pip install --upgrade pip
- ./.venv/bin/python -m pip install -e ".[dev,build,macos,vision,maintenance-115,naming]"
- ./.venv/bin/python -m pip check
+ uv venv --python python .venv
+ uv pip install --python .venv/bin/python -e ".[dev,build,macos,vision,maintenance-115,naming]"
+ uv pip check --python .venv/bin/python
- name: 运行 macOS 正式测试
if: runner.os == 'macOS'
diff --git a/README.en.md b/README.en.md
index ab15453a8..e4a583c49 100644
--- a/README.en.md
+++ b/README.en.md
@@ -71,7 +71,7 @@ The package is unsigned; see [Windows testing](docs/TESTING_DESKTOP.md) for down
### Run from source
-Requires Git and **Python 3.12 or newer**. These examples use 3.14; CI covers 3.12 and 3.14.
+Requires Git, [uv](https://docs.astral.sh/uv/getting-started/installation/) **0.12.10** and **Python 3.12 or newer**. These examples use 3.14; uv can download a missing Python interpreter. CI covers 3.12 and 3.14.
Node is unnecessary at runtime; frontend development needs Node 24 or newer.
Clone the repository:
@@ -84,16 +84,16 @@ cd peach-app
Windows: create the environment, install and launch setup in PowerShell:
```powershell
-& py -3.14 -m venv .venv
-& .\.venv\Scripts\python.exe -m pip install -e .
+uv venv --python 3.14 .venv
+uv pip install --python .venv/Scripts/python.exe -e .
& .\.venv\Scripts\peach-tray.exe
```
macOS: create the environment, install menu-bar support and launch setup:
```shell
-python3.14 -m venv .venv
-./.venv/bin/python -m pip install -e ".[macos]"
+uv venv --python 3.14 .venv
+uv pip install --python .venv/bin/python -e ".[macos]"
./.venv/bin/peach-tray
```
diff --git a/README.md b/README.md
index 4a408edec..43fb5fa7d 100644
--- a/README.md
+++ b/README.md
@@ -71,7 +71,7 @@ FFmpeg 与 ffprobe 需另装;缺少它们时可浏览和播放浏览器兼容
### 源码运行
-需要 Git、**Python 3.12 或更高**。下面示例使用 3.14,CI 覆盖 3.12 与 3.14。
+需要 Git、[uv](https://docs.astral.sh/uv/getting-started/installation/) **0.12.10** 和 **Python 3.12 或更高**。下面示例使用 3.14,uv 可自动下载缺失的 Python;CI 覆盖 3.12 与 3.14。
普通运行不需要 Node;修改前端需要 Node 24 或更高。
先克隆仓库并进入目录:
@@ -84,16 +84,16 @@ cd peach-app
Windows:在 PowerShell 创建环境、安装并启动首次设置:
```powershell
-& py -3.14 -m venv .venv
-& .\.venv\Scripts\python.exe -m pip install -e .
+uv venv --python 3.14 .venv
+uv pip install --python .venv/Scripts/python.exe -e .
& .\.venv\Scripts\peach-tray.exe
```
macOS:在终端创建环境、安装菜单栏依赖并启动首次设置:
```shell
-python3.14 -m venv .venv
-./.venv/bin/python -m pip install -e ".[macos]"
+uv venv --python 3.14 .venv
+uv pip install --python .venv/bin/python -e ".[macos]"
./.venv/bin/peach-tray
```
diff --git a/docs/HANDOFF.md b/docs/HANDOFF.md
index fd2b7494b..dd1940d46 100644
--- a/docs/HANDOFF.md
+++ b/docs/HANDOFF.md
@@ -34,6 +34,8 @@
## 无摩擦接手
+- uv 安装见 README;复用决策见 REUSE。
+
- Codex 自动读取项目层级中的 `AGENTS.md`;Claude Code 通过 `CLAUDE.md` 导入同一文件。技能只有 Claude 侧封装(`.claude/skills/`),Codex 不自动加载,只能靠 `AGENTS.md` 索引表主动读同一份文件。
- 正式测试入口为 Windows `& .\scripts\test.ps1`、macOS/Linux `./scripts/test.sh`。默认 `auto` 按影响域取并集,共享设施和未知影响面选全量;CI 与发布显式 `full`。测试证据复用、集成互斥和工作树锁定见 `peach-worktree` 技能。
- 两个智能体使用同一入口,按任务读取相关文档;交接更新长期文件。
diff --git a/docs/REUSE.md b/docs/REUSE.md
index ece7b071f..a5e568e75 100644
--- a/docs/REUSE.md
+++ b/docs/REUSE.md
@@ -7,6 +7,11 @@ JAV 默认封面(官方封面/预览图)与默认大小(大图/小图
## 复用决策门槛
+- Python 安装与构建复用 [uv 0.12.10](https://github.com/astral-sh/uv/releases/tag/0.12.10) 和官方 setup-uv 10.0.1,Astral 持续维护,许可证分别为 MIT/Apache-2.0 与 MIT。
+ uv 支持 Windows/macOS,本机 Windows wheel 18.1 MB,不进入 Peach 运行包。当前树、历史与本文已有 venv、pip 和 setuptools 入口;uv pip/venv/build 直接复用这些契约,不新增安装器。
+ 隔离 Python 3.14 环境实装 105 个包、uv pip check 与 wheel 构建通过。CI 保留 Python 3.12/3.14 矩阵和普通 pip 安装 wheel 的验证。
+ 采用 uv 的 pip 接口,保留主目录共享 venv;uv sync 的精确同步会移除未选 extras,不适用于正在提供服务的共享环境。pyproject 固定直接依赖,不新增传递锁文件;生产环境与 ledger 未改动。
+
- 访问密码复用 Python 3.14 的 [hashlib.scrypt](https://docs.python.org/3.14/library/hashlib.html) 与 OpenSSL,浏览器会话复用 [ItsDangerous 2.2.0](https://itsdangerous.palletsprojects.com/en/stable/)(Pallets 维护、BSD-3-Clause、Python 3.8+、纯 Python、wheel 16 KB、无传递依赖);本机原子配置写入复用 tempfile/os.replace,并将已有 filelock 3.32.4 纳入运行依赖。当前树和 Git 的认证入口已有内部口令、三种拒绝响应和本机配置守卫,继续复用。Starlette SessionMiddleware 采用统一时长并随响应更新会话,不满足每台设备选择固定截止时间的要求;直接使用同源签名库,由 Peach 维护可选密码、截止时间与撤销策略。临时文件 POC 的密码验证、签名验证和篡改拒绝通过,耗时 0.153 秒;真实凭据未读取。新增依赖不包含账户体系或数据库迁移。
- README 交付检查复用系统 Git 的 `diff --no-renames -z` 和 `interpret-trailers --parse`,
diff --git a/pyproject.toml b/pyproject.toml
index d38b02ecb..7d0018a1e 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -69,6 +69,9 @@ naming = ["opencc==1.4.2"]
[tool.setuptools]
package-dir = {"" = "src"}
+[tool.uv]
+required-version = "==0.12.10"
+
[tool.setuptools.dynamic]
version = {attr = "peach.__version__"}
diff --git a/scripts/build_windows.ps1 b/scripts/build_windows.ps1
index 432027e79..900fa19bb 100644
--- a/scripts/build_windows.ps1
+++ b/scripts/build_windows.ps1
@@ -22,7 +22,7 @@ if (-not (Test-Path -LiteralPath $Python -PathType Leaf)) {
& $Python -m PyInstaller --version *> $null
if ($LASTEXITCODE -ne 0) {
- throw 'PyInstaller is not installed in the project venv. Install it with: python -m pip install pyinstaller'
+ throw 'PyInstaller is not installed in the project venv. Install it with: uv pip install --python .venv/Scripts/python.exe -e ".[build]"'
}
if (-not (Test-Path -LiteralPath (Join-Path $ProjectRoot 'resources\peach.ico') -PathType Leaf)) {
diff --git a/scripts/vendor_web_dependencies.mjs b/scripts/vendor_web_dependencies.mjs
index 0d76b0f73..8cff134a4 100644
--- a/scripts/vendor_web_dependencies.mjs
+++ b/scripts/vendor_web_dependencies.mjs
@@ -97,7 +97,7 @@ const lucideIcons = new Map([
// 自绘 symbol:没有上游可对,所以在这里逐个点名。下面那道分区检查要求雪碧图里
// 每一枚要么由某一套生成、要么写在这张名单上——漏一枚就会被当成忘了纳管。
const handDrawnIcons = new Set([
- "alert", "pics", "jav", "theater-enter", "theater-exit", "brand-x",
+ "alert", "pics", "jav", "theater-enter", "theater-exit", "brand-x", "brand-x-cut",
]);
const svgInner = source => {
diff --git a/tests/test_dependency_policy.py b/tests/test_dependency_policy.py
index e49df0899..548b5b132 100644
--- a/tests/test_dependency_policy.py
+++ b/tests/test_dependency_policy.py
@@ -136,6 +136,21 @@ class DependencyPolicyTests(unittest.TestCase):
self.assertIn("& .\\scripts\\test.ps1", workflow)
self.assertIn("./scripts/test.sh", workflow)
+ def test_uv_installation_preserves_interpreter_and_wheel_contracts(self):
+ self.assertRegex(self.pyproject["tool"]["uv"]["required-version"],
+ r"^==\d+\.\d+\.\d+$")
+ workflow = (ROOT / ".github/workflows/test.yml").read_text(encoding="utf-8")
+ release = (ROOT / ".github/workflows/release.yml").read_text(encoding="utf-8")
+ for source in (workflow, release):
+ self.assertIn("astral-sh/setup-uv@", source)
+ self.assertIn("cache-dependency-glob: pyproject.toml", source)
+ self.assertIn("uv venv --python python .venv", source)
+ self.assertIn("uv pip check --python .venv/Scripts/python.exe", source)
+ self.assertIn("if ($LASTEXITCODE -ne 0)", source)
+ self.assertIn("uv pip check --python .venv/bin/python", workflow)
+ self.assertIn("uv build --wheel --out-dir wheelhouse", workflow)
+ self.assertIn("python -m pip install --no-cache-dir wheelhouse/*.whl", workflow)
+
if __name__ == "__main__":
unittest.main()
diff --git a/web/vendor/lucide-ORIGIN.md b/web/vendor/lucide-ORIGIN.md
index bb55e0509..dbb0f4b58 100644
--- a/web/vendor/lucide-ORIGIN.md
+++ b/web/vendor/lucide-ORIGIN.md
@@ -3,7 +3,7 @@
- npm 包:`[email protected]`
- npm lock integrity:`sha512-/pRaHJceXrQyAMzWfwhWPMwZeiZEIejZ+Ko226AqI52QbLVgowyGAp7OzZIaQEf7XB+LuRGWqUGqTfu3LJ0CQQ==`
- 许可证:ISC;原文见 `lucide-LICENSE.txt`
-- 消费者:`web/index.html` 内联的 64 个 symbol
+- 消费者:`web/index.html` 内联的 65 个 symbol
-雪碧图里另有 6 枚自绘 symbol(alert、pics、jav、theater-enter、theater-exit、brand-x)与 16 枚 player-* 前缀的播放器图标,都没有上游可对。
+雪碧图里另有 7 枚自绘 symbol(alert、pics、jav、theater-enter、theater-exit、brand-x、brand-x-cut)与 16 枚 player-* 前缀的播放器图标,都没有上游可对。
RSS 与拖动点保留填充修正,避免小圆点在全局描边样式下消失。