Skip to content
This repository has been archived by the owner on Jun 22, 2024. It is now read-only.

[pull] master from giampaolo:master #64

Open
wants to merge 75 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
20be5ae
ruff: enable and fix 'unused variable' rule
giampaolo Jun 2, 2024
4b1a054
Fix #2250 / NetBSD / cmdline: retry on EBUSY. (#2421)
giampaolo Jun 6, 2024
9421bf8
openbsd: skip test if cmdline() returns [] due to EBUSY
giampaolo Jun 6, 2024
89b6096
process_iter(): use another global var to keep track of reused PIDs
giampaolo Jun 9, 2024
5f80c12
Fix #2412, [macOS]: can't compile on macOS 10.4 PowerPC due to missin…
giampaolo Jun 11, 2024
1d092e7
test subprocesses: sleep() with an interval of 0.1 to make the test p…
giampaolo Jun 11, 2024
5b30ef4
Add aarch64 manylinux wheels (#2425)
mayeut Jun 18, 2024
3d5522a
release
giampaolo Jun 18, 2024
9c84c85
minor changes
giampaolo Jun 21, 2024
73af407
Fix GIL warnings and a few thread-safety issues in free-threaded CPyt…
colesbury Jun 24, 2024
c034e66
give credit to @colesbury / Sam Gross for #2401 and #2427
giampaolo Jun 24, 2024
8d94301
chore: bump cibuildwheel to 2.19.2 (#2429)
mayeut Aug 21, 2024
2dc2cd7
update ruff
giampaolo Sep 25, 2024
b1e52fc
comment freebsd
giampaolo Sep 25, 2024
a06e762
Define Py_GIL_DISABLED macro on Windows (#2442)
cvijdea-bd Sep 30, 2024
622bd44
Fix ABI3 wheels warnings (#2445)
giampaolo Oct 1, 2024
42c7a24
Use pytest, get rid of test/runner.py (#2447)
giampaolo Oct 1, 2024
3aff71d
Add `make install-sysdeps` target + re-enable BSD builds (#2448)
giampaolo Oct 2, 2024
04f19ee
Provide `test` and `dev` python dependencies (#2449)
giampaolo Oct 2, 2024
f84ca7d
get rid of reference to old test runner + update test instructions
giampaolo Oct 2, 2024
7d21555
use setup() options to pass py_limited_api to bdist_wheel & bump cibu…
mayeut Oct 3, 2024
00c0fe8
Pytest: use bare `assert` statements (#2453)
giampaolo Oct 3, 2024
8b71dce
refact Makefile and add scripts/internal/install_pip.py
giampaolo Oct 3, 2024
1054b5e
remove unittest.TestCase ovverride (no longer useful after pytest)
giampaolo Oct 5, 2024
70b6787
fix #2455 [Linux]: fix ``IndexError`` if /proc/pid/stat has no field …
giampaolo Oct 5, 2024
809dd5a
add unittest2 dep for python 2
giampaolo Oct 5, 2024
4e85bee
change call_until() signature so that it can be used with lambda
giampaolo Oct 5, 2024
80af879
revert change which broke python 2 tests
giampaolo Oct 6, 2024
4649a88
Run tests without pytests (#2456)
giampaolo Oct 6, 2024
0a71d0e
enable ruff cache (faster)
giampaolo Oct 9, 2024
f65fe44
[OpenBSD] Process `num_fds()` and `open_files()` may raise NSP for PI…
giampaolo Oct 14, 2024
223938f
Use `@pytest.mark.skipif` decorator instead of `@unittest.skipIf` (#2…
giampaolo Oct 15, 2024
b19d5bd
AIX: improve open_files() regexp speed (#2457)
AlekseyLobanov Oct 15, 2024
b1a7593
Use `pytest.skip` instead of `unittest.SkipTest` (#2461)
giampaolo Oct 15, 2024
567438c
[Windows] speed up `process_iter()` (#2444)
giampaolo Oct 17, 2024
fb68f9f
pre release
giampaolo Oct 17, 2024
8e89a05
update winmake.py
giampaolo Oct 20, 2024
3d12e67
fix syntax warning #2468
giampaolo Nov 6, 2024
687695c
fix #2470: `users()`_ may return "localhost" instead of the actual IP…
giampaolo Nov 11, 2024
66892b2
remove dead code
giampaolo Nov 13, 2024
83590ba
update issues.py crawler to detect docker
giampaolo Nov 17, 2024
d047352
Add Vulture (dead code detector) (#2471)
giampaolo Nov 17, 2024
7cae974
Merge branch 'master' of github.com:giampaolo/psutil
giampaolo Nov 17, 2024
e15f203
update winmake.py
giampaolo Nov 20, 2024
0866e1e
update winmake.py
giampaolo Nov 20, 2024
13a336b
fix #2418 / Linux: fix race condition
giampaolo Nov 24, 2024
b5ea67e
fix winmake.py test-parallel
giampaolo Dec 18, 2024
560c524
chore: bump cibuildwheel to 2.22.0, move to macos-13 (#2479)
mayeut Dec 18, 2024
45934bb
try to fix some flaky tests
giampaolo Dec 19, 2024
c0e1eb1
try to fix some flaky tests 2
giampaolo Dec 19, 2024
1f3458b
try to fix some flaky tests 2
giampaolo Dec 19, 2024
8162905
disable flafy test + pre-release
giampaolo Dec 19, 2024
1a63407
use a `set` literal when testing for membership
giampaolo Dec 19, 2024
4ba6ad0
ruff: enable PLR5501 (Use `elif` instead of `else` then `if`, to redu…
giampaolo Dec 19, 2024
58552f6
Merge branch 'master' of github.com:giampaolo/psutil
giampaolo Dec 19, 2024
fbb6d9c
cause appveyor run
giampaolo Dec 19, 2024
e957628
Drop Python 2.7 support (#2481)
giampaolo Dec 20, 2024
5d4be42
refact: check valid net_connections() kinds from a single point
giampaolo Dec 20, 2024
fffaba3
Use f-strings (#2483)
giampaolo Dec 20, 2024
93318fa
ruff: ignore specific python2 rules for setup.py
giampaolo Dec 20, 2024
c9088a5
use str.format() instead of % / percent format
giampaolo Dec 20, 2024
508fb5d
use str.format() instead of % / percent format
giampaolo Dec 20, 2024
318807f
remove psutil.test() ps-like function
giampaolo Dec 20, 2024
c3effb7
Test internal scripts (#2484)
giampaolo Dec 20, 2024
304f08f
Use str.format() instead of % (#2485)
giampaolo Dec 20, 2024
7890ad2
fix: python_requires>=3.6 (#2486)
mayeut Dec 21, 2024
7403704
Improved exceptions (`raise from ...`) (#2487)
giampaolo Dec 21, 2024
3ad810d
ruff: enable RET506 - [*] Unnecessary `else` after `raise` statement
giampaolo Dec 22, 2024
b42eccd
ruff: add RET502 - [*] Do not implicitly `return None` in function ab…
giampaolo Dec 22, 2024
107daa1
ruff: enable SIM115: Use context handler for opening files
giampaolo Dec 23, 2024
623e6e0
New ruff rules (#2489)
giampaolo Dec 28, 2024
d68cedb
remove deprecated memory_info_ex()
giampaolo Dec 28, 2024
3be9efe
update doc and history
giampaolo Dec 28, 2024
f4b5498
relax test tolerance
giampaolo Dec 28, 2024
d9b2bac
relax test tolerance
giampaolo Dec 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 11 additions & 31 deletions .github/workflows/bsd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,57 +11,37 @@ concurrency:
cancel-in-progress: true
jobs:
freebsd:
runs-on: ubuntu-22.04
# if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run tests
uses: vmactions/freebsd-vm@v1
with:
usesh: true
prepare: |
pkg install -y gcc python3
run: |
set -e -x
make install-pip
python3 -m pip install --user setuptools
make install
make test
make test-memleaks
PIP_BREAK_SYSTEM_PACKAGES=1 make install-sysdeps install-pydeps-test install print-sysinfo test test-memleaks

openbsd:
runs-on: ubuntu-22.04
# if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run tests
uses: vmactions/openbsd-vm@v1
with:
usesh: true
prepare: |
set -e
pkg_add gcc python3
run: |
set -e
make install-pip
python3 -m pip install --user setuptools
make install
make test
make test-memleaks
PIP_BREAK_SYSTEM_PACKAGES=1 make install-sysdeps install-pydeps-test install print-sysinfo test test-memleaks

netbsd:
runs-on: ubuntu-22.04
if: false # XXX: disabled
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run tests
uses: vmactions/netbsd-vm@v1
with:
usesh: true
prepare: |
set -e
/usr/sbin/pkg_add -v pkgin
pkgin update
pkgin -y install python311-* py311-setuptools-* gcc12-*
run: |
set -e
make install-pip PYTHON=python3.11
python3.11 -m pip install --user setuptools
make install PYTHON=python3.11
make test PYTHON=python3.11
make test-memleaks PYTHON=python3.11
PIP_BREAK_SYSTEM_PACKAGES=1 make PYTHON=python3.11 install-sysdeps install-pydeps-test install print-sysinfo test test-memleaks
90 changes: 35 additions & 55 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Runs CI tests and generates wheels on the following platforms:
#
# * Linux (py2 and py3)
# * macOS (py2 and py3)
# * Windows (py3, py2 is done by appveyor)
# * Linux
# * macOS
# * Windows
#
# Useful URLs:
# * https://github.com/pypa/cibuildwheel
Expand All @@ -16,25 +15,23 @@ concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && github.sha || '' }}
cancel-in-progress: true
jobs:
# Linux + macOS + Windows Python 3
py3:
name: py3-${{ matrix.os }}-${{ startsWith(matrix.os, 'ubuntu') && 'all' || matrix.archs }}

# Run tests on Linux, macOS, Windows
tests:
name: "tests, ${{ matrix.os }}, ${{ matrix.arch }}"
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
archs: "x86_64 i686"
- os: macos-12
archs: "x86_64"
- os: macos-14
archs: "arm64"
- os: windows-2019
archs: "AMD64"
- os: windows-2019
archs: "x86"
- {os: ubuntu-latest, arch: x86_64}
- {os: ubuntu-latest, arch: i686}
- {os: ubuntu-latest, arch: aarch64}
- {os: macos-13, arch: x86_64}
- {os: macos-14, arch: arm64}
- {os: windows-2019, arch: AMD64}
- {os: windows-2019, arch: x86}
steps:
- uses: actions/checkout@v4

Expand All @@ -51,16 +48,23 @@ jobs:
with:
python-version: 3.11

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
if: matrix.arch == 'aarch64'

- name: Create wheels + run tests
uses: pypa/cibuildwheel@v2.18.0
uses: pypa/cibuildwheel@v2.22.0
env:
CIBW_ARCHS: "${{ matrix.archs }}"
CIBW_PRERELEASE_PYTHONS: True
CIBW_ARCHS: "${{ matrix.arch }}"
CIBW_ENABLE: "cpython-prerelease"
CIBW_TEST_EXTRAS: test
CIBW_TEST_COMMAND:
make -C {project} PYTHON="env python" PSUTIL_SCRIPTS_DIR="{project}/scripts" install-sysdeps install-pydeps-test install print-sysinfo test test-memleaks

- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-py3-${{ matrix.os }}-${{ startsWith(matrix.os, 'ubuntu') && 'all' || matrix.archs }}
name: wheels-${{ matrix.os }}-${{ matrix.arch }}
path: wheelhouse

- name: Generate .tar.gz
Expand All @@ -70,43 +74,19 @@ jobs:
python setup.py sdist
mv dist/psutil*.tar.gz wheelhouse/

# Linux + macOS + Python 2
py2:
name: py2-${{ matrix.os }}
runs-on: ${{ matrix.os }}
# Test python 2.7 fallback installation message produced by setup.py
py2-fallback:
name: py2.7 setup.py check
runs-on: ubuntu-24.04
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-12]
env:
CIBW_TEST_COMMAND:
PYTHONWARNINGS=always PYTHONUNBUFFERED=1 PSUTIL_DEBUG=1 python {project}/psutil/tests/runner.py &&
PYTHONWARNINGS=always PYTHONUNBUFFERED=1 PSUTIL_DEBUG=1 python {project}/psutil/tests/test_memleaks.py
CIBW_TEST_EXTRAS: test
CIBW_BUILD: 'cp27-*'

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: LizardByte/setup-python-action@master
with:
python-version: 3.9

- name: Create wheels + run tests
uses: pypa/cibuildwheel@v1.12.0

- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-py2-${{ matrix.os }}
path: wheelhouse

- name: Generate .tar.gz
if: matrix.os == 'ubuntu-latest'
run: |
make generate-manifest
python setup.py sdist
mv dist/psutil*.tar.gz wheelhouse/
python-version: '2.7'
- run: python scripts/internal/test_python2_setup_py.py

# Run linters
linters:
Expand All @@ -118,12 +98,12 @@ jobs:
python-version: 3.x
- name: 'Run linters'
run: |
python3 -m pip install ruff==0.4.4 black rstcheck toml-sort sphinx
python3 -m pip install ruff black rstcheck toml-sort sphinx
make lint-all

# upload weels as a single artefact
# Produce wheels as artifacts.
upload-wheels:
needs: [py2, py3]
needs: [tests]
runs-on: ubuntu-latest
steps:
- uses: actions/upload-artifact/merge@v4
Expand Down
46 changes: 23 additions & 23 deletions .github/workflows/issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
on the situation.
"""

from __future__ import print_function

import functools
import json
Expand Down Expand Up @@ -42,7 +41,7 @@
"windows", "win32", "WinError", "WindowsError", "win10", "win7",
"win ", "mingw", "msys", "studio", "microsoft", "make.bat",
"CloseHandle", "GetLastError", "NtQuery", "DLL", "MSVC", "TCHAR",
"WCHAR", ".bat", "OpenProcess", "TerminateProcess", "appveyor",
"WCHAR", ".bat", "OpenProcess", "TerminateProcess",
"windows error", "NtWow64", "NTSTATUS", "Visual Studio",
],
"macos": [
Expand All @@ -62,6 +61,11 @@
"/dev/pts", "posix",
],
"pypy": ["pypy"],
"docker": ["docker", "docker-compose"],
"vm": [
"docker", "docker-compose", "vmware", "lxc", "hyperv", "virtualpc",
"virtualbox", "bhyve", "openvz", "lxc", "xen", "kvm", "qemu", "heroku",
],
# types
"enhancement": ["enhancement"],
"memleak": ["memory leak", "leaks memory", "memleak", "mem leak"],
Expand All @@ -84,14 +88,14 @@
],
# tests
"tests": [
" test ", "tests", "travis", "coverage", "cirrus", "appveyor",
" test ", "tests", "travis", "coverage", "cirrus",
"continuous integration", "unittest", "pytest", "unit test",
],
# critical errors
"priority-high": [
"critical": [
"WinError", "WindowsError", "RuntimeError", "ZeroDivisionError",
"SystemError", "MemoryError", "core dumped",
"segfault", "segmentation fault",
"SystemError", "MemoryError", "core dump", "segfault",
"segmentation fault",
],
}

Expand Down Expand Up @@ -144,11 +148,6 @@ def has_label(issue, label):
return label in assigned


def has_os_label(issue):
labels = set([x.name for x in issue.labels])
return any(x in labels for x in OS_LABELS)


def get_repo():
repo = os.environ['GITHUB_REPOSITORY']
token = os.environ['GITHUB_TOKEN']
Expand All @@ -160,9 +159,10 @@ def get_repo():

@functools.lru_cache()
def _get_event_data():
ret = json.load(open(os.environ["GITHUB_EVENT_PATH"]))
pp(ret)
return ret
with open(os.environ["GITHUB_EVENT_PATH"]) as f:
ret = json.load(f)
pp(ret)
return ret


def is_event_new_issue():
Expand Down Expand Up @@ -195,29 +195,29 @@ def get_issue():

def log(msg):
if '\n' in msg or "\r\n" in msg:
print(">>>\n%s\n<<<" % msg, flush=True)
print(f">>>\n{msg}\n<<<", flush=True)
else:
print(">>> %s <<<" % msg, flush=True)
print(f">>> {msg} <<<", flush=True)


def add_label(issue, label):
def should_add(issue, label):
if has_label(issue, label):
log("already has label %r" % (label))
log(f"already has label {label!r}")
return False

for left, right in ILLOGICAL_PAIRS:
if label == left and has_label(issue, right):
log("already has label" % (label))
log(f"already has label f{label}")
return False

return not has_label(issue, label)

if not should_add(issue, label):
log("should not add label %r" % label)
log(f"should not add label {label!r}")
return

log("add label %r" % label)
log(f"add label {label!r}")
issue.add_to_labels(label)


Expand Down Expand Up @@ -330,16 +330,16 @@ def on_new_pr(issue):
def main():
issue = get_issue()
stype = "PR" if is_pr(issue) else "issue"
log("running issue bot for %s %r" % (stype, issue))
log(f"running issue bot for {stype} {issue!r}")

if is_event_new_issue():
log("created new issue %s" % issue)
log(f"created new issue {issue}")
add_labels_from_text(issue, issue.title)
if issue.body:
add_labels_from_new_body(issue, issue.body)
on_new_issue(issue)
elif is_event_new_pr():
log("created new PR %s" % issue)
log(f"created new PR {issue}")
add_labels_from_text(issue, issue.title)
if issue.body:
add_labels_from_new_body(issue, issue.body)
Expand Down
9 changes: 9 additions & 0 deletions CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -831,3 +831,12 @@ I: 2376
N: Anthony Ryan
W: https://github.com/anthonyryan1
I: 2272

N: Sam Gross
W: https://github.com/colesbury
I: 2401, 2427

N: Aleksey Lobanov
C: Russia
E: alex_github@likemath.ru
W: https://github.com/AlekseyLobanov
Loading