microsoft / microsoft/winml-cli
Clean up unreferenced / orphaned modules in src/winml/modelkit
@DingmaomaoBJTU is already working on this.
Since Jul 27, 2026.
- Dominant language
- Python
- Stars
- 40
- Forks
- 11
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 50
Description
Background
An import-graph analysis of src/winml/modelkit (AST-parsed all modules; modeled dynamic command loading via LazyGroup, string-based _LAZY_IMPORTS, and parent-__init__ side-effect registration) found several modules that are not reachable from any CLI command.
The clearly-dead, zero-reference files were already removed in the accompanying PR:
analyze/console_writer.py,analyze/utils/table_utils.py,core/onnx_node_bucketizer.py,core/operation_config.py,core/strategy_selector.py,core/tag_utils.py
This issue tracks the remaining cases that need a decision rather than a straight delete.
1. Empty stub
models/hf/swin2sr.py— 13-line docstring-only placeholder, imported by nothing (not evenmodels/hf/__init__.py). Tracked for Swin2SR patches under #236. Decide: keep as a placeholder tied to #236, or remove until the work is picked up.
2. Dead islands (modules importing each other, unreachable from any command)
analyze/onnx_opset/—__init__.py,_impl/opset_ai_onnx_preview_training1.py,_impl/opset_com_microsoft1.py. Re-exports fromonnxscript; nothing in the codebase imports the package.analyze/pattern/—__init__.py+check_patterns.py.check_patternsimports live modules but nobody importscheck_patterns, and theanalyzecommand never wires it in.
Decide: wire into the analyze pipeline if intended, otherwise remove.
3. Product-dead, kept alive only by their own tests
No src importer — only a test imports each. Removing the module orphans the test:
analyze/runtime_checker/check_ops.py→tests/unit/analyze/test_check_ops.pyanalyze/runtime_checker/result_processor.py→tests/unit/analyze/runtime_checker/test_result_processor_per_op.pyonnx/inspection.py→tests/unit/onnx/test_onnx_inspection.py
Decide: remove module + test if the feature is abandoned, or re-wire into product code if intended.
Not dead (recorded to avoid re-flagging)
session/qairt/compile_qairt_bin.pyis executed as a subprocess script (Path(__file__).parent / "compile_qairt_bin.py"), not imported — keep.serve/anddata/are reachable only via the intentionally-disabledrun/servecommands — keep.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.