fix(hgt): numpy 路径三处改用相对导入(修 vendored ModuleNotFoundError)#17
Conversation
hgt.py 的 forward() 里三处函数内导入写的是绝对路径 from sylanne_core.compute.hgt_numpy import ...(808/828/901)。在本仓 (sylanne_core 是顶层包)能跑,但这份 SDK 被下游插件 vendored 成 sylanne_alpha._engine.sylanne_core 后,绝对名 sylanne_core 不再指向自身, 干净环境(无 editable 安装顶名)会 ModuleNotFoundError。下游 PR review (Gemini,HIGH)实测暴露。 改成相对导入 from .hgt_numpy import ...,与 compute/ 包内其余 65 处导入 习惯一致(全相对),无论是否顶层都正确解析。 验证:语法 OK;强制 _use_numpy=True 真跑 forward(),三处 numpy 路径全 执行、输出维度正确;全量 500 passed 零回归。
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR fixes numpy-related imports in hgt.forward() by switching three absolute imports of hgt_numpy helpers to relative imports, aligning with the rest of the compute package and making the module robust when vendored under a different top-level package name. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
💩 屎山代码检测报告
🎯 本次检测概览
🎭 整体印象臭气扑鼻,建议佩戴口罩阅读 🧭 下一步这代码像个叛逆期的青少年,需要适当管教才能成才 📥 详细数据 由 fuck-u-code 自动检测 · 本评论不代表人类观点 |
There was a problem hiding this comment.
Code Review
This pull request updates absolute imports of sylanne_core.compute.hgt_numpy to relative imports (.hgt_numpy) within sylanne_core/compute/hgt.py. There are no review comments, and I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
vendored 的 compute/hgt.py forward() 三处函数内导入是绝对 from sylanne_core.compute.hgt_numpy(808/828/901),在干净部署环境(无 editable 顶名 sylanne_core)会 ModuleNotFoundError。已在上游 canonical 改成相对 from .hgt_numpy(PR Ayleovelle/SylannEngine#17,500 passed),此处把干净文件 surgical 同步回 vendored(保 CRLF,去 CRLF 后两文件完全一致)。 实测:vendored 相对导入在 sylanne_alpha._engine.sylanne_core.compute.hgt 路径下正确解析,不再依赖顶层 sylanne_core;全量 573 passed。
问题
sylanne_core/compute/hgt.py的forward()里三处函数内导入用了绝对路径from sylanne_core.compute.hgt_numpy import ...(808/828/901)。本仓里sylanne_core是顶层包,能跑;但这份 SDK 被下游插件 vendored 成sylanne_alpha._engine.sylanne_core后,绝对名sylanne_core不再指向自身,干净环境(无 editable 安装顶名)会ModuleNotFoundError。下游 PR review(Gemini,HIGH)实测暴露。修复
改用相对导入
from .hgt_numpy import ...,与compute/包内其余 65 处导入习惯一致(全相对),无论是否顶层都正确解析。验证
_use_numpy=True真跑forward(),三处 numpy 路径全执行、输出维度正确Summary by Sourcery
Bug Fixes: