fix(packaging): v1.19.5 PyPI wheel 含前端 dist(pip install 后不再 404)

根因:PyPI wheel 只有 Python 包,不含前端 dist。_resolve_web_dist_dir
三级探测(env/_MEIPASS/仓库根)在 PyPI 安装环境下全失败返回 None,
StaticFiles 不挂载,GET / 返回 404。

修复:
- pyproject.toml hatchling force-include 把 web-ui/dist 映射到包内
  easy_tdx/web/dist
- publish.yml 在 python -m build 前先 npm ci && npm run build
- _resolve_web_dist_dir 新增第 4 级探测:包内 easy_tdx/web/dist

验证:本地构建 wheel 含 4 个前端文件,模拟 PyPI 安装后第 4 级探测
成功找到 dist。907 测试全过。
This commit is contained in:
Justin Gu
2026-07-07 20:46:26 +08:00
parent 3bc15e620c
commit d5309454bc
4 changed files with 42 additions and 3 deletions
+14
View File
@@ -20,6 +20,20 @@ jobs:
with:
python-version: "3.13"
# 构建前端 → web-ui/dist/hatchling force-include 把它打进 wheel
# 的 easy_tdx/web/dist/,让 pip install easy-tdx[web] 开箱即用 UI。
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: web-ui/package-lock.json
- name: Build frontend
run: |
npm ci
npm run build
working-directory: web-ui
- run: pip install build
- run: python -m build