[Feature]distinguish whl version#7204
Conversation
|
Thanks for your contribution! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #7204 +/- ##
==========================================
Coverage ? 73.26%
==========================================
Files ? 376
Lines ? 52949
Branches ? 8264
==========================================
Hits ? 38791
Misses ? 11445
Partials ? 2713
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fastdeploy-bot
left a comment
There was a problem hiding this comment.
🤖 AI Code Review |
2026-04-07 14:15 CST
📋 Review 摘要
PR 概述:将 wheel 包的 Python/ABI/Platform 标签从硬编码值改为使用 packaging.tags 动态获取,使生成的 wheel 文件名能准确反映当前构建环境。
变更范围:setup.py (构建配置)
影响面 Tag:Others
📝 PR 规范检查
PR 描述中 Motivation 和 Modifications 部分未填写具体内容,建议补充说明变更目的和具体修改。
描述模板(可直接复制):
## Motivation
将 wheel 包标签从硬编码的 `py3-none-any` 改为动态获取的系统标签,使生成的 wheel 文件名能准确反映 Python 版本、ABI 和目标平台。
## Modifications
1. 新增 `from packaging import tags` 导入
2. 在 `CustomBdistWheel.finalize_options()` 中使用 `tags.sys_tags()` 获取当前系统的首选标签
3. 将 `python_tag`、`abi_tag`、`plat_name` 设置为动态获取的值问题
| 级别 | 文件 | 概述 |
|---|---|---|
| 🟡 建议 | setup.py:30 |
packaging 包未在 requirements.txt 中显式声明为依赖 |
总体评价
变更逻辑清晰,能有效区分不同环境构建的 wheel 包。建议补充 packaging 的显式依赖声明以提高可靠性。
setup.py
Outdated
| from setuptools.command.install import install | ||
| from wheel.bdist_wheel import bdist_wheel | ||
|
|
||
| from packaging import tags |
There was a problem hiding this comment.
🟡 建议 packaging 包未在 requirements.txt 中声明为显式依赖。
虽然 packaging 通常作为 setuptools 或 wheel 的传递依赖被安装,但直接导入它而不显式声明依赖可能会导致以下风险:
- 在某些最小化安装环境中可能找不到
packaging - 无法控制
packaging的版本,tagsAPI 在不同版本中可能有变化
建议:在 requirements.txt 中添加显式依赖:
packaging>=20.0
* [Feature]whl version * [Feature]whl version,set root_is_pure = false * [Feature]code style
|
✅ Cherry-pick successful! Created PR: #7223 |
* [Feature]whl version * [Feature]whl version,set root_is_pure = false * [Feature]code style
|
✅ Cherry-pick successful! Created PR: #7224 |
|
ℹ️ Cherry-pick PR already exists: #7223 |
* [Feature]whl version * [Feature]whl version,set root_is_pure = false * [Feature]code style
* [Feature]whl version * [Feature]whl version,set root_is_pure = false * [Feature]code style
|
ℹ️ Cherry-pick PR already exists: #7224 |
fastdeploy-bot
left a comment
There was a problem hiding this comment.
🤖 AI Code Review |
2026-04-08
📋 Review 摘要
PR 概述:将 FastDeploy wheel 包从纯 Python 包(py3-none-any)改为平台相关包,使用 packaging.tags 动态获取 Python/ABI/平台标签
变更范围:setup.py
影响面 Tag:[CI] [Feature]
📝 PR 规范检查
✅ 标题格式正确,包含 [Feature] 标签
❌ PR 描述不够完整,建议在 Modifications 部分补充说明具体改动内容
描述建议(可直接复制):
## Modifications
- 将 `CustomBdistWheel` 从纯 Python 包(`py3-none-any`)改为平台相关包
- 使用 `packaging.tags.sys_tags()` 动态获取 `{python tag}-{abi tag}-{platform tag}`
- 新增 `packaging` 依赖导入发现的问题
| 级别 | 文件 | 概述 |
|---|---|---|
| 🟡 建议 | setup.py:26 |
新增 packaging 导入但未在 requirements.txt 中显式声明依赖 |
| 🟡 建议 | setup.py:51 |
next(tags.sys_tags()) 缺少异常处理 |
总体评价
改动的动机是合理的(FastDeploy 包含 C++ 扩展,应标记为平台相关),但建议显式声明 packaging 依赖并添加异常处理以确保健壮性。
| from pathlib import Path | ||
|
|
||
| import paddle | ||
| from packaging import tags |
There was a problem hiding this comment.
🟡 建议 新增了 from packaging import tags,但在 requirements.txt 等依赖文件中未显式声明 packaging 依赖。
虽然 packaging 可能被其他依赖(如 setuptools-scm)间接引入,但为了确保环境一致性,建议显式声明:
# 在 requirements.txt 等文件中添加:
+packaging| self.root_is_pure = True | ||
| self.python_tag = "py3" | ||
| self.abi_tag = "none" | ||
| tag = next(tags.sys_tags()) |
There was a problem hiding this comment.
🟡 建议 next(tags.sys_tags()) 在极端情况下可能抛出 StopIteration 异常(如非常老的 Python 版本或特殊环境)。
建议添加异常处理或默认值:
tag = next(tags.sys_tags(), None)
if tag is None:
# Fallback to safe defaults
tag = type('obj', (object,), {
'interpreter': 'py3',
'abi': 'none',
'platform': 'any'
})()
self.python_tag = tag.interpreter
self.abi_tag = tag.abi
self.plat_name = tag.platform
Motivation
rename whl
Modifications
Usage or Command
Accuracy Tests
Checklist
[FDConfig],[APIServer],[Engine],[Scheduler],[PD Disaggregation],[Executor],[Graph Optimization],[Speculative Decoding],[RL],[Models],[Quantization],[Loader],[OP],[KVCache],[DataProcessor],[BugFix],[Docs],[CI],[Optimization],[Feature],[Benchmark],[Others],[XPU],[HPU],[GCU],[DCU],[Iluvatar],[Metax]]pre-commitbefore commit.releasebranch, make sure the PR has been submitted to thedevelopbranch, then cherry-pick it to thereleasebranch with the[Cherry-Pick]PR tag.