diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6cbb35d72..1e2912267 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -51,7 +51,17 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + + # see https://cibuildwheel.pypa.io/en/stable/faq/#macos-building-cpython-38-wheels-on-arm64 + - name: "Install python 3.8 universal2 on macOS arm64" + if: runner.os == 'macOS' && runner.arch == 'ARM64' + uses: actions/setup-python@v5 + env: + PIP_DISABLE_PIP_VERSION_CHECK: 1 + with: + python-version: 3.8 + + - uses: actions/setup-python@v5 with: python-version: 3.11 @@ -60,7 +70,7 @@ jobs: if: matrix.archs == 'aarch64' - name: Create wheels + run tests - uses: pypa/cibuildwheel@v2.17.0 + uses: pypa/cibuildwheel@v2.18.0 with: config-file: "./cibuildwheel.toml" env: @@ -68,9 +78,9 @@ jobs: CIBW_PRERELEASE_PYTHONS: True - name: Upload wheels - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: wheels + name: wheels-py3-${{ matrix.os }}-${{ startsWith(matrix.os, 'ubuntu') && 'all' || matrix.archs }} path: wheelhouse - uses: softprops/action-gh-release@v1 @@ -106,7 +116,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: 3.9 @@ -114,9 +124,9 @@ jobs: uses: pypa/cibuildwheel@v1.12.0 - name: Upload wheels - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: wheels + name: wheels-py2-${{ matrix.os }} path: wheelhouse - uses: softprops/action-gh-release@v1 @@ -157,24 +167,36 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: 3.x - name: 'Run linters' run: | - python3 -m pip install ruff==0.3.4 black rstcheck toml-sort sphinx + python3 -m pip install ruff==0.4.4 black rstcheck toml-sort sphinx make lint-all + # upload weels as a single artefact + upload-wheels: + needs: [py2, py3] + runs-on: ubuntu-latest + steps: + - uses: actions/upload-artifact/merge@v4 + with: + name: wheels + pattern: wheels-* + separate-directories: false + delete-merged: true + # Check sanity of .tar.gz + wheel files check-dist: - needs: [py2, py3] + needs: [upload-wheels] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: 3.x - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: wheels path: wheelhouse diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index 3d3adbf83..a9f665eb6 100644 --- a/.github/workflows/issues.yml +++ b/.github/workflows/issues.yml @@ -15,7 +15,7 @@ jobs: # install python - uses: actions/checkout@v4 - name: Install Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.x' diff --git a/HISTORY.rst b/HISTORY.rst index 15333dbaf..a53590555 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -14,6 +14,7 @@ been reused. This makes `process_iter()`_ around 20x times faster. - 2396_: a new ``psutil.process_iter.cache_clear()`` API can be used the clear `process_iter()`_ internal cache. +- 2401_, Support building with free-threaded CPython 3.13. - 2407_: `Process.connections()`_ was renamed to `Process.net_connections()`_. The old name is still available, but it's deprecated (triggers a ``DeprecationWarning``) and will be removed in the future. diff --git a/Makefile b/Makefile index e123a93c0..0406fb6da 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ PY3_DEPS = \ pypinfo \ requests \ rstcheck \ - ruff==0.3.4 \ + ruff==0.4.4 \ setuptools \ sphinx_rtd_theme \ teyit \ diff --git a/pyproject.toml b/pyproject.toml index 6f5bab2da..99a9b44d5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -205,7 +205,11 @@ spaces_indent_inline_array = 4 trailing_comma_inline_array = true [tool.cibuildwheel] -skip = ["*-musllinux*", "pp*"] +skip = [ + "*-musllinux*", + "cp313-win*", # pywin32 is not available on cp313 yet + "pp*", +] test-command = [ "env PYTHONWARNINGS=always PYTHONUNBUFFERED=1 PSUTIL_DEBUG=1 PSUTIL_SCRIPTS_DIR={project}/scripts python {project}/psutil/tests/runner.py", "env PYTHONWARNINGS=always PYTHONUNBUFFERED=1 PSUTIL_DEBUG=1 PSUTIL_SCRIPTS_DIR={project}/scripts python {project}/psutil/tests/test_memleaks.py", diff --git a/setup.py b/setup.py index 7c59f5645..3c7900669 100755 --- a/setup.py +++ b/setup.py @@ -19,6 +19,7 @@ import struct import subprocess import sys +import sysconfig import tempfile import warnings @@ -65,6 +66,7 @@ PY37_PLUS = sys.version_info[:2] >= (3, 7) CP36_PLUS = PY36_PLUS and sys.implementation.name == "cpython" CP37_PLUS = PY37_PLUS and sys.implementation.name == "cpython" +Py_GIL_DISABLED = sysconfig.get_config_var("Py_GIL_DISABLED") macros = [] if POSIX: @@ -118,10 +120,10 @@ def get_version(): # Py_LIMITED_API lets us create a single wheel which works with multiple # python versions, including unreleased ones. -if bdist_wheel and CP36_PLUS and (MACOS or LINUX): +if bdist_wheel and CP36_PLUS and (MACOS or LINUX) and not Py_GIL_DISABLED: py_limited_api = {"py_limited_api": True} macros.append(('Py_LIMITED_API', '0x03060000')) -elif bdist_wheel and CP37_PLUS and WINDOWS: +elif bdist_wheel and CP37_PLUS and WINDOWS and not Py_GIL_DISABLED: # PyErr_SetFromWindowsErr / PyErr_SetFromWindowsErrWithFilename are # part of the stable API/ABI starting with CPython 3.7 py_limited_api = {"py_limited_api": True}