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

Update Python version support. #60

Merged
merged 3 commits into from
Feb 17, 2025
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
7 changes: 5 additions & 2 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,22 @@ env:

jobs:
pre-commit:
permissions:
contents: read
pull-requests: write
name: linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- uses: pre-commit/[email protected]
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd #v3.0.1
with:
extra_args: --all-files --show-diff-on-failure
env:
PRE_COMMIT_COLOR: always
- uses: pre-commit-ci/lite-action@v1.0.2
- uses: pre-commit-ci/lite-action@5d6cc0eb514c891a40562a58a8e71576c5c7fb43 #v1.1.0
if: always()
with:
msg: Apply pre-commit code formatting
52 changes: 47 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# native support. It works, but is slow.
#
# Another major downside: You can't just re-run the job for one part
# of the matrix. So if there's a transient test failure that hit, say, 3.8,
# of the matrix. So if there's a transient test failure that hit, say, 3.11,
# to get a clean run every version of Python runs again. That's bad.
# https://github.community/t/ability-to-rerun-just-a-single-job-in-a-workflow/17234/65

Expand Down Expand Up @@ -97,12 +97,12 @@ jobs:
matrix:
python-version:
- "pypy-3.10"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
os: [ubuntu-latest, macos-latest, windows-latest]
exclude:
- os: macos-latest
Expand All @@ -111,6 +111,8 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand Down Expand Up @@ -152,10 +154,17 @@ 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 --pre cffi
pip install -U "setuptools <= 75.6.0" 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 <= 75.6.0" wheel twine
pip install cffi

- name: Build zope.index (macOS x86_64)
Expand Down Expand Up @@ -194,7 +203,15 @@ jobs:
python setup.py build_ext -i
python setup.py bdist_wheel

- name: Install zope.index 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 zope.index and dependencies
if: matrix.python-version != '3.14'
run: |
# Install to collect dependencies into the (pip) cache.
pip install .[test]
Expand Down Expand Up @@ -237,6 +254,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: |
Expand All @@ -250,12 +268,12 @@ jobs:
matrix:
python-version:
- "pypy-3.10"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
os: [ubuntu-latest, macos-latest, windows-latest]
exclude:
- os: macos-latest
Expand All @@ -264,6 +282,8 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand Down Expand Up @@ -310,9 +330,25 @@ jobs:
with:
name: zope.index-${{ runner.os }}-${{ matrix.python-version }}.whl
path: dist/
- name: Install zope.index ${{ matrix.python-version }}
if: matrix.python-version == '3.14'
run: |
pip install -U --pre cffi
pip install -U wheel "setuptools <= 75.6.0"
# 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/zope.index-*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 zope.index
if: matrix.python-version != '3.14'
run: |
pip install -U wheel "setuptools <74"
pip install -U wheel "setuptools <= 75.6.0"
pip install -U coverage[toml]
pip install -U 'cffi; platform_python_implementation == "CPython"'
# Unzip into src/ so that testrunner can find the .so files
Expand Down Expand Up @@ -361,6 +397,8 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand Down Expand Up @@ -431,6 +469,8 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand Down Expand Up @@ -506,6 +546,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: >
Expand Down
15 changes: 10 additions & 5 deletions .manylinux-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,32 @@ yum -y install libffi-devel

tox_env_map() {
case $1 in
*"cp38"*) echo 'py38';;
*"cp39"*) echo 'py39';;
*"cp310"*) echo 'py310';;
*"cp311"*) echo 'py311';;
*"cp312"*) echo 'py312';;
*"cp313"*) echo 'py313';;
*"cp314"*) echo 'py314';;
*) echo 'py';;
esac
}

# Compile wheels
for PYBIN in /opt/python/*/bin; do
if \
[[ "${PYBIN}" == *"cp38/"* ]] || \
[[ "${PYBIN}" == *"cp39/"* ]] || \
[[ "${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
Expand Down
4 changes: 2 additions & 2 deletions .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# https://github.com/zopefoundation/meta/tree/master/config/c-code
[meta]
template = "c-code"
commit-id = "85622de1"
commit-id = "e78b9550"

[python]
with-windows = true
with-pypy = true
with-docs = true
with-sphinx-doctests = true
with-future-python = false
with-future-python = true
with-macos = false

[tox]
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
minimum_pre_commit_version: '3.6'
repos:
- repo: https://github.com/pycqa/isort
rev: "5.13.2"
rev: "6.0.0"
hooks:
- id: isort
- repo: https://github.com/hhatto/autopep8
rev: "v2.3.1"
rev: "v2.3.2"
hooks:
- id: autopep8
args: [--in-place, --aggressive, --aggressive]
- repo: https://github.com/asottile/pyupgrade
rev: v3.17.0
rev: v3.19.1
hooks:
- id: pyupgrade
args: [--py38-plus]
args: [--py39-plus]
- repo: https://github.com/isidentical/teyit
rev: 0.4.3
hooks:
Expand Down
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
7.1 (unreleased)
================

- Drop support for Python 3.8.

- Add preliminary support for Python 3.14.

7.0 (2024-09-18)
================
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
Generated from:
https://github.com/zopefoundation/meta/tree/master/config/c-code
-->
-->
# Contributing to zopefoundation projects

The projects under the zopefoundation GitHub organization are open source and
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# https://github.com/zopefoundation/meta/tree/master/config/c-code

[build-system]
requires = ["setuptools<74"]
requires = ["setuptools <= 75.6.0"]
build-backend = "setuptools.build_meta"

[tool.coverage.run]
Expand Down
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ def _unavailable(self, e):
setup(name='zope.index',
version=version,
url='https://github.com/zopefoundation/zope.index',
license='ZPL 2.1',
license='ZPL-2.1',
author='Zope Foundation and Contributors',
author_email='zope-dev@zope.org',
author_email='zope-dev@zope.dev',
description="Indices for using with catalog like text, field, etc.",
long_description=long_description,
classifiers=[
Expand All @@ -90,7 +90,6 @@ def _unavailable(self, e):
'License :: OSI Approved :: Zope Public License',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
Expand All @@ -106,7 +105,7 @@ def _unavailable(self, e):
packages=find_packages('src'),
package_dir={'': 'src'},
namespace_packages=['zope'],
python_requires='>=3.8',
python_requires='>=3.9',
extras_require={
'test': [
'zope.testrunner',
Expand Down
2 changes: 1 addition & 1 deletion src/zope/index/text/okapiindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
PURE_PYTHON = int(os.environ.get('PURE_PYTHON', '0')) or _is_pypy
try:
from zope.index.text.okascore import score
except ImportError: # pragma: no cover
except ModuleNotFoundError: # pragma: no cover
score = None

score = None if PURE_PYTHON else score
Expand Down
8 changes: 5 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@
minversion = 4.0
envlist =
lint
py38,py38-pure
py39,py39-pure
py310,py310-pure
py311,py311-pure
py312,py312-pure
py313,py313-pure
py314,py314-pure
pypy3
docs
coverage

[testenv]
pip_pre = py314: true
deps =
setuptools <74
setuptools <= 75.6.0
Sphinx
setenv =
pure: PURE_PYTHON=1
!pure-!pypy3: PURE_PYTHON=0
Expand Down Expand Up @@ -51,7 +53,7 @@ description = ensure that the distribution is ready to release
basepython = python3
skip_install = true
deps =
setuptools <74
setuptools <= 75.6.0
twine
build
check-manifest
Expand Down
Loading