Skip to content

Commit

Permalink
Merge branch 'master' into win-fast-create-time
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Oct 17, 2024
2 parents 06fb9c1 + b1a7593 commit 0a98a04
Show file tree
Hide file tree
Showing 64 changed files with 3,088 additions and 3,236 deletions.
112 changes: 46 additions & 66 deletions .github/workflows/bsd.yml
Original file line number Diff line number Diff line change
@@ -1,67 +1,47 @@
# # Execute tests on *BSD platforms. Does not produce wheels.
# # Useful URLs:
# # https://github.com/vmactions/freebsd-vm
# # https://github.com/vmactions/openbsd-vm
# # https://github.com/vmactions/netbsd-vm
# Execute tests on *BSD platforms. Does not produce wheels.
# Useful URLs:
# https://github.com/vmactions/freebsd-vm
# https://github.com/vmactions/openbsd-vm
# https://github.com/vmactions/netbsd-vm

# on: [push, pull_request]
# name: bsd-tests
# 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:
# freebsd:
# runs-on: ubuntu-22.04
# 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
# openbsd:
# runs-on: ubuntu-22.04
# 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
# netbsd:
# runs-on: ubuntu-22.04
# 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
on: [push, pull_request]
name: bsd-tests
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:
freebsd:
# if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run tests
uses: vmactions/freebsd-vm@v1
with:
usesh: true
run: |
PIP_BREAK_SYSTEM_PACKAGES=1 make install-sysdeps install-pydeps-test install print-sysinfo test test-memleaks
openbsd:
# if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run tests
uses: vmactions/openbsd-vm@v1
with:
usesh: true
run: |
PIP_BREAK_SYSTEM_PACKAGES=1 make install-sysdeps install-pydeps-test install print-sysinfo test test-memleaks
netbsd:
# if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run tests
uses: vmactions/netbsd-vm@v1
with:
usesh: true
run: |
PIP_BREAK_SYSTEM_PACKAGES=1 make PYTHON=python3.11 install-sysdeps install-pydeps-test install print-sysinfo test test-memleaks
16 changes: 9 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ concurrency:
jobs:
# Linux + macOS + Windows Python 3
py3:
name: "py3-${{ matrix.os }}-${{ matrix.arch }}"
name: "py3, ${{ matrix.os }}, ${{ matrix.arch }}"
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
Expand Down Expand Up @@ -53,10 +53,13 @@ jobs:
if: matrix.arch == 'aarch64'

- name: Create wheels + run tests
uses: pypa/cibuildwheel@v2.19.2
uses: pypa/cibuildwheel@v2.21.2
env:
CIBW_ARCHS: "${{ matrix.arch }}"
CIBW_PRERELEASE_PYTHONS: True
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
Expand All @@ -73,19 +76,18 @@ jobs:
# Linux + macOS + Python 2
py2:
name: py2-${{ matrix.os }}
name: py2, ${{ matrix.os }}
runs-on: ${{ matrix.os }}
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-*'
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

steps:
- uses: actions/checkout@v4
Expand Down
5 changes: 5 additions & 0 deletions CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -835,3 +835,8 @@ I: 2272
N: Sam Gross
W: https://github.com/colesbury
I: 2401, 2427

N: Aleksey Lobanov
C: Russia
E: [email protected]
W: https://github.com/AlekseyLobanov
23 changes: 22 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@
*Bug tracker at https://github.com/giampaolo/psutil/issues*

6.0.1 (IN DEVELOPMENT)
6.1.0 (IN DEVELOPMENT)
======================

XXXX-XX-XX

**Enhancements**

- 2446_: use pytest instead of unittest.
- 2448_: add ``make install-sysdeps`` target to install the necessary system
dependencies (python-dev, gcc, etc.) on all supported UNIX flavors.
- 2449_: add ``make install-pydeps-test`` and ``make install-pydeps-dev``
targets. They can be used to install dependencies meant for running tests and
for local development. They can also be installed via ``pip install .[test]``
and ``pip install .[dev]``.
- 2456_: allow to run tests via ``python3 -m psutil.tests`` even if ``pytest``
module is not installed. This is useful for production environments that
don't have pytest installed, but still want to be able to test psutil
installation.

**Bug fixes**

