当前Pull Request已关闭, 关闭人@肾炝喜鲤
变更摘要
此 PR 主要解决在线安装包中配套版本配置文件 release_config.json 可能被遗漏的风险。通过在 setup.py 中显式声明 package_data,确保 ascend_deployer/downloader/release_config.json 随下载器打包分发,保证 ascend-download --show-releases 命令在生产环境中正常工作。同时新增两项回归测试,分别验证 --show-releases 参数的行为正确性以及打包声明的存在性。
主要改动
setup.py显式声明打包数据:新增package_data配置项,将ascend_deployer/downloader/release_config.json显式纳入ascend_deployer包的打包清单,防止构建规则调整导致该配置文件丢失。- 新增
--show-releases行为回归测试:添加test_show_releases_exits_without_download测试用例,通过 mock 验证--show-releases仅调用show_releases()后退出,不会触发download_dependency()下载逻辑。 - 新增打包声明检查测试:添加
test_release_config_declared_as_package_data测试用例,直接读取setup.py文件内容并断言其中包含'ascend_deployer': ['downloader/release_config.json']声明,防止该配置项在未来被意外移除。


代码审查
Now let me produce the closing summary.
审查总结
本次 diff 涉及 2 个文件的变更,审查结论如下:
| 文件 | 审查结果 |
|---|---|
setup.py |
无问题。package_data 声明正确地将 release_config.json 显式纳入打包数据,与 include_package_data=True 配合使用不会产生冲突。 |
test/st/test_download.py |
发现 1 个 P3 问题(脆弱的字符串断言)。新增的 test_show_releases_exits_without_download 测试逻辑正确,mock 目标路径一致、参数顺序正确。 |
按优先级统计:
- P0:0
- P1:0
- P2:0
- P3:1(
test_release_config_declared_as_package_data使用脆弱的精确字符串断言,未来setup.py格式变更时易产生误报)
整体风险评估: 低风险。setup.py 的 package_data 补充是安全网性质的正向变更,新测试的回归覆盖语义正确。唯一的 P3 项是测试工程质量问题,不影响生产代码的正确性或安全性。
⚠️ 已识别出整体风险,但无法提取行内评论,请参考整体评估。


Thanks for your pull-request.
The full list of commands accepted by me can be found at here。
You can get sig-info at here
PR Approval Progress
⚠️ This PR does not yet meet the following requirements:lgtm (requires ≥ 3 person(s) per module)、approve (requires ≥ 1 person(s) per module)
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-Ascend/ascend-deployer | ❌ (0/3)(You can also ask: stitch27, wangfei-w, swagglian_gitcode, yangpeng197, zja4gitcode) | ❌ (0/1)(You can also ask: 康富安, 于书苹, wang-ruiju, yangpeng197, xiangpx) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
weixin_40758092, thanks for your pull request. All authors of the commits have signed the CLA. 👍


| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | Build | ✅ | >>> |
| 恶意代码检查 | Antipoison | ✅ | >>> |
| 编码安全与规范检查 | pre-commit | ✅ | >>> |
| 开源片段检查 | SCA | ✅ | >>> |
| 流水线 | PR-pipeline_ascend-deployer | ✅ | >>> |
- compile : 运行流水线
- retry : 重试流水线所有失败子任务
- retry <任务名> : 仅重试指定失败子任务
- stop : 停止流水线


| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | Build | 🕚 | >>> |
| 恶意代码检查 | Antipoison | 🕚 | >>> |
| 编码安全与规范检查 | pre-commit | 🕚 | >>> |
| 开源片段检查 | SCA | 🕚 | >>> |
| 流水线 | PR-pipeline_ascend-deployer | 🕚 | >>> |
- compile : 运行流水线
- retry : 重试流水线所有失败子任务
- retry <任务名> : 仅重试指定失败子任务
- stop : 停止流水线


compile


| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | Build | ✅ | >>> |
| 恶意代码检查 | Antipoison | ✅ | >>> |
| 编码安全与规范检查 | pre-commit | ✅ | >>> |
| 开源片段检查 | SCA | ✅ | >>> |
| 流水线 | PR-pipeline_ascend-deployer | ✅ | >>> |
- compile : 运行流水线
- retry : 重试流水线所有失败子任务
- retry <任务名> : 仅重试指定失败子任务
- stop : 停止流水线


ascend docs pipeline is running...


✅ 跳过 docs ci 检查,没有需要检查的文档文件


| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | Build | ✅ | >>> |
| 恶意代码检查 | Antipoison | ✅ | >>> |
| 编码安全与规范检查 | pre-commit | ✅ | >>> |
| 开源片段检查 | SCA | ✅ | >>> |
| 流水线 | PR-pipeline_ascend-deployer | ✅ | >>> |
- compile : 运行流水线
- retry : 重试流水线所有失败子任务
- retry <任务名> : 仅重试指定失败子任务
- stop : 停止流水线


问题/功能描述
关联 Issue:#204
修复在线安装包中配套版本配置缺失风险,确保
ascend-download --show-releases依赖的ascend_deployer/downloader/release_config.json被显式纳入打包数据。当前源码中
--show-releases参数已经存在,但在线安装路径依赖发布包中同时包含release_config.json。为避免后续打包规则调整或发布包遗漏该配置,本次修改:setup.py中显式声明ascend_deployer/downloader/release_config.json为 package data;--show-releases回归测试,验证该参数展示配套版本后直接退出,不触发下载逻辑,也不要求--os-list;release_config.json再次从 package data 中遗漏。验证情况
已完成以下本地验证:
结果:
说明:完整
sdist/wheel构建路径同时依赖 #205 中的脚本权限修复。本地叠加 #205 修复后,已验证生成的 wheel 包含ascend_deployer/downloader/release_config.json,并且安装后执行ascend-download --show-releases返回 0 且正常展示配套版本表格。开发自检