Skip to content

Commit

Permalink
- update to latest meta/config and declare final Python 3.13 support.
Browse files Browse the repository at this point in the history
  • Loading branch information
dataflake committed Sep 16, 2024
1 parent b893089 commit e93ff5f
Show file tree
Hide file tree
Showing 20 changed files with 192 additions and 230 deletions.
30 changes: 0 additions & 30 deletions .coveragerc

This file was deleted.

44 changes: 5 additions & 39 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,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<69" wheel twine
- name: Install Build Dependencies
if: matrix.python-version != '3.13'
run: |
pip install -U pip
pip install -U "setuptools<69" wheel twine
pip install -U "setuptools <74" wheel twine
pip install cffi
pip install -U zope.proxy
Expand Down Expand Up @@ -202,15 +195,7 @@ jobs:
python setup.py build_ext -i
python setup.py bdist_wheel
- name: Install zope.security 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 zope.security and dependencies
if: matrix.python-version != '3.13'
run: |
# Install to collect dependencies into the (pip) cache.
pip install .[test]
Expand Down Expand Up @@ -253,7 +238,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 @@ -327,32 +311,16 @@ jobs:
with:
name: zope.security-${{ runner.os }}-${{ matrix.python-version }}.whl
path: dist/
- name: Install zope.security ${{ matrix.python-version }}
if: matrix.python-version == '3.13'
run: |
pip install -U --pre cffi
pip install -U wheel "setuptools<69"
# 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/zope.security-*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 zope.security
if: matrix.python-version != '3.13'
run: |
pip install -U wheel "setuptools<69"
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
# might also save some build time?
unzip -n dist/zope.security-*whl -d src
pip install -U -e .[test]
pip install -e .[test]
- name: Run tests with C extensions
if: ${{ !startsWith(matrix.python-version, 'pypy') }}
run: |
Expand Down Expand Up @@ -443,7 +411,7 @@ jobs:
- name: Install zope.security
run: |
pip install -U wheel
pip install -U coverage
pip install -U coverage[toml]
pip install -U "`ls dist/zope.security-*.whl`[docs]"
- name: Build docs
env:
Expand Down Expand Up @@ -539,8 +507,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
13 changes: 4 additions & 9 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}" == *"cp313/"* ]] || \
[[ "${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}/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 = "023baad4"
commit-id = "4f5c47bd"

[python]
with-windows = true
with-pypy = true
with-future-python = true
with-future-python = false
with-docs = true
with-sphinx-doctests = true
with-macos = false
Expand Down
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ repos:
hooks:
- id: pyupgrade
args: [--py38-plus]
- repo: https://github.com/isidentical/teyit
rev: 0.4.3
hooks:
- id: teyit
- repo: https://github.com/PyCQA/flake8
rev: "7.1.1"
hooks:
Expand Down
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
7.2 (unreleased)
----------------

- Nothing changed yet.
- Declare final support for Python 3.13.


7.1 (2024-08-16)
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 docs *.py
recursive-include docs *.rst
Expand Down
26 changes: 26 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/c-code

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

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

[tool.coverage.report]
fail_under = 99.5
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/"]
32 changes: 16 additions & 16 deletions src/zope/security/tests/test_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class _NotAdapter:
adapter = _NotAdapter()
parent = object()
returned = self._callFUT(adapter, parent)
self.assertTrue(isinstance(returned, LocationProxy))
self.assertIsInstance(returned, LocationProxy)
self.assertIs(getProxiedObject(returned), adapter)
self.assertIs(returned.__parent__, parent)

