From 7137c7bf2d4b6753c14f3bf01b4856647352f68b Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Tue, 26 Nov 2024 09:27:41 +0100 Subject: [PATCH] Add preliminary support for Python 3.14a2. --- .github/workflows/tests.yml | 38 +++++++++++++++++++++++++++++++++++-- .manylinux-install.sh | 13 ++++++++++--- .meta.toml | 4 ++-- CHANGES.rst | 1 + pyproject.toml | 2 +- tox.ini | 6 ++++-- 6 files changed, 54 insertions(+), 10 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f05afef..5405251 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -103,6 +103,7 @@ jobs: - "3.11" - "3.12" - "3.13" + - "3.14" os: [ubuntu-latest, macos-latest, windows-latest] exclude: - os: macos-latest @@ -152,10 +153,16 @@ jobs: restore-keys: | ${{ runner.os }}-pip- + - name: Install Build Dependencies (3.14) + if: matrix.python-version == '3.14' + run: | + pip install -U pip + pip install -U "setuptools < 74" wheel twine - name: Install Build Dependencies + if: matrix.python-version != '3.14' run: | pip install -U pip - pip install -U "setuptools <74" wheel twine + pip install -U "setuptools < 74" wheel twine - name: Build ExtensionClass (macOS x86_64) if: > @@ -193,7 +200,15 @@ jobs: python setup.py build_ext -i python setup.py bdist_wheel + - name: Install ExtensionClass and dependencies (3.14) + if: matrix.python-version == '3.14' + 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 ExtensionClass and dependencies + if: matrix.python-version != '3.14' run: | # Install to collect dependencies into the (pip) cache. pip install .[test] @@ -236,6 +251,7 @@ jobs: && startsWith(github.ref, 'refs/tags') && !startsWith(runner.os, 'Linux') && !startsWith(matrix.python-version, 'pypy') + && !startsWith(matrix.python-version, '3.14') env: TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} run: | @@ -255,6 +271,7 @@ jobs: - "3.11" - "3.12" - "3.13" + - "3.14" os: [ubuntu-latest, macos-latest, windows-latest] exclude: - os: macos-latest @@ -309,9 +326,24 @@ jobs: with: name: ExtensionClass-${{ runner.os }}-${{ matrix.python-version }}.whl path: dist/ + - name: Install ExtensionClass ${{ matrix.python-version }} + if: matrix.python-version == '3.14' + run: | + pip install -U wheel "setuptools < 74" + # 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? + unzip -n dist/ExtensionClass-*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 ExtensionClass + if: matrix.python-version != '3.14' run: | - pip install -U wheel "setuptools <74" + pip install -U wheel "setuptools < 74" pip install -U coverage[toml] pip install -U 'cffi; platform_python_implementation == "CPython"' # Unzip into src/ so that testrunner can find the .so files @@ -436,6 +468,8 @@ jobs: name: manylinux_${{ matrix.image }}_wheels.zip - name: Restore pip cache permissions run: sudo chown -R $(whoami) ${{ steps.pip-cache-default.outputs.dir }} + - name: Prevent publishing wheels for unreleased Python versions + run: VER=$(echo '3.14' | tr -d .) && ls -al wheelhouse && sudo rm -f wheelhouse/*-cp${VER}*.whl && ls -al wheelhouse - name: Publish package to PyPI uses: pypa/gh-action-pypi-publish@release/v1 if: > diff --git a/.manylinux-install.sh b/.manylinux-install.sh index 7503abf..59f12ab 100755 --- a/.manylinux-install.sh +++ b/.manylinux-install.sh @@ -34,6 +34,7 @@ tox_env_map() { *"cp311"*) echo 'py311';; *"cp312"*) echo 'py312';; *"cp313"*) echo 'py313';; + *"cp314"*) echo 'py314';; *) echo 'py';; esac } @@ -46,9 +47,15 @@ for PYBIN in /opt/python/*/bin; do [[ "${PYBIN}" == *"cp310/"* ]] || \ [[ "${PYBIN}" == *"cp311/"* ]] || \ [[ "${PYBIN}" == *"cp312/"* ]] || \ - [[ "${PYBIN}" == *"cp313/"* ]] ; then - "${PYBIN}/pip" install -e /io/ - "${PYBIN}/pip" wheel /io/ -w wheelhouse/ + [[ "${PYBIN}" == *"cp313/"* ]] || \ + [[ "${PYBIN}" == *"cp314/"* ]] ; then + if [[ "${PYBIN}" == *"cp314/"* ]] ; 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 if [ `uname -m` == 'aarch64' ]; then cd /io/ ${PYBIN}/pip install tox diff --git a/.meta.toml b/.meta.toml index 5919303..43efa77 100644 --- a/.meta.toml +++ b/.meta.toml @@ -2,13 +2,13 @@ # https://github.com/zopefoundation/meta/tree/master/config/c-code [meta] template = "c-code" -commit-id = "d8a8b5ed" +commit-id = "baf6089f" [python] with-windows = true with-pypy = true with-sphinx-doctests = false -with-future-python = false +with-future-python = true with-macos = false with-docs = false diff --git a/CHANGES.rst b/CHANGES.rst index 1a774fe..c1d195e 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,7 @@ 6.1 (unreleased) ================ +- Add preliminary support for Python 3.14a2. 6.0 (2024-09-17) ================ diff --git a/pyproject.toml b/pyproject.toml index 93d2d81..94da342 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ # https://github.com/zopefoundation/meta/tree/master/config/c-code [build-system] -requires = ["setuptools<74"] +requires = ["setuptools < 74"] build-backend = "setuptools.build_meta" [tool.coverage.run] diff --git a/tox.ini b/tox.ini index 4c2b3ee..2ee827d 100644 --- a/tox.ini +++ b/tox.ini @@ -10,12 +10,14 @@ envlist = py311,py311-pure py312,py312-pure py313,py313-pure + py314,py314-pure pypy3 coverage [testenv] +pip_pre = py314: true deps = - setuptools <74 + setuptools < 74 setenv = pure: PURE_PYTHON=1 !pure-!pypy3: PURE_PYTHON=0 @@ -48,7 +50,7 @@ description = ensure that the distribution is ready to release basepython = python3 skip_install = true deps = - setuptools <74 + setuptools < 74 twine build check-manifest