正本清源,辞归本宗 · Correct GitHub language detection and drop orphan script#25
Merged
Conversation
…script Add linguist-detectable=false overrides in .gitattributes for tools/, oracle/, tests/python/, and corpus/ so GitHub correctly identifies the repository as C++ instead of Python. The code stays in-repo and CI runs it unchanged. Drop oracle/generate_smoke_corpus.py (65 lines): orphan script with zero references across workflows, CMake, and Python imports; its output duplicates corpus/generate_corpus.py which is the recorded provenance generator. Add docs/python-asset-review.md: full inventory of all 60 Python files (14776 lines) with per-file roles, CI reference evidence, and a corrected pruning assessment. Import review overturned the initial 'archivable' verdict for tools/webgpu/qualify.py and the tools/apple/ gate group — both are imported by CI-active unit tests.
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.
问题
GitHub 把本仓库识别为 Python 项目,但
light-ocr的核心是 C++17 OCR 引擎。根因是.gitattributes缺少 Linguist 配置:仓库内 Python 工具链代码(14776 行)行数压过了 C++(12308 行),而 Linguist 默认全部计入。改动
1.
.gitattributes— 根治语言误识别(核心)这些目录是 CI 的发布/验证/测试工具链,不是产品的实现语言。代码留在仓库、CI 照跑,Linguist 只是不再把它们计入语言占比。合并到默认分支后 GitHub 会重新统计,项目将正确显示为 C++。
2. 删除
oracle/generate_smoke_corpus.py(65 行)经全仓 grep + Python import 复核确认零引用的孤儿脚本。其输出与
corpus/generate_corpus.py重复,且该 fixture 的 provenance 记录的 generator 是后者而非本脚本。3. 新增
docs/python-asset-review.md全部 60 个 Python 文件的完整盘点:每文件职责、行数、CI 引用证据、精简评估。
关键复核结论
初版分析曾判定
tools/webgpu/qualify.py(1235 行)和tools/apple/8 个 gate(1413 行)为"可归档"。import 复核推翻该结论:tools/webgpu/qualify.pytests/python/test_webgpu_qualification.py:18→from tools.webgpu import qualifytools/apple/4 个 gatetests/python/test_apple_qualification.py:9-15→from tools.apple import accept_qualification, collect_qualification, fallback_gate, package_bundle, performance_gate这些测试经
core.yml:108的unittest discover在 CI 中运行,其 import 即真实引用——归档会立即 ImportError 破坏 CI。文档已记录此方法论教训:判断 CI 引用不能只 grep workflow yml,必须同时检查测试文件的 import 语句。验证
git status干净,仅本次三处改动.py文件 import 语句)确认零引用不在本 PR 范围
tools/common/去重重构:存在双重 import 模式(python tools/x.py直接执行 vs 测试 import),需逐文件处理 try/except 兜底;实际重复仅 ~100-150 行,且已被本 PR 的 gitattributes 排除出统计,风险/收益不划算,留作独立 PR。