Skip to content

Update psutil stubs for 8.0 - #16786

Draft
rusty3699 wants to merge 1 commit into
python:mainfrom
rusty3699:fix/psutil-8-typeshed-stubs
Draft

rusty3699 wants to merge 1 commit into
python:mainfrom
rusty3699:fix/psutil-8-typeshed-stubs

Conversation

@rusty3699

@rusty3699 rusty3699 commented Nov 13, 2026 •

Copy link
Copy Markdown

Summary

Updates the psutil stubs for the 8.0 development version and consolidates the per-platform _psutil_* stubs into a unified _psutil.pyi.

Notes

  • Refs Update typeshed types-psutil stubs for 8.0 giampaolo/psutil#3114.
  • psutil 8.0 is not yet published on PyPI. Local tests against the development version passed, including the full typeshed suite for Python 3.10–3.15 and direct stubtest.
  • METADATA.toml must remain at 7.2.2 until 8.0 is released. This branch currently contains a temporary 8.0.0 bump that will need to be reverted before merge.

mypy_primer

The mypy_primer check passed and reported two new Home Assistant diagnostics: psutil._common has no attribute POWER_TIME_UNKNOWN / POWER_TIME_UNLIMITED. At the targeted psutil commit 86ce17c, psutil._common no longer exposes these constants — they are members of the BatteryTime enum in psutil._enums, following upstream commit 34a9e324. The stubs intentionally match the 8.0 runtime here; no stub change is needed.

Stubtest blocker

The third-party stubtest CI jobs (Linux, Windows, macOS) fail only because psutil==8.0.0 is not yet installable from PyPI — pip cannot resolve the pinned version. These checks are expected to pass once 8.0.0 is released; no code change is required for them.

Validation

  • tests/runtests.py stubs/psutil passed for Python 3.10–3.15.
  • Direct mypy.stubtest passed against locally installed psutil 8.0.0.
  • The official third-party stubtest runner remains blocked until the 8.0 release is available on PyPI.

@github-actions

This comment has been minimized.

@rusty3699
rusty3699 force-pushed the fix/psutil-8-typeshed-stubs branch from b838edb to d1bcca7 Compare November 13, 2026 14:15
@github-actions

Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

core (https://github.com/home-assistant/core)
+ homeassistant/components/systemmonitor/sensor.py:15: error: Module "psutil._common" has no attribute "POWER_TIME_UNKNOWN"  [attr-defined]
+ homeassistant/components/systemmonitor/sensor.py:15: error: Module "psutil._common" has no attribute "POWER_TIME_UNLIMITED"  [attr-defined]

This branch has not been deployed

No deployments
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.

1 participant