已关闭
确保配套版本配置随下载器打包 #2220
确保配套版本配置随下载器打包 #2220
已关闭
肾炝喜鲤创建于 7月7日关闭于 8月19日
肾炝喜鲤
肾炝喜鲤
7月7日

问题/功能描述

关联 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 中遗漏。

验证情况

已完成以下本地验证:

python3.11 -m pytest test/st/test_download.py -q
python3.11 -m compileall setup.py test/st/test_download.py
git diff --check

结果:

20 passed
compileall 通过
git diff --check 通过

说明:完整 sdist/wheel 构建路径同时依赖 #205 中的脚本权限修复。本地叠加 #205 修复后,已验证生成的 wheel 包含 ascend_deployer/downloader/release_config.json,并且安装后执行 ascend-download --show-releases 返回 0 且正常展示配套版本表格。

开发自检

  • 规范:未超过 1k;超过 1k 已完成需备案;反合入需要标题注明【反合】
  • 规范:关联了 issue 或里程碑
  • 规范:需要且包含 UT/ST
  • 安全:未引入三方开源软件;引入三方开源软件需经过评审
  • 安全:未新增对外接口/参数;新增对外接口/参数有校验
  • 规范:未涉及资料改动;涉及资料修改并已修改完成
  • 验证环境:macOS,本地 Python 3.11。
likedislike
当前Pull Request已关闭, 关闭人@肾炝喜鲤
肾炝喜鲤肾炝喜鲤
7月7日 创建了 pull request,commit 29757501
肾炝喜鲤肾炝喜鲤
7月7日 关联了issue:[Bug]: 在线安装最新 PyPI 包不支持文档中的 --show-releases 参数,[Bug]: setup.py 转换 shell 脚本换行后留下 write-only 权限,普通用户构建 sdist/wheel 失败
atomgit-bot
atomgit-bot
7月7日 评论:

变更摘要

此 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'] 声明,防止该配置项在未来被意外移除。
likedislike
不准确?
atomgit-bot
atomgit-bot
7月7日 评论:

代码审查

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 项是测试工程质量问题,不影响生产代码的正确性或安全性。

⚠️ 已识别出整体风险,但无法提取行内评论,请参考整体评估。

likedislike
不准确?
ascend-robotascend-robot成员
7月7日 添加了label:ascend-cla/yes
ascend-robot
ascend-robot成员
7月7日 评论:

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 /approve or /lgtm
  • Commenting /approve implies 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. 👍

likedislike
ascend-robotascend-robot成员
7月7日 添加了label:ci-pipeline-running
ascend-robotascend-robot成员
7月7日 删除了label:ci-pipeline-running
ascend-robotascend-robot成员
7月7日 添加了label:ci-pipeline-passed
ascend-robot
ascend-robot成员
7月7日 评论:
流水线 PR-pipeline_ascend-deployer#1154 [ commitID:219f8085 ] 已完成
>>>代码风格自动修复执行成功(无修复内容)
阶段 任务名 状态 详情
编译构建 Build ✅ >>>
恶意代码检查 Antipoison ✅ >>>
编码安全与规范检查 pre-commit ✅ >>>
开源片段检查 SCA ✅ >>>
流水线 PR-pipeline_ascend-deployer ✅ >>>
此流水线已支持下列评论快捷指令,仅PR创建者和白名单成员评论有效
  • compile : 运行流水线
  • retry : 重试流水线所有失败子任务
  • retry <任务名> : 仅重试指定失败子任务
  • stop : 停止流水线
likedislike
肾炝喜鲤肾炝喜鲤
7月7日 预合并成功(commit_id: c86c67a6588b3a52b4313c6073989e410e12a742)
肾炝喜鲤肾炝喜鲤
7月7日 强制推送  1 个提交:67deaf3e-确保配套版本配置随下载器打包
肾炝喜鲤肾炝喜鲤
7月7日 预合并成功(commit_id: 6f4205472cfc3426b02c12dc05394b25c4a00e3d)
ascend-robotascend-robot成员
7月7日 删除了label:ci-pipeline-passed
ascend-robot
ascend-robot成员
7月7日 评论:

Notification

This pull request has been changed(code update) or closed, so removes the following label(s): ci-pipeline-passed.