- 2427_: psutil (segfault) on import in the free-threaded (no GIL) version of
Python 3.13. (patch by Sam Gross)
- 2455_, [Linux]: ``IndexError`` may occur when reading /proc/pid/stat and
field 40 (blkio_ticks) is missing.
- 2457_, [AIX]: significantly improve the speed of `Process.open_files()`_ for
some edge cases.
- 2460_, [OpenBSD]: `Process.num_fds()`_ and `Process.open_files()`_ may fail
with `NoSuchProcess`_ for PID 0. Instead, we now return "null" values (0 and
[] respectively).

6.0.0
======
Expand Down
47 changes: 34 additions & 13 deletions INSTALL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,32 @@ install a C compiler. All you have to do is::
If wheels are not available for your platform or architecture, or you wish to
build & install psutil from sources, keep reading.

Linux (build)
-------------
Compile psutil from sources
===========================

UNIX
----

On all UNIX systems you can use the `install-sysdeps.sh
<https://github.com/giampaolo/psutil/blob/master/scripts/internal/install-sysdeps.sh>`__
script. This will install the system dependencies necessary to compile psutil
from sources. You can invoke this script from the Makefile as::

make install-sysdeps

After system deps are installed, you can compile & install psutil with::

make build
make install

Ubuntu / Debian::
...or this, which will fetch the latest source distribution from `PyPI <https://pypi.org/project/psutil/>`__::

pip install --no-binary :all: psutil

Linux
-----

Debian / Ubuntu::

sudo apt-get install gcc python3-dev
pip install --no-binary :all: psutil
Expand All @@ -30,14 +52,13 @@ Alpine::
sudo apk add gcc python3-dev musl-dev linux-headers
pip install --no-binary :all: psutil

Windows (build)
---------------
Windows
-------

In order to install psutil from sources on Windows you need Visual Studio
(MinGW is not supported).
Here's a couple of guides describing how to do it: `link <https://blog.ionelmc.ro/2014/12/21/compiling-python-extensions-on-windows/>`__
and `link <https://cpython-core-tutorial.readthedocs.io/en/latest/build_cpython_windows.html>`__.
Once VS is installed do::
In order to build / install psutil from sources on Windows you need to install
`Visua Studio 2017 <https://visualstudio.microsoft.com/vs/older-downloads/>`__
or later (see cPython `devguide <https://devguide.python.org/getting-started/setup-building/#windows>`__'s instructions).
MinGW is not supported. Once Visual Studio is installed do::

pip install --no-binary :all: psutil

Expand All @@ -61,7 +82,7 @@ OpenBSD

::

export PKG_PATH=http://ftp.eu.openbsd.org/pub/OpenBSD/`uname -r`/packages/`uname -m`/
export PKG_PATH=https://cdn.openbsd.org/pub/OpenBSD/`uname -r`/packages/`uname -m`/
pkg_add -v python3 gcc
pip install psutil

Expand All @@ -72,7 +93,7 @@ Assuming Python 3.11 (the most recent at the time of writing):

::

export PKG_PATH="http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/`uname -m`/`uname -r`/All"
export PKG_PATH="https://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/`uname -m`/`uname -r`/All"
pkg_add -v pkgin
pkgin install python311-* gcc12-* py311-setuptools-* py311-pip-*
python3.11 -m pip install psutil
Expand All @@ -96,7 +117,7 @@ Install pip
-----------

Pip is shipped by default with Python 2.7.9+ and 3.4+.
If you don't have pip you can install with wget::
If you don't have pip you can install it with wget::

wget https://bootstrap.pypa.io/get-pip.py -O - | python3

Expand Down
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ include psutil/arch/windows/wmi.h
include psutil/tests/README.rst
include psutil/tests/__init__.py
include psutil/tests/__main__.py
include psutil/tests/runner.py
include psutil/tests/test_aix.py
include psutil/tests/test_bsd.py
include psutil/tests/test_connections.py
Expand Down Expand Up @@ -188,6 +187,8 @@ include scripts/internal/download_wheels_appveyor.py
include scripts/internal/download_wheels_github.py
include scripts/internal/generate_manifest.py
include scripts/internal/git_pre_commit.py
include scripts/internal/install-sysdeps.sh
include scripts/internal/install_pip.py
include scripts/internal/print_access_denied.py
include scripts/internal/print_announce.py
include scripts/internal/print_api_speed.py
Expand Down
Loading

0 comments on commit 0a98a04

Please sign in to comment.