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
+9 -1
View File
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "easy-tdx"
version = "1.19.4"
version = "1.19.5"
description = "通达信 TCP 协议行情数据客户端,支持在线行情、离线数据读取与写入同步"
readme = "README.md"
requires-python = ">=3.10"
@@ -23,6 +23,14 @@ packaging = ["pystray>=0.19", "Pillow>=10.0"]
[tool.hatch.build.targets.wheel]
packages = ["src/easy_tdx"]
# 前端 dist 作为数据文件打进 wheel,让 PyPI 安装的用户也能开箱即用 web UI。
# 前端必须先构建到 web-ui/dist/release.yml / publish.yml 都会先 npm run build)。
# 映射到包内 easy_tdx/web/dist/,运行时由 _resolve_web_dist_dir 第 4 级探测。
artifacts = [
"src/easy_tdx/web/dist",
]
[tool.hatch.build.targets.wheel.force-include]
"web-ui/dist" = "easy_tdx/web/dist"
[tool.mypy]
strict = true