Skip to content

refactor(cli): unify -m/--model option across all commands#990

Open
xieofxie wants to merge 1 commit into
mainfrom
hualxie/unify_model_flag
Open

refactor(cli): unify -m/--model option across all commands#990
xieofxie wants to merge 1 commit into
mainfrom
hualxie/unify_model_flag

Conversation

@xieofxie

Copy link
Copy Markdown
Contributor

@

Summary

Unifies the -m/--model option across every command in src/winml/modelkit/commands/ by routing them all through the shared model_option / model_path_option helpers in utils/cli.py, instead of ad-hoc inline click.option definitions. The flag spelling, ordering, type, and validation now have a single source of truth.

Closes #563.

Changes

Helpers (utils/cli.py)

  • model_path_option (validated ONNX Path) — added multiple and help_text parameters.
  • model_option (any model reference, no validation) — added multiple and help_text parameters.

Commands converted from inline click.option to the shared helpers

Command Now uses
compile model_path_option(required=False, multiple=True, help_text=…)
optimize model_path_option(required=False, help_text=…)
quantize model_path_option(required=True, help_text=…)
export model_option(required=True, help_text=…)
eval model_option(required=False, multiple=True, help_text=…)
build model_option(required=False, help_text=…)
inspect model_option(required=False, help_text=…)

(analyze, run, serve, perf, config already used the helpers.)

Destination standardized to modelbuild and inspect previously bound --model to model_id; the CLI binding is now model. Downstream keyword args that are genuinely the domain concept (e.g. WinMLQuantizationConfig.model_id) are unchanged.

This is purely structural — each command keeps its existing accept-types (PATH-validated vs flexible TEXT), required semantics, multiple, and help wording.
@

Route every command's -m/--model through the shared model_option /
model_path_option helpers instead of inline click.option definitions, so
the flag spelling, ordering, type, and validation have a single source of
truth. Extend both helpers with multiple/help_text parameters and
standardize the destination variable to model (build and inspect previously
bound to model_id).

No behavior change: each command keeps its existing accept-types,
required semantics, and help wording.
@xieofxie xieofxie requested a review from a team as a code owner June 26, 2026 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[cross-cutting] [P2] --model semantic drift across 10 commands

1 participant