Pull Request已成功合入, 合并人@CANN-robot
(感谢 sinat_31531339 的贡献)变更摘要
本次变更对 requirements.txt 进行依赖清理,移除了五个项目运行时非必需的 Python 包(pytest-cov、ruff、yapf、PyYAML、requests),同时明确保留 pandas 与 h5py,以降低依赖冗余并避免因误删关键包导致的运行时风险。
主要改动
- 移除
pytest-cov:测试覆盖率已通过scripts/run_tests.sh中的python3 -m coverage直接调用,无需额外安装 pytest-cov 插件。 - 移除
ruff:代码检查工具ruff由 pre-commit hook 的隔离环境统一管理,requirements.txt中不再重复声明。 - 移除
yapf、PyYAML、requests:这三个包未被项目运行时直接使用,属于冗余依赖,一并清理。 - 保留
pandas与h5py:构建流程中的 msaccucmp 比对能力依赖 CSV/HDF5 解析,删除这两个包会导致运行时缺依赖风险,故暂予保留。


代码审查
审查总结
变更文件审查:
- requirements.txt — 审查完成,发现 1 个问题
问题按优先级统计:
| 优先级 | 数量 |
|---|---|
| P0 | 0 |
| P1 | 0 |
| P2 | 0 |
| P3 | 1 |
整体风险评估:低风险。
本次变更从 requirements.txt 中移除了 5 个确认未被项目代码 import 的依赖(pytest-cov、ruff、yapf、PyYAML、requests),减少了依赖供应链攻击面和安装开销。唯一需关注的是 ruff 被移除后,scripts/incremental_codecheck.py 在脱离 pre-commit 直接执行时可能因缺少 ruff 模块而失败,但这属于边缘场景,且 PR 的设计意图是 ruff 应由 pre-commit 隔离环境管理。其余移除项(pytest-cov、yapf、PyYAML、requests)在全仓 1108 个文件中均无 import 引用,移除安全。decorator 仅因文件尾换行符修复而重新定位,内容未变。pandas 和 h5py 按设计保留,属于合理的范围决策。
⚠️ 已识别出整体风险,但无法提取行内评论,请参考整体评估。


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
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-cann/oam-tools | ✅ zhuliangying, newstarzj (2/2) | ✅ zhuliangying (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)


compile


流水线任务触发成功
任务链接 [9ba90a2340d64d508c898b81427cbfeb][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| Check_Pr | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| cocheck_codestyle | ✅ SUCCESS | ||
| precommit | ✅ SUCCESS | >>>>> | |
| StaticCheck_codespell | ✅ SUCCESS | ||
| StaticCheck_link_validity | ✅ SUCCESS | ||
| StaticCheck_resource_existence | ✅ SUCCESS | ||
| StaticCheck_tag_closed | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| UT_Test_asys | ✅ SUCCESS | >>>>> | |
| UT_Test_msaicerr | ✅ SUCCESS | >>>>> | |
| UT_Test_msprof | ✅ SUCCESS | >>>>> | |
| API_Check | ✅ SUCCESS | >>>>> | |
| PreSmoke_A900 | ✅ SUCCESS | >>>>> |
[2026-07-17 23:05:12] CI执行结束




@newstarzj 感谢评审,5 条意见已逐条核实并处理如下(因 GitCode 已禁用 v4 接口无法逐条挂线程回复,这里统一引用回复):
requirements.txt(PyYAML)级别:严重 —— 移除 PyYAML 可能导致
import yaml运行时 ImportError
已核实:全局搜索本项目代码(src/、scripts/)无任何 import yaml / from yaml 引用,仅测试虚拟环境 .venv_test/ 下第三方包(torch 等)使用,非项目运行时代码。移除安全,不引入 ImportError。
requirements.txt(requests)级别:严重 —— 移除 requests 可能导致
import requests运行时 ImportError
已核实:本项目代码中无任何 import requests / from requests 引用,仅 .venv_test/ 下第三方包(fsspec、sympy 等)使用。移除安全,不影响运行时。
requirements.txt(pytest-cov)级别:一般 —— 若用
pytest --cov会导致覆盖率收集失败
已核实:覆盖率收集在 scripts/run_tests.sh:471 使用 python3 -m coverage run --source=... -m pytest,并非 pytest --cov;脚本中出现的 --cov) 只是 run_tests.sh 自身的 getopt 选项名,与 pytest-cov 插件无关。全仓无 pytest --cov 用法,coverage 依赖已保留,移除 pytest-cov 不影响 CI 覆盖率收集。
requirements.txt(ruff/yapf)级别:一般 —— 若 CI 有风格检查/格式化步骤会失败,建议移至 dev-requirements 而非删除
已核实:ruff 由 pre-commit 隔离环境统一管理(见 .pre-commit-config.yaml),scripts/incremental_codecheck.py 也是作为 pre-commit 钩子在该隔离环境中运行,不依赖 requirements.txt 中的声明;yapf 在本项目代码中无任何引用。CI 风格检查走 pre-commit,不受本次移除影响,故无需保留或迁移到 dev-requirements。
requirements.txt(可追溯性)级别:提示 —— 移除多个依赖未说明原因,建议在 PR 描述补充证据
建议已采纳:已在 PR 描述中补充每个被移除依赖的移除理由与"全局搜索确认无 import 引用"的证据。


/lgtm


/lgtm


/lgtm


/approve


The following label is not ready.
ci-pipeline-passed: The ci-pipeline-passed label is expired. Please compile again.


compile


流水线任务触发成功
任务链接 [e0d31103342a466fa741442b8ddc2273][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| Check_Pr | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| cocheck_codestyle | ✅ SUCCESS | ||
| precommit | ✅ SUCCESS | >>>>> | |
| StaticCheck_codespell | ✅ SUCCESS | ||
| StaticCheck_link_validity | ✅ SUCCESS | ||
| StaticCheck_resource_existence | ✅ SUCCESS | ||
| StaticCheck_tag_closed | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| UT_Test_asys | ✅ SUCCESS | >>>>> | |
| UT_Test_msaicerr | ✅ SUCCESS | >>>>> | |
| UT_Test_msprof | ✅ SUCCESS | >>>>> | |
| API_Check | ✅ SUCCESS | >>>>> | |
| PreSmoke_A900 | ✅ SUCCESS | >>>>> |
[2026-07-21 20:31:13] CI执行结束


描述
移除依赖的核实证据(可追溯性)
每个被移除依赖均已全局搜索确认在本项目代码(
src/、scripts/)中无 import 引用,仅测试虚拟环境.venv_test/下的第三方包使用(非项目运行时代码):src/、scripts/无import yaml/from yaml;仅.venv_test/第三方包(torch 等)使用src/、scripts/无import requests/from requests;仅.venv_test/第三方包(fsspec、sympy 等)使用scripts/run_tests.sh:471用python3 -m coverage run --source=... -m pytest,非pytest --cov;全仓无pytest --cov用法,coverage 依赖已保留.pre-commit-config.yaml),scripts/incremental_codecheck.py作为 pre-commit 钩子在该环境运行,不依赖 requirements.txt关联的Issue
关联 Issue #166
测试
文档更新
无
类型标签