Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add preliminary Python 3.13 support #192

Merged
merged 10 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
52 changes: 44 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,10 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
os: [ubuntu-20.04, macos-11, windows-latest]
- "3.13.0-alpha - 3.13.0"
os: [ubuntu-latest, macos-latest, windows-latest]
exclude:
- os: macos-11
- os: macos-latest
python-version: "pypy-3.10"

steps:
Expand Down Expand Up @@ -151,7 +152,15 @@ jobs:
restore-keys: |
${{ runner.os }}-pip-

- name: Install Build Dependencies (3.13.0-alpha - 3.13.0)
if: matrix.python-version == '3.13.0-alpha - 3.13.0'
run: |
pip install -U pip
pip install -U setuptools wheel twine
# Remove this hack once 'cffi' has a release supporting Python 3.13.
pip install -e "git+https://github.com/python-cffi/cffi.git#egg=cffi"
- name: Install Build Dependencies
if: matrix.python-version != '3.13.0-alpha - 3.13.0'
run: |
pip install -U pip
pip install -U setuptools wheel twine cffi
Expand Down Expand Up @@ -195,7 +204,15 @@ jobs:
python setup.py build_ext -i
python setup.py bdist_wheel

- name: Install persistent and dependencies (3.13.0-alpha - 3.13.0)
if: matrix.python-version == '3.13.0-alpha - 3.13.0'
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: matrix.python-version != '3.13.0-alpha - 3.13.0'
run: |
# Install to collect dependencies into the (pip) cache.
pip install .[test]
Expand Down Expand Up @@ -239,6 +256,7 @@ jobs:
&& startsWith(github.ref, 'refs/tags')
&& startsWith(runner.os, 'Mac')
&& !startsWith(matrix.python-version, 'pypy')
&& !startsWith(matrix.python-version, '3.13.0-alpha - 3.13.0')
env:
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
run: |
Expand All @@ -258,9 +276,10 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
os: [ubuntu-20.04, macos-11, windows-latest]
- "3.13.0-alpha - 3.13.0"
os: [ubuntu-latest, macos-latest, windows-latest]
exclude:
- os: macos-11
- os: macos-latest
python-version: "pypy-3.10"

steps:
Expand Down Expand Up @@ -311,7 +330,24 @@ jobs:
with:
name: persistent-${{ runner.os }}-${{ matrix.python-version }}.whl
path: dist/
- name: Install persistent 3.13.0-alpha - 3.13.0 ${{ matrix.python-version }}
if: matrix.python-version == '3.13.0-alpha - 3.13.0'
run: |
pip install -U wheel setuptools
# Remove this hack once 'cffi' has a release supporting Python 3.13.
pip install -e "git+https://github.com/python-cffi/cffi.git#egg=cffi"
# 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
# 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/persistent-*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 -U -e .[test]
- name: Install persistent
if: ${{ !startsWith(matrix.python-version, '3.13.0-alpha - 3.13.0') }}
run: |
pip install -U wheel setuptools
pip install -U coverage
Expand Down Expand Up @@ -344,7 +380,7 @@ jobs:

coveralls_finish:
needs: test
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: AndreMiras/coveralls-python-action@develop
Expand All @@ -357,7 +393,7 @@ jobs:
strategy:
matrix:
python-version: ["3.9"]
os: [ubuntu-20.04]
os: [ubuntu-latest]

steps:
- name: checkout
Expand Down Expand Up @@ -425,7 +461,7 @@ jobs:
strategy:
matrix:
python-version: ["3.9"]
os: [ubuntu-20.04]
os: [ubuntu-latest]

steps:
- name: checkout
Expand Down Expand Up @@ -489,7 +525,7 @@ jobs:
# python -m pylint --limit-inference-results=1 --rcfile=.pylintrc persistent -f parseable -r n

manylinux:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
# We use a regular Python matrix entry to share as much code as possible.
strategy:
Expand Down
11 changes: 9 additions & 2 deletions .manylinux-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ yum -y install libffi-devel

tox_env_map() {
case $1 in
*"cp313"*) echo 'py313';;
*"cp37"*) echo 'py37';;
*"cp38"*) echo 'py38';;
*"cp39"*) echo 'py39';;
Expand All @@ -41,14 +42,20 @@ tox_env_map() {
# Compile wheels
for PYBIN in /opt/python/*/bin; do
if \
[[ "${PYBIN}" == *"cp313"* ]] || \
[[ "${PYBIN}" == *"cp311"* ]] || \
[[ "${PYBIN}" == *"cp312"* ]] || \
[[ "${PYBIN}" == *"cp37"* ]] || \
[[ "${PYBIN}" == *"cp38"* ]] || \
[[ "${PYBIN}" == *"cp39"* ]] || \
[[ "${PYBIN}" == *"cp310"* ]] ; then
"${PYBIN}/pip" install -e /io/
"${PYBIN}/pip" wheel /io/ -w wheelhouse/
if [[ "${PYBIN}" == *"cp313"* ]] ; 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
Expand Down
4 changes: 2 additions & 2 deletions .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# https://github.com/zopefoundation/meta/tree/master/config/c-code
[meta]
template = "c-code"
commit-id = "905c2a64"
commit-id = "e6285cce"

[python]
with-appveyor = true
with-windows = true
with-pypy = true
with-future-python = false
with-future-python = true
with-docs = true
with-sphinx-doctests = true
with-macos = false
Expand Down
2 changes: 0 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
5.3 (unreleased)
================

- Remove premature support for Python 3.13.

- Build Windows wheels on GHA.


Expand Down
8 changes: 8 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ def _read_file(filename):

README = (_read_file('README.rst') + '\n\n' + _read_file('CHANGES.rst'))

PY313_CFFI_GH_DEP = (
"cffi @ git+https://github.com/python-cffi/cffi.git ; "
"platform_python_implementation == 'CPython' and "
"python_version >= '3.13a0'"
)


define_macros = (
# We currently use macros like PyBytes_AS_STRING
Expand Down Expand Up @@ -141,8 +147,10 @@ def _read_file(filename):
install_requires=[
'zope.interface',
"cffi ; platform_python_implementation == 'CPython'",
PY313_CFFI_GH_DEP,
],
setup_requires=[
"cffi ; platform_python_implementation == 'CPython'",
PY313_CFFI_GH_DEP,
],
entry_points={})
3 changes: 3 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ envlist =
py310,py310-pure
py311,py311-pure
py312,py312-pure
py313,py313-pure
pypy3
docs
coverage

[testenv]
usedevelop = true
pip_pre = py313: true
deps =
py37: urllib3 < 2
Sphinx
setenv =
pure: PURE_PYTHON=1
!pure-!pypy3: PURE_PYTHON=0
Expand Down
Loading