Expand Down Expand Up @@ -158,7 +158,7 @@ class _NotAdapter:
proxy = ProxyFactory(adapter)
before = factory.__dict__.copy()
returned = ltaf(proxy)
self.assertFalse(returned is factory)
self.assertIsNot(returned, factory)
ploc = removeSecurityProxy(returned)
self.assertIs(ploc.__parent__, adapter)
unwrapped = getProxiedObject(ploc)
Expand All @@ -181,7 +181,7 @@ class _NotAdapter:
proxy = ProxyFactory(adapter)
before = factory.__dict__.copy()
returned = ltaf(proxy, extra)
self.assertFalse(returned is factory)
self.assertIsNot(returned, factory)
ploc = removeSecurityProxy(returned)
self.assertIs(ploc.__parent__, adapter)
unwrapped = getProxiedObject(ploc)
Expand All @@ -207,7 +207,7 @@ class _Extra:
proxy = ProxyFactory(extra)
before = factory.__dict__.copy()
returned = ltaf(adapter, proxy)
self.assertFalse(returned is factory)
self.assertIsNot(returned, factory)
ploc = removeSecurityProxy(returned)
self.assertIs(ploc.__parent__, adapter)
unwrapped = getProxiedObject(ploc)
Expand All @@ -233,7 +233,7 @@ class _Adapter:
before = {k: v for k, v in factory.__dict__.items()
if k not in ('_called_with', '__parent__')}
returned = ltaf(proxy)
self.assertFalse(returned is factory)
self.assertIsNot(returned, factory)
ploc = removeSecurityProxy(returned)
self.assertIs(ploc.__parent__, adapter)
unwrapped = getObject(ploc)
Expand Down Expand Up @@ -261,7 +261,7 @@ class _Adapter:
before = {k: v for k, v in factory.__dict__.items()
if k not in ('_called_with', '__parent__')}
returned = ltaf(proxy)
self.assertFalse(returned is factory)
self.assertIsNot(returned, factory)
ploc = removeSecurityProxy(returned)
self.assertIs(ploc.__parent__, parent)
unwrapped = getObject(ploc)
Expand Down Expand Up @@ -303,9 +303,9 @@ class _NotAdapter:
proxy = ProxyFactory(adapter)
before = factory.__dict__.copy()
returned = ltaf(proxy)
self.assertFalse(returned is factory)
self.assertIsNot(returned, factory)
unwrapped = removeSecurityProxy(returned)
self.assertTrue('__parent__' not in unwrapped.__dict__)
self.assertNotIn('__parent__', unwrapped.__dict__)
self.assertIs(unwrapped, factory)
after = {k: v for k, v in unwrapped.__dict__.items()
if k not in ('_called_with',)}
Expand All @@ -325,9 +325,9 @@ class _NotAdapter:
proxy = ProxyFactory(adapter)
before = factory.__dict__.copy()
returned = ltaf(proxy, extra)
self.assertFalse(returned is factory)
self.assertIsNot(returned, factory)
unwrapped = removeSecurityProxy(returned)
self.assertTrue('__parent__' not in unwrapped.__dict__)
self.assertNotIn('__parent__', unwrapped.__dict__)
self.assertIs(unwrapped, factory)
after = {k: v for k, v in unwrapped.__dict__.items()
if k not in ('_called_with',)}
Expand All @@ -350,9 +350,9 @@ class _Extra:
proxy = ProxyFactory(extra)
before = factory.__dict__.copy()
returned = ltaf(adapter, proxy)
self.assertFalse(returned is factory)
self.assertIsNot(returned, factory)
unwrapped = removeSecurityProxy(returned)
self.assertTrue('__parent__' not in unwrapped.__dict__)
self.assertNotIn('__parent__', unwrapped.__dict__)
self.assertIs(unwrapped, factory)
after = {k: v for k, v in unwrapped.__dict__.items()
if k not in ('_called_with',)}
Expand All @@ -374,7 +374,7 @@ class _Adapter:
before = {k: v for k, v in factory.__dict__.items()
if k not in ('_called_with', '__parent__')}
returned = ltaf(proxy)
self.assertFalse(returned is factory)
self.assertIsNot(returned, factory)
unwrapped = removeSecurityProxy(returned)
self.assertIs(unwrapped.__parent__, adapter)
self.assertIs(unwrapped, factory)
Expand All @@ -399,7 +399,7 @@ class _Adapter:
before = {k: v for k, v in factory.__dict__.items()
if k not in ('_called_with', '__parent__')}
returned = ltaf(proxy)
self.assertFalse(returned is factory)
self.assertIsNot(returned, factory)
unwrapped = removeSecurityProxy(returned)
self.assertIs(unwrapped.__parent__, parent)
self.assertIs(unwrapped, factory)
Expand Down Expand Up @@ -445,7 +445,7 @@ class _NotAdapter:
adapter = _NotAdapter()
before = factory.__dict__.copy()
returned = ltaf(adapter)
self.assertFalse(returned is factory)
self.assertIsNot(returned, factory)
unwrapped = getProxiedObject(returned)
self.assertIs(unwrapped, factory)
after = {k: v for k, v in returned.__dict__.items()
Expand All @@ -463,7 +463,7 @@ class _NotAdapter:
extra = object()
before = factory.__dict__.copy()
returned = ltaf(adapter, extra)
self.assertFalse(returned is factory)
self.assertIsNot(returned, factory)
unwrapped = getProxiedObject(returned)
self.assertIs(unwrapped, factory)
after = {k: v for k, v in returned.__dict__.items()
Expand Down
Loading

0 comments on commit e93ff5f

Please sign in to comment.