Skip to content

fix: declare psutil as a runtime dependency#937

Merged
timenick merged 1 commit into
release/v0.2.0from
zhiwang/add-psutil-dependency
Jun 23, 2026
Merged

fix: declare psutil as a runtime dependency#937
timenick merged 1 commit into
release/v0.2.0from
zhiwang/add-psutil-dependency

Conversation

@timenick

Copy link
Copy Markdown
Collaborator

Summary

winml perf crashes on a clean install with No module named 'psutil' because src/winml/modelkit/session/monitor/memory_tracker.py imports psutil at module level, and the perf flow imports that module unconditionally. psutil was never declared in [project].dependencies — only the dev type stub types-psutil is present — so the published wheel's Requires-Dist omits it, breaking winml perf (and --monitor / --memory) out-of-the-box for every user.

Regression from #861 (feat: add --memory flag); memory_tracker.py did not exist in v0.1.0, so winml perf was unaffected there. Installing psutil manually confirms perf/build/--monitor otherwise work correctly — the only defect is the missing dependency declaration.

Change

Add psutil>=7 to [project].dependencies (aligns with the existing types-psutil>=7.2.2 stub).

Targeting release/v0.2.0 directly as a release hotfix; main will pick it up via the post-release merge-back.

Closes #936

winml perf crashes on a clean install with "No module named 'psutil'" because session/monitor/memory_tracker.py imports psutil at module level but it was never declared as a runtime dependency (only the types-psutil stub is present under dev deps). Regression from #861.

Closes #936
@timenick timenick requested a review from a team as a code owner June 23, 2026 03:20

@DingmaomaoBJTU DingmaomaoBJTU left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix is correct and complete. memory_tracker.py imports psutil unconditionally at module level (line 13), so any user running winml perf / --monitor / --memory on a clean install hits a hard ModuleNotFoundError. The dependency was previously declared only as a dev type stub (types-psutil>=7.2.2 in [dependency-groups].dev), so the published wheel's Requires-Dist omitted it entirely.

The single-line addition of psutil>=7 to [project].dependencies is the right surgical fix:

  • Placement is alphabetically correct (between pandas and pydantic).
  • The >=7 lower bound aligns with the existing types-psutil>=7.2.2 stub and the stable psutil.Process.memory_info().rss API used in the tracker.
  • No other runtime code paths need updating; the underlying logic was always correct.

Approve.

@timenick timenick merged commit 32a8447 into release/v0.2.0 Jun 23, 2026
9 checks passed
@timenick timenick deleted the zhiwang/add-psutil-dependency branch June 23, 2026 03:26
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.

2 participants