From 12843187ff2af8495fa8b4900066f72a61490073 Mon Sep 17 00:00:00 2001 From: Lev Blit Date: Tue, 14 Oct 2025 13:58:12 +0300 Subject: [PATCH 01/13] [psutil]: Bump psutil to 7.1.* --- stubs/psutil/METADATA.toml | 2 +- stubs/psutil/psutil/_pslinux.pyi | 4 ++-- stubs/psutil/psutil/_psutil_linux.pyi | 1 - stubs/psutil/psutil/_psutil_posix.pyi | 1 + 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/stubs/psutil/METADATA.toml b/stubs/psutil/METADATA.toml index 85e2bcc2e4e8..c309a68f483e 100644 --- a/stubs/psutil/METADATA.toml +++ b/stubs/psutil/METADATA.toml @@ -1,4 +1,4 @@ -version = "7.0.*" +version = "7.1.*" upstream_repository = "https://github.com/giampaolo/psutil" [tool.stubtest] diff --git a/stubs/psutil/psutil/_pslinux.pyi b/stubs/psutil/psutil/_pslinux.pyi index 1a947fc2b828..8b0e237ad1cc 100644 --- a/stubs/psutil/psutil/_pslinux.pyi +++ b/stubs/psutil/psutil/_pslinux.pyi @@ -24,8 +24,8 @@ HAS_PROC_IO_PRIORITY: Any HAS_CPU_AFFINITY: Any CLOCK_TICKS: Any PAGESIZE: Any -BOOT_TIME: Any LITTLE_ENDIAN: Any +UNSET: object DISK_SECTOR_SIZE: int AF_LINK: Any AddressFamily: Any @@ -213,7 +213,7 @@ class Process: def cpu_times(self): ... def cpu_num(self): ... def wait(self, timeout: Incomplete | None = ...): ... - def create_time(self): ... + def create_time(self, monotonic: bool = False): ... def memory_info(self): ... def memory_full_info(self): ... def memory_maps(self): ... diff --git a/stubs/psutil/psutil/_psutil_linux.pyi b/stubs/psutil/psutil/_psutil_linux.pyi index 877715d040fb..52b0a3f5dc72 100644 --- a/stubs/psutil/psutil/_psutil_linux.pyi +++ b/stubs/psutil/psutil/_psutil_linux.pyi @@ -14,4 +14,3 @@ def proc_cpu_affinity_set(*args, **kwargs) -> Any: ... def proc_ioprio_get(*args, **kwargs) -> Any: ... def proc_ioprio_set(*args, **kwargs) -> Any: ... def set_debug(*args, **kwargs) -> Any: ... -def users(*args, **kwargs) -> Any: ... diff --git a/stubs/psutil/psutil/_psutil_posix.pyi b/stubs/psutil/psutil/_psutil_posix.pyi index 2a58ee9a43de..37538667d014 100644 --- a/stubs/psutil/psutil/_psutil_posix.pyi +++ b/stubs/psutil/psutil/_psutil_posix.pyi @@ -32,3 +32,4 @@ if sys.platform == "darwin": def net_if_duplex_speed(*args, **kwargs): ... def setpriority(*args, **kwargs) -> Any: ... +def users(*args, **kwargs) -> Any: ... From 052551bd7e99a3ba61de564e6901748c2d724721 Mon Sep 17 00:00:00 2001 From: Lev Blit Date: Tue, 14 Oct 2025 14:15:23 +0300 Subject: [PATCH 02/13] fix osx --- stubs/psutil/@tests/stubtest_allowlist_darwin.txt | 3 +++ stubs/psutil/psutil/_psosx.pyi | 6 +++++- stubs/psutil/psutil/_psutil_osx.pyi | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/stubs/psutil/@tests/stubtest_allowlist_darwin.txt b/stubs/psutil/@tests/stubtest_allowlist_darwin.txt index 4cf5ba5d3a88..d15a40791938 100644 --- a/stubs/psutil/@tests/stubtest_allowlist_darwin.txt +++ b/stubs/psutil/@tests/stubtest_allowlist_darwin.txt @@ -2,3 +2,6 @@ psutil._pslinux psutil._psutil_linux psutil._psutil_windows psutil._pswindows + +# not always available on ARM64, but we test there +psutil._psosx.cpu_freq diff --git a/stubs/psutil/psutil/_psosx.pyi b/stubs/psutil/psutil/_psosx.pyi index dee1fd6ed291..678fdcd1cd5b 100644 --- a/stubs/psutil/psutil/_psosx.pyi +++ b/stubs/psutil/psutil/_psosx.pyi @@ -70,6 +70,10 @@ net_if_addrs: Any def net_connections(kind: str = "inet"): ... def net_if_stats(): ... def boot_time(): ... + +INIT_BOOT_TIME: float + +def adjust_proc_create_time(ctime: float) -> float: ... def users(): ... def pids(): ... @@ -96,7 +100,7 @@ class Process: def memory_info(self): ... def memory_full_info(self): ... def cpu_times(self): ... - def create_time(self): ... + def create_time(self, monotonic: bool = False): ... def num_ctx_switches(self): ... def num_threads(self): ... def open_files(self): ... diff --git a/stubs/psutil/psutil/_psutil_osx.pyi b/stubs/psutil/psutil/_psutil_osx.pyi index 3a6ea7372d40..af53eaf53503 100644 --- a/stubs/psutil/psutil/_psutil_osx.pyi +++ b/stubs/psutil/psutil/_psutil_osx.pyi @@ -29,6 +29,7 @@ def cpu_times(*args, **kwargs) -> Any: ... def disk_io_counters(*args, **kwargs) -> Any: ... def disk_partitions(*args, **kwargs) -> Any: ... def disk_usage_used(*args, **kwargs) -> Any: ... +def has_cpu_freq(*args, **kwargs) -> bool: ... def net_io_counters(*args, **kwargs) -> Any: ... def per_cpu_times(*args, **kwargs) -> Any: ... def pids(*args, **kwargs) -> Any: ... @@ -47,5 +48,4 @@ def proc_threads(*args, **kwargs) -> Any: ... def sensors_battery(*args, **kwargs) -> Any: ... def set_debug(*args, **kwargs) -> Any: ... def swap_mem(*args, **kwargs) -> Any: ... -def users(*args, **kwargs) -> Any: ... def virtual_mem(*args, **kwargs) -> Any: ... From 8c035af3647f2b0ca9a1389be794ba6d24454a23 Mon Sep 17 00:00:00 2001 From: Lev Blit Date: Tue, 14 Oct 2025 14:15:31 +0300 Subject: [PATCH 03/13] fix windows --- stubs/psutil/psutil/_psutil_windows.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/psutil/psutil/_psutil_windows.pyi b/stubs/psutil/psutil/_psutil_windows.pyi index a65eb03ed53f..312e3f63b8b4 100644 --- a/stubs/psutil/psutil/_psutil_windows.pyi +++ b/stubs/psutil/psutil/_psutil_windows.pyi @@ -36,7 +36,7 @@ class TimeoutAbandoned(Exception): ... class TimeoutExpired(Exception): ... def QueryDosDevice(*args, **kwargs): ... # incomplete -def boot_time(*args, **kwargs): ... # incomplete +def uptime(*args, **kwargs): ... # incomplete def check_pid_range(pid: int, /) -> None: ... def cpu_count_cores(*args, **kwargs): ... # incomplete def cpu_count_logical(*args, **kwargs): ... # incomplete From 48b7f35d944b45c75d35d0de5457dc1fe4686b49 Mon Sep 17 00:00:00 2001 From: Lev Blit Date: Tue, 14 Oct 2025 14:17:52 +0300 Subject: [PATCH 04/13] fix osx allowlist entry --- stubs/psutil/@tests/stubtest_allowlist_darwin.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/psutil/@tests/stubtest_allowlist_darwin.txt b/stubs/psutil/@tests/stubtest_allowlist_darwin.txt index d15a40791938..ae2e5e59ff64 100644 --- a/stubs/psutil/@tests/stubtest_allowlist_darwin.txt +++ b/stubs/psutil/@tests/stubtest_allowlist_darwin.txt @@ -4,4 +4,4 @@ psutil._psutil_windows psutil._pswindows # not always available on ARM64, but we test there -psutil._psosx.cpu_freq +psutil.cpu_freq From 129bd24e184a1b24cf5da328afacc3df748696d8 Mon Sep 17 00:00:00 2001 From: Lev Blit Date: Tue, 14 Oct 2025 14:19:02 +0300 Subject: [PATCH 05/13] oops - should have had them both --- stubs/psutil/@tests/stubtest_allowlist_darwin.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/stubs/psutil/@tests/stubtest_allowlist_darwin.txt b/stubs/psutil/@tests/stubtest_allowlist_darwin.txt index ae2e5e59ff64..d90126c03a35 100644 --- a/stubs/psutil/@tests/stubtest_allowlist_darwin.txt +++ b/stubs/psutil/@tests/stubtest_allowlist_darwin.txt @@ -5,3 +5,4 @@ psutil._pswindows # not always available on ARM64, but we test there psutil.cpu_freq +psutil._psosx.cpu_freq From 0b970886831046f29cb39bbfa5b769d5b6dea664 Mon Sep 17 00:00:00 2001 From: Lev Blit Date: Sat, 15 Nov 2025 17:30:28 +0200 Subject: [PATCH 06/13] lock to 7.1.1 --- stubs/psutil/METADATA.toml | 2 +- stubs/psutil/psutil/_pslinux.pyi | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/stubs/psutil/METADATA.toml b/stubs/psutil/METADATA.toml index c309a68f483e..35f15a689034 100644 --- a/stubs/psutil/METADATA.toml +++ b/stubs/psutil/METADATA.toml @@ -1,4 +1,4 @@ -version = "7.1.*" +version = "7.1.1" upstream_repository = "https://github.com/giampaolo/psutil" [tool.stubtest] diff --git a/stubs/psutil/psutil/_pslinux.pyi b/stubs/psutil/psutil/_pslinux.pyi index 2e6fa0287b3b..edd4445e8c31 100644 --- a/stubs/psutil/psutil/_pslinux.pyi +++ b/stubs/psutil/psutil/_pslinux.pyi @@ -24,7 +24,6 @@ HAS_PROC_IO_PRIORITY: Incomplete HAS_CPU_AFFINITY: Incomplete CLOCK_TICKS: Incomplete PAGESIZE: Incomplete -BOOT_TIME: Incomplete LITTLE_ENDIAN: Incomplete UNSET: object DISK_SECTOR_SIZE: int From e62c466e1ae074ce3c5907908bb0f463a4036400 Mon Sep 17 00:00:00 2001 From: Lev Blit Date: Sat, 15 Nov 2025 17:33:42 +0200 Subject: [PATCH 07/13] add missing in osx --- stubs/psutil/psutil/_psosx.pyi | 2 +- stubs/psutil/psutil/_psutil_osx.pyi | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/stubs/psutil/psutil/_psosx.pyi b/stubs/psutil/psutil/_psosx.pyi index e937c20b5ec6..9572796a7295 100644 --- a/stubs/psutil/psutil/_psosx.pyi +++ b/stubs/psutil/psutil/_psosx.pyi @@ -103,7 +103,7 @@ if sys.platform == "darwin": def memory_info(self) -> pmem: ... def memory_full_info(self) -> pfullmem: ... def cpu_times(self) -> _common.pcputimes: ... - def create_time(self) -> float: ... + def create_time(self, monotonic: bool = False) -> float: ... def num_ctx_switches(self) -> _common.pctxsw: ... def num_threads(self) -> int: ... def open_files(self) -> list[_common.popenfile]: ... diff --git a/stubs/psutil/psutil/_psutil_osx.pyi b/stubs/psutil/psutil/_psutil_osx.pyi index 6d4d04ca47ca..6149a9c97728 100644 --- a/stubs/psutil/psutil/_psutil_osx.pyi +++ b/stubs/psutil/psutil/_psutil_osx.pyi @@ -62,3 +62,4 @@ if sys.platform == "darwin": def virtual_mem() -> tuple[int, int, int, int, int, int]: ... def check_pid_range(pid: int, /) -> None: ... def set_debug(value: bool, /) -> None: ... + def is_zombie() -> bool: ... From 1f56fe140c5dff81c382c230edde84cab83da211 Mon Sep 17 00:00:00 2001 From: Lev Blit Date: Sat, 15 Nov 2025 17:34:27 +0200 Subject: [PATCH 08/13] add missing in windows --- stubs/psutil/psutil/_psutil_windows.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/psutil/psutil/_psutil_windows.pyi b/stubs/psutil/psutil/_psutil_windows.pyi index 3c84c160c047..74c6b1b5845f 100644 --- a/stubs/psutil/psutil/_psutil_windows.pyi +++ b/stubs/psutil/psutil/_psutil_windows.pyi @@ -66,7 +66,7 @@ if sys.platform == "win32": def proc_info( pid: int, / ) -> tuple[int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int]: ... - def boot_time() -> float: ... + def uptime() -> float: ... def cpu_count_cores() -> int | None: ... def cpu_count_logical() -> int | None: ... def cpu_freq() -> tuple[int, int]: ... From 6e78327884194db838540187e2112efcb956b214 Mon Sep 17 00:00:00 2001 From: Lev Blit Date: Sat, 15 Nov 2025 17:37:07 +0200 Subject: [PATCH 09/13] is_zombie in correct place --- stubs/psutil/psutil/_psosx.pyi | 1 + stubs/psutil/psutil/_psutil_osx.pyi | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/psutil/psutil/_psosx.pyi b/stubs/psutil/psutil/_psosx.pyi index 9572796a7295..63679f0e06d4 100644 --- a/stubs/psutil/psutil/_psosx.pyi +++ b/stubs/psutil/psutil/_psosx.pyi @@ -84,6 +84,7 @@ if sys.platform == "darwin": def pids() -> list[int]: ... pid_exists = _psposix.pid_exists def wrap_exceptions(fun: Callable[_P, _R]) -> Callable[_P, _R]: ... + def is_zombie(pid: int) -> bool: ... class Process: __slots__ = ["_cache", "_name", "_ppid", "pid"] diff --git a/stubs/psutil/psutil/_psutil_osx.pyi b/stubs/psutil/psutil/_psutil_osx.pyi index 6149a9c97728..6d4d04ca47ca 100644 --- a/stubs/psutil/psutil/_psutil_osx.pyi +++ b/stubs/psutil/psutil/_psutil_osx.pyi @@ -62,4 +62,3 @@ if sys.platform == "darwin": def virtual_mem() -> tuple[int, int, int, int, int, int]: ... def check_pid_range(pid: int, /) -> None: ... def set_debug(value: bool, /) -> None: ... - def is_zombie() -> bool: ... From 0ce81ae72505e64de6fd48859562caf3f6733ca2 Mon Sep 17 00:00:00 2001 From: lev-blit <47675736+lev-blit@users.noreply.github.com> Date: Fri, 21 Nov 2025 13:25:12 +0200 Subject: [PATCH 10/13] Apply suggestions from code review Co-authored-by: Semyon Moroz --- stubs/psutil/psutil/_psutil_osx.pyi | 2 +- stubs/psutil/psutil/_psutil_posix.pyi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stubs/psutil/psutil/_psutil_osx.pyi b/stubs/psutil/psutil/_psutil_osx.pyi index 6d4d04ca47ca..2b27ee37863d 100644 --- a/stubs/psutil/psutil/_psutil_osx.pyi +++ b/stubs/psutil/psutil/_psutil_osx.pyi @@ -53,7 +53,7 @@ if sys.platform == "darwin": def disk_io_counters() -> dict[str, tuple[int, int, int, int, int, int]]: ... def disk_partitions() -> list[tuple[str, str, str, str]]: ... def disk_usage_used(mount_point: StrOrBytesPath, default: _T, /) -> int | _T: ... - def has_cpu_freq(*args, **kwargs) -> bool: ... + def has_cpu_freq() -> bool: ... def net_io_counters() -> dict[str, tuple[int, int, int, int, int, int, int, int]]: ... def per_cpu_times() -> list[tuple[float, float, float, float]]: ... def pids() -> list[int]: ... diff --git a/stubs/psutil/psutil/_psutil_posix.pyi b/stubs/psutil/psutil/_psutil_posix.pyi index 6f5f3b5dfcc6..15882298fd59 100644 --- a/stubs/psutil/psutil/_psutil_posix.pyi +++ b/stubs/psutil/psutil/_psutil_posix.pyi @@ -31,5 +31,5 @@ if sys.platform == "darwin": AF_LINK: Final[int] def net_if_duplex_speed(nic_name: str, /) -> list[int]: ... -def users(*args, **kwargs): ... +def users() -> list[tuple[Incomplete, ...]]: ... def setpriority(pid: int, priority: int, /) -> None: ... From 5237f09bd2c7ce93060784735c7651d57f333393 Mon Sep 17 00:00:00 2001 From: Lev Blit Date: Fri, 21 Nov 2025 13:32:15 +0200 Subject: [PATCH 11/13] add more CR suggestions --- stubs/psutil/psutil/_psbsd.pyi | 10 ++++++---- stubs/psutil/psutil/_pslinux.pyi | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/stubs/psutil/psutil/_psbsd.pyi b/stubs/psutil/psutil/_psbsd.pyi index 2e5115f516c2..e99fdd3081d7 100644 --- a/stubs/psutil/psutil/_psbsd.pyi +++ b/stubs/psutil/psutil/_psbsd.pyi @@ -11,6 +11,7 @@ from psutil._common import ( ZombieProcess as ZombieProcess, conn_tmap as conn_tmap, conn_to_ntuple as conn_to_ntuple, + debug as debug, memoize as memoize, pio, usage_percent as usage_percent, @@ -21,10 +22,7 @@ PROC_STATUSES: Incomplete TCP_STATUSES: Incomplete PAGESIZE: Incomplete AF_LINK: Incomplete -HAS_PER_CPU_TIMES: Incomplete HAS_PROC_NUM_THREADS: Incomplete -HAS_PROC_OPEN_FILES: Incomplete -HAS_PROC_NUM_FDS: Incomplete kinfo_proc_map: Incomplete class svmem(NamedTuple): @@ -108,6 +106,10 @@ def sensors_temperatures(): ... def cpu_freq(): ... def boot_time(): ... def users(): ... + +INIT_BOOT_TIME: float + +def adjust_proc_create_time(ctime: float) -> float: ... def pids(): ... def pid_exists(pid): ... def is_zombie(pid): ... @@ -132,7 +134,7 @@ class Process: def cpu_num(self): ... def memory_info(self): ... memory_full_info: Incomplete - def create_time(self): ... + def create_time(self, monotonic: bool = False) -> float: ... def num_threads(self): ... def num_ctx_switches(self): ... def threads(self): ... diff --git a/stubs/psutil/psutil/_pslinux.pyi b/stubs/psutil/psutil/_pslinux.pyi index edd4445e8c31..295c6c61744b 100644 --- a/stubs/psutil/psutil/_pslinux.pyi +++ b/stubs/psutil/psutil/_pslinux.pyi @@ -213,7 +213,7 @@ class Process: def cpu_times(self): ... def cpu_num(self): ... def wait(self, timeout: Incomplete | None = ...): ... - def create_time(self, monotonic: bool = False): ... + def create_time(self, monotonic: bool = False) -> float: ... def memory_info(self): ... def memory_full_info(self): ... def memory_maps(self): ... From 7c1b819202658d51f4faa0822e2e3bcf10d12518 Mon Sep 17 00:00:00 2001 From: Lev Blit Date: Fri, 21 Nov 2025 13:32:55 +0200 Subject: [PATCH 12/13] fix applied suggestions missing import --- stubs/psutil/psutil/_psutil_posix.pyi | 1 + 1 file changed, 1 insertion(+) diff --git a/stubs/psutil/psutil/_psutil_posix.pyi b/stubs/psutil/psutil/_psutil_posix.pyi index 15882298fd59..42ab74cb09e0 100644 --- a/stubs/psutil/psutil/_psutil_posix.pyi +++ b/stubs/psutil/psutil/_psutil_posix.pyi @@ -1,4 +1,5 @@ import sys +from _typeshed import Incomplete from typing import Final if sys.platform == "linux": From a84f78fb1198dc532c19900fbb18aa7d88ad3a64 Mon Sep 17 00:00:00 2001 From: Lev Blit Date: Fri, 21 Nov 2025 15:53:25 +0200 Subject: [PATCH 13/13] move debug to the correct place oops --- stubs/psutil/psutil/_psbsd.pyi | 1 - stubs/psutil/psutil/_psosx.pyi | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/psutil/psutil/_psbsd.pyi b/stubs/psutil/psutil/_psbsd.pyi index e99fdd3081d7..74a40361527d 100644 --- a/stubs/psutil/psutil/_psbsd.pyi +++ b/stubs/psutil/psutil/_psbsd.pyi @@ -11,7 +11,6 @@ from psutil._common import ( ZombieProcess as ZombieProcess, conn_tmap as conn_tmap, conn_to_ntuple as conn_to_ntuple, - debug as debug, memoize as memoize, pio, usage_percent as usage_percent, diff --git a/stubs/psutil/psutil/_psosx.pyi b/stubs/psutil/psutil/_psosx.pyi index 63679f0e06d4..1c74d57bb570 100644 --- a/stubs/psutil/psutil/_psosx.pyi +++ b/stubs/psutil/psutil/_psosx.pyi @@ -11,6 +11,7 @@ if sys.platform == "darwin": ZombieProcess as ZombieProcess, conn_tmap as conn_tmap, conn_to_ntuple as conn_to_ntuple, + debug as debug, isfile_strict as isfile_strict, memoize_when_activated as memoize_when_activated, parse_environ_block as parse_environ_block,