Skip to content

Commit

Permalink
Update to latest meta/config, add final support for Python 3.13 (#156)
Browse files Browse the repository at this point in the history
* - update to latest meta/config

* - remove RestrictedPython pin

* - Add final support for Python 3.13
  • Loading branch information
dataflake authored Oct 10, 2024
1 parent 87079f7 commit 927e6f8
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 92 deletions.
30 changes: 0 additions & 30 deletions .coveragerc

This file was deleted.

40 changes: 3 additions & 37 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,10 @@ jobs:
restore-keys: |
${{ runner.os }}-pip-
- name: Install Build Dependencies (3.13)
if: matrix.python-version == '3.13'
run: |
pip install -U pip
pip install -U --pre cffi
pip install -U "setuptools<74" wheel twine
- name: Install Build Dependencies
if: matrix.python-version != '3.13'
run: |
pip install -U pip
pip install -U "setuptools<74" wheel twine
pip install -U "setuptools <74" wheel twine
pip install cffi
- name: Build AccessControl (macOS x86_64)
Expand Down Expand Up @@ -197,15 +190,7 @@ jobs:
python setup.py build_ext -i
python setup.py bdist_wheel
- name: Install AccessControl and dependencies (3.13)
if: matrix.python-version == '3.13'
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 AccessControl and dependencies
if: matrix.python-version != '3.13'
run: |
# Install to collect dependencies into the (pip) cache.
pip install .[test]
Expand Down Expand Up @@ -248,7 +233,6 @@ jobs:
&& startsWith(github.ref, 'refs/tags')
&& !startsWith(runner.os, 'Linux')
&& !startsWith(matrix.python-version, 'pypy')
&& !startsWith(matrix.python-version, '3.13')
env:
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
run: |
Expand Down Expand Up @@ -318,26 +302,10 @@ jobs:
with:
name: AccessControl-${{ runner.os }}-${{ matrix.python-version }}.whl
path: dist/
- name: Install AccessControl ${{ matrix.python-version }}
if: matrix.python-version == '3.13'
run: |
pip install -U --pre cffi
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
# 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/AccessControl-*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 AccessControl
if: matrix.python-version != '3.13'
run: |
pip install -U wheel "setuptools<74"
pip install -U coverage
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
# when we ask it to load tests from that directory. This
Expand Down Expand Up @@ -461,8 +429,6 @@ 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.13' | 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
19 changes: 7 additions & 12 deletions .manylinux-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,27 @@ yum -y install libffi-devel

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

# Compile wheels
for PYBIN in /opt/python/*/bin; do
if \
[[ "${PYBIN}" == *"cp313/"* ]] || \
[[ "${PYBIN}" == *"cp311/"* ]] || \
[[ "${PYBIN}" == *"cp312/"* ]] || \
[[ "${PYBIN}" == *"cp38/"* ]] || \
[[ "${PYBIN}" == *"cp39/"* ]] || \
[[ "${PYBIN}" == *"cp310/"* ]] ; then
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
[[ "${PYBIN}" == *"cp310/"* ]] || \
[[ "${PYBIN}" == *"cp311/"* ]] || \
[[ "${PYBIN}" == *"cp312/"* ]] || \
[[ "${PYBIN}" == *"cp313/"* ]] ; then
"${PYBIN}/pip" install -e /io/
"${PYBIN}/pip" wheel /io/ -w wheelhouse/
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,12 +2,12 @@
# https://github.com/zopefoundation/meta/tree/master/config/c-code
[meta]
template = "c-code"
commit-id = "a1e05e74"
commit-id = "85622de1"

[python]
with-windows = true
with-pypy = false
with-future-python = true
with-future-python = false
with-sphinx-doctests = false
with-macos = false
with-docs = false
Expand Down
9 changes: 8 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@ For changes before version 3.0, see ``HISTORY.rst``.
7.1 (unreleased)
----------------

- Add final support for Python 3.13.

- Respect ``PURE_PYTHON`` environment variable set to ``0`` when running tests.

- Let the roles access in ``rolesForPermissionOn`` interpret ``AttributeError`` and ``Unauthorized`` as "no roles definition for this permission at this object" and report any other exception (for the Python and C implementation). We have to treat ``Unauthorized`` like ``AttributeError`` to support ``Shared.DC.Scripts.Bindings.UnauthorizedBinding`` which raises ``Unauthorized`` for any access.
- Let the roles access in ``rolesForPermissionOn`` interpret ``AttributeError``
and ``Unauthorized`` as "no roles definition for this permission at this
object" and report any other exception (for the Python and C implementation).
We have to treat ``Unauthorized`` like ``AttributeError`` to support
``Shared.DC.Scripts.Bindings.UnauthorizedBinding`` which raises
``Unauthorized`` for any access.


7.0 (2024-05-30)
Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ include *.txt
include buildout.cfg
include tox.ini
include .pre-commit-config.yaml
include .coveragerc

recursive-include src *.py
include *.sh
Expand Down
25 changes: 25 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/c-code

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

[tool.coverage.run]
branch = true
source = ["AccessControl"]
relative_files = true

[tool.coverage.report]
fail_under = 80
precision = 2
ignore_errors = true
show_missing = true
exclude_lines = ["pragma: no cover", "pragma: nocover", "except ImportError:", "raise NotImplementedError", "if __name__ == '__main__':", "self.fail", "raise AssertionError", "raise unittest.Skip"]

[tool.coverage.html]
directory = "parts/htmlcov"

[tool.coverage.paths]
source = ["src/", ".tox/*/lib/python*/site-packages/", ".tox/pypy*/site-packages/"]
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
'DateTime', # optional dependency of RestrictedPython
'ExtensionClass >= 4.2.1',
'Persistence >= 3.0a3',
'RestrictedPython >= 5.1',
'RestrictedPython >= 7.4',
'transaction',
'zExceptions',
'zope.component',
Expand All @@ -87,7 +87,6 @@
'zope.schema',
'zope.security',
'zope.testing',
'funcsigs;python_version<"3.3"',
],
python_requires='>=3.8',
include_package_data=True,
Expand Down
17 changes: 10 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,41 @@ envlist =
coverage

[testenv]
pip_pre = py313: true
deps =
setuptools < 74
setuptools <74
setenv =
pure: PURE_PYTHON=1
!pure-!pypy3: PURE_PYTHON=0
py312: VIRTUALENV_PIP=23.1.2
py312: PIP_REQUIRE_VIRTUALENV=0
commands =
zope-testrunner --test-path=src {posargs:-vc}
extras =
test

[testenv:setuptools-latest]
basepython = python3
deps =
git+https://github.com/pypa/setuptools.git\#egg=setuptools

[testenv:coverage]
basepython = python3
allowlist_externals =
mkdir
deps =
coverage
coverage[toml]
setenv =
PURE_PYTHON=1
commands =
mkdir -p {toxinidir}/parts/htmlcov
coverage run -m zope.testrunner --test-path=src {posargs:-vc}
coverage html -i
coverage report -i -m --fail-under=80
coverage html
coverage report

[testenv:release-check]
description = ensure that the distribution is ready to release
basepython = python3
skip_install = true
deps =
setuptools <74
twine
build
check-manifest
Expand Down

0 comments on commit 927e6f8

Please sign in to comment.