Skip to content

fix(sys): gate diagnostic sections behind -v; route json-mode logs to stderr#737

Merged
timenick merged 1 commit into
mainfrom
zhiwang/sys-verbose-and-json-stderr
May 26, 2026
Merged

fix(sys): gate diagnostic sections behind -v; route json-mode logs to stderr#737
timenick merged 1 commit into
mainfrom
zhiwang/sys-verbose-and-json-stderr

Conversation

@timenick
Copy link
Copy Markdown
Collaborator

Summary

  • Move Backend SDKs and Export Readiness panels into --verbose; verbose now lists all backends including not-installed rows so the section is informative even when no SDK is installed.
  • Route the per-command RichHandler to stderr under --format json so DEBUG/WARNING logs no longer corrupt the JSON payload on stdout.
  • Update _run_sys_json to read result.stdout (Click 8.4's result.output still aggregates stderr).

Fixes #736

Before / After

1. Default winml sys — drops two diagnostic panels

Before (on a host with at least one backend SDK installed, the panels show up by default; below is the shape they took):

...
Backend SDKs
  QNN SDK     Installed    <path>
  OpenVINO    Installed    <version>

Export Readiness
  ONNX Export            Ready
  QNN Compilation        Ready
  OpenVINO Conversion    Ready
...

After — those panels are gone from default output; users only see Environment, ML Libraries, Devices, and Execution Providers.

2. winml sys -v — sections are now always populated

After (verbose now lists every backend regardless of install status, so the panel is meaningful on a stock dev box):

PyTorch Details
  CUDA Available    False

Backend SDKs
  QNN SDK     Not found    -
  OpenVINO    Not found    -

Export Readiness
  ONNX Export            Ready
  QNN Compilation        SDK required
  OpenVINO Conversion    Not installed

3. winml sys --verbose --format json — stdout is now valid JSON

Before — RichHandler writes DEBUG records to the same console as the JSON, so stdout starts with log lines and json.loads fails:

[05/26/26 10:35:28] DEBUG    OpenVINO not available
[05/26/26 10:35:29] DEBUG    Found EP: OpenVINOExecutionProvider at ...
                    DEBUG    Found EP: NvTensorRTRTXExecutionProvider at ...
{... JSON would appear here, never reached by parsers ...}

After — stdout contains only JSON; the same log records are emitted on stderr where they belong:

$ winml sys --verbose --format json 2>/dev/null | head
{
  "python": {
    "version": "3.11.14",
    "executable": "C:\\Projects\\WinML-ModelKit\\.venv\\Scripts\\python.exe",
    "implementation": "CPython"
  },
  "platform": {
    "system": "Windows",
    ...

… stderr

- Move Backend SDKs and Export Readiness panels into --verbose; verbose
  now lists all backends including not-installed rows so the section is
  informative even when no SDK is installed.
- Route the per-command RichHandler to stderr under --format json so
  DEBUG/WARNING logs no longer corrupt the JSON payload on stdout.
- Update _run_sys_json to read result.stdout (Click 8.4's result.output
  still aggregates stderr).

Fixes #736
@timenick timenick requested a review from a team as a code owner May 26, 2026 02:37
@timenick timenick merged commit ec6464a into main May 26, 2026
9 checks passed
@timenick timenick deleted the zhiwang/sys-verbose-and-json-stderr branch May 26, 2026 02:45
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.

winml sys: move Backend SDKs / Export Readiness to --verbose; fix --verbose --format json log contamination

2 participants