likedislike
ascend-robotascend-robot成员
7月7日 添加了label:ci-pipeline-running
ascend-robot
ascend-robot成员
7月7日 评论:
流水线 PR-pipeline_ascend-deployer#1156 [ commitID:67deaf3e ] 运行中
>>>代码风格自动修复执行成功(无修复内容)
阶段 任务名 状态 详情
编译构建 Build 🕚 >>>
恶意代码检查 Antipoison 🕚 >>>
编码安全与规范检查 pre-commit 🕚 >>>
开源片段检查 SCA 🕚 >>>
流水线 PR-pipeline_ascend-deployer 🕚 >>>
此流水线已支持下列评论快捷指令,仅PR创建者和白名单成员评论有效
  • compile : 运行流水线
  • retry : 重试流水线所有失败子任务
  • retry <任务名> : 仅重试指定失败子任务
  • stop : 停止流水线
likedislike
肾炝喜鲤
肾炝喜鲤
7月8日 评论:

compile

likedislike
ascend-robotascend-robot成员
7月8日 删除了label:ci-pipeline-running
ascend-robotascend-robot成员
7月8日 添加了label:ci-pipeline-passed
ascend-robot
ascend-robot成员
7月8日 评论:
流水线 PR-pipeline_ascend-deployer#1157 [ commitID:67deaf3e ] 已完成
>>>代码风格自动修复执行成功(无修复内容)
阶段 任务名 状态 详情
编译构建 Build ✅ >>>
恶意代码检查 Antipoison ✅ >>>
编码安全与规范检查 pre-commit ✅ >>>
开源片段检查 SCA ✅ >>>
流水线 PR-pipeline_ascend-deployer ✅ >>>
此流水线已支持下列评论快捷指令,仅PR创建者和白名单成员评论有效
  • compile : 运行流水线
  • retry : 重试流水线所有失败子任务
  • retry <任务名> : 仅重试指定失败子任务
  • stop : 停止流水线
likedislike
肾炝喜鲤肾炝喜鲤
7月17日 预合并成功(commit_id: c1169768cccdef4b168c2ddf5b142de80b268ade)
肾炝喜鲤肾炝喜鲤
7月17日 强制推送  9 个提交:c5f2eec5-8 commits from branch dev,7664d34a-确保配套版本配置随下载器打包
肾炝喜鲤肾炝喜鲤
7月17日 预合并成功(commit_id: ba2b2516a7bf0e8568f818108b7262cf7a042a7c)
ascend-robotascend-robot成员
7月17日 删除了label:ci-pipeline-passed
ascend-robot
ascend-robot成员
7月17日 评论:

Notification

This pull request has been changed(code update) or closed, so removes the following label(s): ci-pipeline-passed.

likedislike
ascend-robotascend-robot成员
7月17日 添加了label:ci-pipeline-running
ascend-robot
ascend-robot成员
7月17日 评论:

ascend docs pipeline is running...

likedislike
ascend-robotascend-robot成员
7月17日 添加了label:docs-ci-pipeline-running
ascend-robot
ascend-robot成员
7月17日 评论:

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

likedislike
ascend-robotascend-robot成员
7月17日 删除了label:docs-ci-pipeline-running
ascend-robotascend-robot成员
7月17日 添加了label:docs-ci-pipeline-success
ascend-robotascend-robot成员
7月17日 删除了label:ci-pipeline-running
ascend-robotascend-robot成员
7月17日 添加了label:ci-pipeline-passed
ascend-robot
ascend-robot成员
7月17日 评论:
流水线 PR-pipeline_ascend-deployer#1216 [ commitID:7664d34a ] 已完成
>>>代码风格自动修复执行成功(无修复内容)
阶段 任务名 状态 详情
编译构建 Build ✅ >>>
恶意代码检查 Antipoison ✅ >>>
编码安全与规范检查 pre-commit ✅ >>>
开源片段检查 SCA ✅ >>>
流水线 PR-pipeline_ascend-deployer ✅ >>>
此流水线已支持下列评论快捷指令,仅PR创建者和白名单成员评论有效
  • compile : 运行流水线
  • retry : 重试流水线所有失败子任务
  • retry <任务名> : 仅重试指定失败子任务
  • stop : 停止流水线
likedislike
肾炝喜鲤肾炝喜鲤
8月19日 关闭了 pull request