refactor: 掐断库层对 scripts/ 的反向依赖(device_info 提升入库) - #1245
Merged
TATP-233 merged 1 commit intoAug 21, 2026
Merged
Conversation
TATP-233
merged commit Aug 21, 2026
697f45a
into
dev/issue-1042-manager-based-api
4 of 6 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1240
Part of #1239
改动
src/unilab/utils/device.py:迁入 device 信息采集实现(macOS/Linux/Windows 采集器 +get_device_info_dict/get_device_info_line),采集字段与格式逐字段保持不变。src/unilab/training/experiment.py:删除_benchmark_device_info_path目录遍历 +exec_module动态加载 + fallback,改为正常from unilab.utils.device import get_device_info_dict。scripts/benchmark/core/device_info.py:295 行实现缩减为薄壳 re-export,benchmark 框架其余部分不动。tests/benchmark/移至tests/utils/test_device.py;实验追踪测试改为断言直接使用库层 helper;新增tests/test_library_import_boundary.py(AST 扫描断言src/unilab内任何模块不 importscripts.*)。范围说明
src/unilab/cli.py、demo.py、ipc/dp_launcher.py仍有按路径定位scripts/的引用,属于 CLI 执行路径设计,不在 #1240 范围内,未触碰。Validation
make test-all已完成并通过(ruff format/check、mypy、pyright、全量 pytest 带 coverage、benchmark smoke 32/33 + 33/34,1 个 mlx 平台可选项跳过)。/tmp)importunilab.training.experiment成功,sys.modules中无任何scripts.*模块。get_device_info_line()输出格式不变。