microsoft / microsoft/winml-cli

Clean up unreferenced / orphaned modules in src/winml/modelkit

Open
#989 1 comment 0 reactions 1 assignee View on GitHub

@DingmaomaoBJTU is already working on this.

Since Jul 27, 2026.

enhancement P2 refactor triaged
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 even models/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 from onnxscript; nothing in the codebase imports the package.
  • analyze/pattern/__init__.py + check_patterns.py. check_patterns imports live modules but nobody imports check_patterns, and the analyze command 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.pytests/unit/analyze/test_check_ops.py
  • analyze/runtime_checker/result_processor.pytests/unit/analyze/runtime_checker/test_result_processor_per_op.py
  • onnx/inspection.pytests/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.py is executed as a subprocess script (Path(__file__).parent / "compile_qairt_bin.py"), not imported — keep.
  • serve/ and data/ are reachable only via the intentionally-disabled run/serve commands — keep.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.