From 21c9173be828cf582c4e89726bd7e662ea3d0448 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Mon, 26 Oct 2026 08:55:20 +0100 Subject: [PATCH 1/3] Build and publish PyPy wheels --- .github/workflows/pre-commit.yml | 2 +- .github/workflows/tests.yml | 208 +++++++++---------------------- .gitignore | 2 + .manylinux-install.sh | 19 ++- .meta.toml | 2 +- .pre-commit-config.yaml | 15 ++- tox.ini | 8 +- 7 files changed, 86 insertions(+), 170 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 136dce6..78609a5 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -30,7 +30,7 @@ jobs: extra_args: --all-files --show-diff-on-failure env: PRE_COMMIT_COLOR: always - - uses: pre-commit-ci/lite-action@5d6cc0eb514c891a40562a58a8e71576c5c7fb43 #v1.1.0 + - uses: pre-commit-ci/lite-action@062bca0919bc9d6e66755cc05074b70c77e111fc #v1.2.0 if: always() with: msg: Apply pre-commit code formatting diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b6599be..2bd2dfd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -96,33 +96,17 @@ jobs: matrix: python-version: - "pypy-3.11" - - "3.10" - "3.11" - "3.12" - "3.13" + - "3.14t" - "3.14" + - "3.15t" - "3.15" os: [ubuntu-latest, macos-latest, windows-latest, windows-11-arm] exclude: - - os: macos-latest - python-version: "pypy-3.11" - os: windows-11-arm python-version: "pypy-3.11" - - os: windows-11-arm - python-version: "3.10" - include: - - python-version: "3.14t" - os: ubuntu-latest - - python-version: "3.14t" - os: macos-latest - - python-version: "3.14t" - os: windows-latest - - python-version: "3.15t" - os: ubuntu-latest - - python-version: "3.15t" - os: macos-latest - - python-version: "3.15t" - os: windows-latest steps: - name: checkout @@ -140,15 +124,6 @@ jobs: # to save the cache. So it must come before the thing we want to use # the cache. ### - - name: Get pip cache epoch - id: pip-cache-epoch - # ``actions/cache`` never replaces an entry: "if the provided key - # matches an existing cache, a new cache is not created". A corrupt - # entry would therefore break every run that restores it until GitHub - # evicts it. Rotating the key weekly abandons such an entry instead. - run: | - echo "week=$(date -u +%G-%V)" >> "$GITHUB_OUTPUT" - - name: Get pip cache dir id: pip-cache run: | @@ -158,19 +133,18 @@ jobs: uses: actions/cache@v5 with: path: ${{ steps.pip-cache.outputs.dir }} - key: ${{ runner.os }}-${{ runner.arch }}-pip-${{ matrix.python-version }}-${{ steps.pip-cache-epoch.outputs.week }} + key: ${{ runner.os }}-${{ runner.arch }}-pip-${{ matrix.python-version }} - - - name: Install Build Dependencies (3.15) - if: startsWith(matrix.python-version, '3.15') - run: | - python -m pip install -U pip - pip install -U "setuptools >= 78.1.1,< 82" wheel twine cffi pycparser - name: Install Build Dependencies - if: ${{ !startsWith(matrix.python-version, '3.15') }} run: | - python -m pip install -U pip - pip install -U "setuptools >= 78.1.1,< 82" wheel twine + # PyPI downloads are occasionally cut off mid-transfer, which makes + # pip fail with ``IncompleteRead``. pip does not retry a truncated + # download, so retry the complete command. Purge pip's cache before + # the last attempt: should a truncated download ever get *cached*, + # it would fail every attempt in the same way. + retry() { for i in 1 2; do "$@" && return 0; echo "Attempt $i failed, retrying in 15s ..."; sleep 15; done; pip cache purge || true; "$@"; } + retry python -m pip install -U pip + retry pip install -U "setuptools >= 78.1.1,< 82" wheel twine - name: Build persistent (macOS x86_64) if: > @@ -211,23 +185,21 @@ jobs: - name: Create persistent sdist if: > startsWith(runner.os, 'Linux') - && matrix.python-version == '3.14' + && matrix.python-version == '3.15' run: | python setup.py sdist - - name: Install persistent and dependencies (3.15) - if: startsWith(matrix.python-version, '3.15') - run: | - # Install to collect dependencies into the (pip) cache. - # Use "--pre" here because dependencies with support for this future - # Python release may only be available as pre-releases - pip install --pre .[test] - name: Install persistent and dependencies - if: ${{ !startsWith(matrix.python-version, '3.15') }} run: | + # PyPI downloads are occasionally cut off mid-transfer, which makes + # pip fail with ``IncompleteRead``. pip does not retry a truncated + # download, so retry the complete command. Purge pip's cache before + # the last attempt: should a truncated download ever get *cached*, + # it would fail every attempt in the same way. + retry() { for i in 1 2; do "$@" && return 0; echo "Attempt $i failed, retrying in 15s ..."; sleep 15; done; pip cache purge || true; "$@"; } # Install to collect dependencies into the (pip) cache. - python -m pip install -U pip "setuptools >= 78.1.1,< 82" - pip install .[test] + retry python -m pip install -U pip "setuptools >= 78.1.1,< 82" + retry pip install .[test] - name: Check persistent build run: | @@ -239,6 +211,7 @@ jobs: - name: Upload persistent wheel (macOS x86_64) if: > startsWith(runner.os, 'Mac') + && !startsWith(matrix.python-version, 'pypy') uses: actions/upload-artifact@v7 with: # The x86_64 wheel is uploaded with a different name just so it can be @@ -249,7 +222,6 @@ jobs: - name: Upload persistent wheel (macOS arm64) if: > startsWith(runner.os, 'Mac') - && !startsWith(matrix.python-version, 'pypy') uses: actions/upload-artifact@v7 with: name: persistent-${{ runner.os }}-${{ matrix.python-version }}.whl @@ -271,7 +243,7 @@ jobs: - name: Upload persistent sdist if: > startsWith(runner.os, 'Linux') - && matrix.python-version == '3.14' + && matrix.python-version == '3.15' uses: actions/upload-artifact@v7 with: name: persistent.tar.gz @@ -285,33 +257,17 @@ jobs: matrix: python-version: - "pypy-3.11" - - "3.10" - "3.11" - "3.12" - "3.13" + - "3.14t" - "3.14" + - "3.15t" - "3.15" os: [ubuntu-latest, macos-latest, windows-latest, windows-11-arm] exclude: - - os: macos-latest - python-version: "pypy-3.11" - os: windows-11-arm python-version: "pypy-3.11" - - os: windows-11-arm - python-version: "3.10" - include: - - python-version: "3.14t" - os: ubuntu-latest - - python-version: "3.14t" - os: macos-latest - - python-version: "3.14t" - os: windows-latest - - python-version: "3.15t" - os: ubuntu-latest - - python-version: "3.15t" - os: macos-latest - - python-version: "3.15t" - os: windows-latest steps: - name: checkout @@ -329,15 +285,6 @@ jobs: # to save the cache. So it must come before the thing we want to use # the cache. ### - - name: Get pip cache epoch - id: pip-cache-epoch - # ``actions/cache`` never replaces an entry: "if the provided key - # matches an existing cache, a new cache is not created". A corrupt - # entry would therefore break every run that restores it until GitHub - # evicts it. Rotating the key weekly abandons such an entry instead. - run: | - echo "week=$(date -u +%G-%V)" >> "$GITHUB_OUTPUT" - - name: Get pip cache dir id: pip-cache run: | @@ -347,8 +294,7 @@ jobs: uses: actions/cache@v5 with: path: ${{ steps.pip-cache.outputs.dir }} - key: ${{ runner.os }}-${{ runner.arch }}-pip-${{ matrix.python-version }}-${{ steps.pip-cache-epoch.outputs.week }} - + key: ${{ runner.os }}-${{ runner.arch }}-pip-${{ matrix.python-version }} - name: Download persistent wheel (Linux/macOS) if: "!startsWith(runner.os, 'Windows')" uses: actions/download-artifact@v8 @@ -362,33 +308,23 @@ jobs: with: name: persistent-${{ runner.os }}-${{ matrix.python-version }}-${{ runner.arch }}.whl path: dist/ - - name: Install persistent ${{ matrix.python-version }} - if: startsWith(matrix.python-version, '3.15') - run: | - pip install -U wheel "setuptools >= 78.1.1,< 82" - # coverage might have a wheel on PyPI for a future python version which is - # not ABI compatible with the current one, so build it from sdist: - pip install -U --no-binary :all: coverage[toml] - # Unzip into src/ so that testrunner can find the .so files - # when we ask it to load tests from that directory. This - # might also save some build time? - ls -l dist/ - unzip -n dist/*.whl -d src - # Use "--pre" here because dependencies with support for this future - # Python release may only be available as pre-releases - pip install --pre -e .[test] - name: Install persistent - if: ${{ !startsWith(matrix.python-version, '3.15') }} run: | - pip install -U wheel "setuptools >= 78.1.1,< 82" - pip install -U coverage[toml] - pip install -U 'cffi; platform_python_implementation == "CPython"' + # PyPI downloads are occasionally cut off mid-transfer, which makes + # pip fail with ``IncompleteRead``. pip does not retry a truncated + # download, so retry the complete command. Purge pip's cache before + # the last attempt: should a truncated download ever get *cached*, + # it would fail every attempt in the same way. + retry() { for i in 1 2; do "$@" && return 0; echo "Attempt $i failed, retrying in 15s ..."; sleep 15; done; pip cache purge || true; "$@"; } + retry pip install -U wheel "setuptools >= 78.1.1,< 82" + retry pip install -U coverage[toml] + retry pip install -U 'cffi; platform_python_implementation == "CPython"' # Unzip into src/ so that testrunner can find the .so files # when we ask it to load tests from that directory. This # might also save some build time? ls -l dist/ unzip -n dist/*.whl -d src - pip install -e .[test] + retry pip install -e .[test] - name: Run tests with C extensions if: ${{ !startsWith(matrix.python-version, 'pypy') }} run: | @@ -443,15 +379,6 @@ jobs: # to save the cache. So it must come before the thing we want to use # the cache. ### - - name: Get pip cache epoch - id: pip-cache-epoch - # ``actions/cache`` never replaces an entry: "if the provided key - # matches an existing cache, a new cache is not created". A corrupt - # entry would therefore break every run that restores it until GitHub - # evicts it. Rotating the key weekly abandons such an entry instead. - run: | - echo "week=$(date -u +%G-%V)" >> "$GITHUB_OUTPUT" - - name: Get pip cache dir id: pip-cache run: | @@ -461,8 +388,7 @@ jobs: uses: actions/cache@v5 with: path: ${{ steps.pip-cache.outputs.dir }} - key: ${{ runner.os }}-${{ runner.arch }}-pip-${{ matrix.python-version }}-${{ steps.pip-cache-epoch.outputs.week }} - + key: ${{ runner.os }}-${{ runner.arch }}-pip-${{ matrix.python-version }} - name: Download persistent wheel uses: actions/download-artifact@v8 with: @@ -470,9 +396,15 @@ jobs: path: dist/ - name: Install persistent run: | - pip install -U wheel - pip install -U coverage[toml] - pip install -U "`ls dist/*.whl`[docs]" + # PyPI downloads are occasionally cut off mid-transfer, which makes + # pip fail with ``IncompleteRead``. pip does not retry a truncated + # download, so retry the complete command. Purge pip's cache before + # the last attempt: should a truncated download ever get *cached*, + # it would fail every attempt in the same way. + retry() { for i in 1 2; do "$@" && return 0; echo "Attempt $i failed, retrying in 15s ..."; sleep 15; done; pip cache purge || true; "$@"; } + retry pip install -U wheel + retry pip install -U coverage[toml] + retry pip install -U "`ls dist/*.whl`[docs]" - name: Build docs env: ZOPE_INTERFACE_STRICT_IRO: 1 @@ -504,15 +436,6 @@ jobs: # to save the cache. So it must come before the thing we want to use # the cache. ### - - name: Get pip cache epoch - id: pip-cache-epoch - # ``actions/cache`` never replaces an entry: "if the provided key - # matches an existing cache, a new cache is not created". A corrupt - # entry would therefore break every run that restores it until GitHub - # evicts it. Rotating the key weekly abandons such an entry instead. - run: | - echo "week=$(date -u +%G-%V)" >> "$GITHUB_OUTPUT" - - name: Get pip cache dir id: pip-cache run: | @@ -522,8 +445,7 @@ jobs: uses: actions/cache@v5 with: path: ${{ steps.pip-cache.outputs.dir }} - key: ${{ runner.os }}-${{ runner.arch }}-pip-${{ matrix.python-version }}-${{ steps.pip-cache-epoch.outputs.week }} - + key: ${{ runner.os }}-${{ runner.arch }}-pip-${{ matrix.python-version }} - name: Download persistent wheel uses: actions/download-artifact@v8 with: @@ -531,9 +453,15 @@ jobs: path: dist/ - name: Install persistent run: | - pip install -U wheel - pip install -U tox - pip install -U "`ls dist/*.whl`[docs]" + # PyPI downloads are occasionally cut off mid-transfer, which makes + # pip fail with ``IncompleteRead``. pip does not retry a truncated + # download, so retry the complete command. Purge pip's cache before + # the last attempt: should a truncated download ever get *cached*, + # it would fail every attempt in the same way. + retry() { for i in 1 2; do "$@" && return 0; echo "Attempt $i failed, retrying in 15s ..."; sleep 15; done; pip cache purge || true; "$@"; } + retry pip install -U wheel + retry pip install -U tox + retry pip install -U "`ls dist/*.whl`[docs]" - name: Run release check env: ZOPE_INTERFACE_STRICT_IRO: 1 @@ -572,15 +500,6 @@ jobs: # to save the cache. So it must come before the thing we want to use # the cache. ### - - name: Get pip cache epoch - id: pip-cache-epoch - # ``actions/cache`` never replaces an entry: "if the provided key - # matches an existing cache, a new cache is not created". A corrupt - # entry would therefore break every run that restores it until GitHub - # evicts it. Rotating the key weekly abandons such an entry instead. - run: | - echo "week=$(date -u +%G-%V)" >> "$GITHUB_OUTPUT" - - name: Get pip cache dir id: pip-cache run: | @@ -590,8 +509,7 @@ jobs: uses: actions/cache@v5 with: path: ${{ steps.pip-cache.outputs.dir }} - key: ${{ runner.os }}-pip_manylinux-${{ matrix.image }}-${{ matrix.python-version }}-${{ steps.pip-cache-epoch.outputs.week }} - + key: ${{ runner.os }}-pip_manylinux-${{ matrix.image }}-${{ matrix.python-version }} - name: Update pip run: python -m pip install -U pip @@ -622,16 +540,13 @@ jobs: - name: Restore pip cache permissions run: sudo chown -R $(whoami) ${{ steps.pip-cache.outputs.dir }} - - name: Prevent publishing wheels for unreleased Python versions - run: VER=$(echo '3.15' | tr -d .) && ls -al wheelhouse && sudo rm -f wheelhouse/*-cp${VER}*.whl && ls -al wheelhouse - publish: name: Publish to PyPI runs-on: ubuntu-latest # Only publish on tag pushes if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - # Wait for both build jobs to complete - needs: [build-package, manylinux] + # Only publish if the packages were built and the tests passed + needs: [build-package, manylinux, test, docs, release-check] environment: name: pypi url: https://pypi.org/p/persistent @@ -655,17 +570,12 @@ jobs: - name: Remove undesired wheels (if any were downloaded) run: | - # PyPy wheels shouldn't be uploaded, remove them if present - find dist/ -name "*pypy*" -type f -delete || true find dist/ -name "*none-any*" -type f -delete || true - # Wheels for the not-yet-supported future Python version need to go - find dist/ -name "*3.15*" -type f -delete || true - find dist/ -name "*cp315*" -type f -delete || true # For Linux, we only want the manylinux wheels find dist/ -name "*linux_x86_64*" -type f -delete || true - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2 + uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3 with: skip-existing: true packages-dir: dist/ diff --git a/.gitignore b/.gitignore index c9557a8..57dd8a4 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ .installed.cfg .mr.developer.cfg .tox/ +.venv .vscode/ __pycache__/ bin/ @@ -30,4 +31,5 @@ parts/ pyvenv.cfg share/ testing.log +uv.lock var/ diff --git a/.manylinux-install.sh b/.manylinux-install.sh index 507f24f..f572f8e 100755 --- a/.manylinux-install.sh +++ b/.manylinux-install.sh @@ -28,7 +28,6 @@ yum -y install libffi-devel tox_env_map() { case $1 in - *"cp310"*) echo 'py310';; *"cp311"*) echo 'py311';; *"cp312"*) echo 'py312';; *"cp313"*) echo 'py313';; @@ -36,6 +35,7 @@ tox_env_map() { *"cp314"*) echo 'py314';; *"cp315t"*) echo 'py315t';; *"cp315"*) echo 'py315';; + *"pp311"*) echo 'pypy3';; *) echo 'py';; esac } @@ -43,21 +43,16 @@ tox_env_map() { # Compile wheels for PYBIN in /opt/python/*/bin; do if \ - [[ "${PYBIN}" == *"cp310/"* ]] || \ + [[ "${PYBIN}" == *"pp311-"* ]] || \ [[ "${PYBIN}" == *"cp311/"* ]] || \ [[ "${PYBIN}" == *"cp312/"* ]] || \ [[ "${PYBIN}" == *"cp313/"* ]] || \ - [[ "${PYBIN}" == *"cp314/"* ]] || \ [[ "${PYBIN}" == *"cp314t/"* ]] || \ - [[ "${PYBIN}" == *"cp315/"* ]] || \ - [[ "${PYBIN}" == *"cp315t/"* ]] ; then - if [[ "${PYBIN}" == *"cp315/"* ]] || [[ "${PYBIN}" == *"cp315t/"* ]] ; then - "${PYBIN}/pip" install --pre -e /io/ - "${PYBIN}/pip" wheel /io/ --pre -w wheelhouse/ - else - "${PYBIN}/pip" install -e /io/ - "${PYBIN}/pip" wheel /io/ -w wheelhouse/ - fi + [[ "${PYBIN}" == *"cp314/"* ]] || \ + [[ "${PYBIN}" == *"cp315t/"* ]] || \ + [[ "${PYBIN}" == *"cp315/"* ]] ; then + "${PYBIN}/pip" install -e /io/ + "${PYBIN}/pip" wheel /io/ -w wheelhouse/ if [ `uname -m` == 'aarch64' ]; then cd /io/ ${PYBIN}/pip install tox diff --git a/.meta.toml b/.meta.toml index 1e7a40d..78b1861 100644 --- a/.meta.toml +++ b/.meta.toml @@ -2,7 +2,7 @@ # https://github.com/zopefoundation/meta/tree/master/src/zope/meta/c-code [meta] template = "c-code" -commit-id = "9333ca19" +commit-id = "2960b769" [python] with-windows = true diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 59609e1..ffee6a1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,6 +2,15 @@ # https://github.com/zopefoundation/meta/tree/master/src/zope/meta/c-code minimum_pre_commit_version: '3.6' repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v6.0.0 + hooks: + - id: check-case-conflict + - id: check-merge-conflict + - id: check-toml + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace - repo: https://github.com/pycqa/isort rev: "8.0.1" hooks: @@ -15,7 +24,7 @@ repos: rev: v3.21.2 hooks: - id: pyupgrade - args: [--py310-plus] + args: [--py311-plus] - repo: https://github.com/isidentical/teyit rev: 0.4.3 hooks: @@ -27,3 +36,7 @@ repos: - id: flake8 additional_dependencies: - flake8-debugger == 4.1.2 + - repo: https://github.com/sphinx-contrib/sphinx-lint + rev: v1.0.2 + hooks: + - id: sphinx-lint diff --git a/tox.ini b/tox.ini index 1f58f38..8d1ec17 100644 --- a/tox.ini +++ b/tox.ini @@ -5,22 +5,18 @@ minversion = 4.0 envlist = release-check lint - py310,py310-pure py311,py311-pure py312,py312-pure py313,py313-pure - py314,py314-pure - py315,py315-pure py314t,py314t-pure + py314,py314-pure py315t,py315t-pure + py315,py315-pure pypy3 docs coverage [testenv] -pip_pre = - py315: true - py315t: true deps = setuptools >= 78.1.1,< 82 setenv = From 95c39b7775f03da01566019be7121ccde313a8f0 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Mon, 26 Oct 2026 09:23:08 +0100 Subject: [PATCH 2/3] Add change log entry. --- CHANGES.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.rst b/CHANGES.rst index 15cd896..29761f6 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,7 @@ Change log 6.9 (unreleased) ---------------- +- Build and publish PyPy wheels for macOS, Windows and manylinux. 6.8 (2026-08-20) ---------------- From a71d1ac68f26797737e3270e1ccdf48b02568136 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Mon, 26 Oct 2026 08:24:06 +0000 Subject: [PATCH 3/3] Apply pre-commit code formatting --- COPYRIGHT.txt | 2 +- buildout.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt index 79859e0..b8581dd 100644 --- a/COPYRIGHT.txt +++ b/COPYRIGHT.txt @@ -1 +1 @@ -Zope Foundation and Contributors \ No newline at end of file +Zope Foundation and Contributors diff --git a/buildout.cfg b/buildout.cfg index e846c31..62bfc21 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -1,5 +1,5 @@ [buildout] -develop = . +develop = . parts = test scripts