From 745233d938fd39dd15234d61228391cb7c3fbb65 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Sat, 15 Feb 2025 17:49:01 +0100 Subject: [PATCH 1/6] Drop support for Python 3.8. --- CHANGES.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index e9eab30..0169a69 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,8 @@ 6.2 (unreleased) ================ +- Drop support for Python 3.8. + - Adjust minimal required version of ``zope.security`` test dependency to ``7.3``. From 2b43d2060fdef414bc4ef3942909a7e140d6cec7 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Sat, 15 Feb 2025 17:49:02 +0100 Subject: [PATCH 2/6] Add preliminary support for Python 3.14. --- CHANGES.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 0169a69..b64089e 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,8 @@ 6.2 (unreleased) ================ +- Add preliminary support for Python 3.14. + - Drop support for Python 3.8. - Adjust minimal required version of ``zope.security`` test dependency to ``7.3``. From 135697634bcd2a7257402855ecfc255f27360211 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Sat, 15 Feb 2025 17:51:12 +0100 Subject: [PATCH 3/6] Configuring for c-code --- .github/workflows/pre-commit.yml | 7 +++-- .github/workflows/tests.yml | 50 ++++++++++++++++++++++++++++---- .manylinux-install.sh | 15 ++++++---- .meta.toml | 7 ++--- .pre-commit-config.yaml | 14 ++++----- CONTRIBUTING.md | 2 +- pyproject.toml | 2 +- tox.ini | 11 ++++--- 8 files changed, 76 insertions(+), 32 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 325ae0e..9cf4fde 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -15,6 +15,9 @@ env: jobs: pre-commit: + permissions: + contents: read + pull-requests: write name: linting runs-on: ubuntu-latest steps: @@ -22,12 +25,12 @@ jobs: - uses: actions/setup-python@v5 with: python-version: 3.x - - uses: pre-commit/action@v3.0.1 + - 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 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ed03834..ce51b5e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 @@ -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 @@ -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: @@ -152,10 +154,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 <= 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 - name: Build zope.proxy (macOS x86_64) if: > @@ -193,7 +201,15 @@ jobs: python setup.py build_ext -i python setup.py bdist_wheel + - name: Install zope.proxy 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.proxy and dependencies + if: matrix.python-version != '3.14' run: | # Install to collect dependencies into the (pip) cache. pip install .[test] @@ -236,6 +252,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: | @@ -249,12 +266,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 @@ -263,6 +280,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: @@ -309,9 +328,24 @@ jobs: with: name: zope.proxy-${{ runner.os }}-${{ matrix.python-version }}.whl path: dist/ + - name: Install zope.proxy ${{ matrix.python-version }} + if: matrix.python-version == '3.14' + run: | + 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.proxy-*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.proxy + 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 @@ -360,6 +394,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: @@ -430,6 +466,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: @@ -505,6 +543,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 1ff485c..d8e8a70 100755 --- a/.manylinux-install.sh +++ b/.manylinux-install.sh @@ -28,12 +28,12 @@ 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 } @@ -41,14 +41,19 @@ tox_env_map() { # 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 diff --git a/.meta.toml b/.meta.toml index 2afd061..2fbec44 100644 --- a/.meta.toml +++ b/.meta.toml @@ -2,21 +2,18 @@ # https://github.com/zopefoundation/meta/tree/master/config/c-code [meta] template = "c-code" -commit-id = "cc25c7e0" +commit-id = "e78b9550" [python] with-windows = true with-pypy = true -with-future-python = false +with-future-python = true with-docs = true with-sphinx-doctests = true with-macos = false [tox] use-flake8 = true -testenv-deps = [ - "py37: urllib3 < 2", - ] [coverage] fail-under = 99 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3ce9034..7d30407 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 -# hooks: -# - id: pyupgrade -# args: [--py38-plus] + - repo: https://github.com/asottile/pyupgrade + rev: v3.19.1 + hooks: + - id: pyupgrade + args: [--py39-plus] - repo: https://github.com/isidentical/teyit rev: 0.4.3 hooks: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e6d84b8..5242e6a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,7 +1,7 @@ +--> # Contributing to zopefoundation projects The projects under the zopefoundation GitHub organization are open source and diff --git a/pyproject.toml b/pyproject.toml index 32bd75c..b6061e2 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 <= 75.6.0"] build-backend = "setuptools.build_meta" [tool.coverage.run] diff --git a/tox.ini b/tox.ini index b69e5e7..98482b7 100644 --- a/tox.ini +++ b/tox.ini @@ -4,20 +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 - py37: urllib3 < 2 + setuptools <= 75.6.0 + Sphinx setenv = pure: PURE_PYTHON=1 !pure-!pypy3: PURE_PYTHON=0 @@ -32,7 +33,6 @@ extras = basepython = python3 deps = git+https://github.com/pypa/setuptools.git\#egg=setuptools - py37: urllib3 < 2 [testenv:coverage] basepython = python3 @@ -40,7 +40,6 @@ allowlist_externals = mkdir deps = coverage[toml] - py37: urllib3 < 2 setenv = PURE_PYTHON=1 commands = @@ -54,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 From f0add61c85390e449045ad163e2866f5fff04634 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Sat, 15 Feb 2025 17:54:55 +0100 Subject: [PATCH 4/6] Update Python version support. --- setup.py | 7 +++---- src/zope/proxy/__init__.py | 4 ++-- src/zope/proxy/_zope_proxy_proxy.c | 6 +++--- src/zope/proxy/tests/test_proxy.py | 4 ++-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/setup.py b/setup.py index e36f142..0f3c49c 100644 --- a/setup.py +++ b/setup.py @@ -84,7 +84,7 @@ def read(*rnames): setup(name='zope.proxy', version=version, author='Zope Foundation and Contributors', - author_email='zope-dev@zope.org', + author_email='zope-dev@zope.dev', description='Generic Transparent Proxies', long_description=( read('README.rst') @@ -98,14 +98,13 @@ def read(*rnames): 'zope.proxy/issues', 'Sources': 'https://github.com/zopefoundation/zope.proxy', }, - license='ZPL 2.1', + license='ZPL-2.1', classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', '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', @@ -126,7 +125,7 @@ def read(*rnames): }, headers=headers, ext_modules=ext_modules, - python_requires='>=3.8', + python_requires='>=3.9', install_requires=[ 'zope.interface', 'setuptools', diff --git a/src/zope/proxy/__init__.py b/src/zope/proxy/__init__.py index e195dc1..4f98716 100644 --- a/src/zope/proxy/__init__.py +++ b/src/zope/proxy/__init__.py @@ -107,7 +107,7 @@ class AbstractPyProxyBase: def __new__(cls, value=None): # Some subclasses (zope.security.proxy) fail to pass the object - inst = super(AbstractPyProxyBase, cls).__new__(cls) + inst = super().__new__(cls) inst._wrapped = value return inst @@ -197,7 +197,7 @@ def __getattr__(self, name): def __setattr__(self, name, value): if name == '_wrapped': - return super(AbstractPyProxyBase, self).__setattr__(name, value) + return super().__setattr__(name, value) # First, look for descriptors in this object's type type_self = type(self) diff --git a/src/zope/proxy/_zope_proxy_proxy.c b/src/zope/proxy/_zope_proxy_proxy.c index 2fa0628..786a946 100644 --- a/src/zope/proxy/_zope_proxy_proxy.c +++ b/src/zope/proxy/_zope_proxy_proxy.c @@ -621,9 +621,9 @@ wrap_as_sequence = { 0, /* sq_concat */ 0, /* sq_repeat */ 0, /* sq_item */ - 0, /* sq_slice, unused in PY3 */ + 0, /* sq_slice, unused */ 0, /* sq_ass_item */ - 0, /* sq_ass_slice, unused in PY3 */ + 0, /* sq_ass_slice, unused */ wrap_contains, /* sq_contains */ }; @@ -658,7 +658,7 @@ ProxyType = { sizeof(ProxyObject), 0, wrap_dealloc, /* tp_dealloc */ - 0, /* reserved 3.0--3.7; tp_vectorcall_offset 3.8+ */ + 0, /* tp_vectorcall_offset */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ diff --git a/src/zope/proxy/tests/test_proxy.py b/src/zope/proxy/tests/test_proxy.py index 68d2e50..66f5962 100644 --- a/src/zope/proxy/tests/test_proxy.py +++ b/src/zope/proxy/tests/test_proxy.py @@ -21,7 +21,7 @@ try: import zope.security -except ImportError: # pragma: no cover +except ModuleNotFoundError: # pragma: no cover _HAVE_ZOPE_SECURITY = False else: _HAVE_ZOPE_SECURITY = True @@ -335,7 +335,7 @@ def __len__(self): return 2 def __getitem__(self, a_slice): - # On Python 3, we basically just return what the test expects. + # We basically just return what the test expects. # Mostly that's the computed indices (yay!) but there are # a few special cases. indices = a_slice.indices(len(self)) From 61d66dc720aa523ff2834a936df78adfef4943d7 Mon Sep 17 00:00:00 2001 From: Jens Vagelpohl Date: Sun, 16 Feb 2025 11:38:31 +0100 Subject: [PATCH 5/6] - fix broken super calls and disable pyupgrade again --- .pre-commit-config.yaml | 10 +++++----- src/zope/proxy/__init__.py | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7d30407..f16fba8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,11 +11,11 @@ repos: hooks: - id: autopep8 args: [--in-place, --aggressive, --aggressive] - - repo: https://github.com/asottile/pyupgrade - rev: v3.19.1 - hooks: - - id: pyupgrade - args: [--py39-plus] +# - repo: https://github.com/asottile/pyupgrade +# rev: v3.19.1 +# hooks: +# - id: pyupgrade +# args: [--py39-plus] - repo: https://github.com/isidentical/teyit rev: 0.4.3 hooks: diff --git a/src/zope/proxy/__init__.py b/src/zope/proxy/__init__.py index 4f98716..e195dc1 100644 --- a/src/zope/proxy/__init__.py +++ b/src/zope/proxy/__init__.py @@ -107,7 +107,7 @@ class AbstractPyProxyBase: def __new__(cls, value=None): # Some subclasses (zope.security.proxy) fail to pass the object - inst = super().__new__(cls) + inst = super(AbstractPyProxyBase, cls).__new__(cls) inst._wrapped = value return inst @@ -197,7 +197,7 @@ def __getattr__(self, name): def __setattr__(self, name, value): if name == '_wrapped': - return super().__setattr__(name, value) + return super(AbstractPyProxyBase, self).__setattr__(name, value) # First, look for descriptors in this object's type type_self = type(self) From c84252b82baac81c359ef0191eed672c1ed36363 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Tue, 18 Feb 2025 08:43:33 +0100 Subject: [PATCH 6/6] Configuring for c-code --- .meta.toml | 5 ++++- .pre-commit-config.yaml | 11 ++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.meta.toml b/.meta.toml index 2fbec44..2524ee3 100644 --- a/.meta.toml +++ b/.meta.toml @@ -2,7 +2,7 @@ # https://github.com/zopefoundation/meta/tree/master/config/c-code [meta] template = "c-code" -commit-id = "e78b9550" +commit-id = "781caa51" [python] with-windows = true @@ -33,3 +33,6 @@ additional-ignores = [ "docs/_build/*", "docs/_build/*/*", ] + +[pre-commit] +pyupgrade-exclude = "^src/zope/proxy/__init__\\.py$" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f16fba8..dde1111 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,11 +11,12 @@ repos: hooks: - id: autopep8 args: [--in-place, --aggressive, --aggressive] -# - repo: https://github.com/asottile/pyupgrade -# rev: v3.19.1 -# hooks: -# - id: pyupgrade -# args: [--py39-plus] + - repo: https://github.com/asottile/pyupgrade + rev: v3.19.1 + hooks: + - id: pyupgrade + args: [--py39-plus] + exclude: ^src/zope/proxy/__init__\.py$ - repo: https://github.com/isidentical/teyit rev: 0.4.3 hooks: