From a63b5cedb1faddc0e6189b5ad67206cbf297dc76 Mon Sep 17 00:00:00 2001 From: Jens Vagelpohl Date: Thu, 5 Oct 2023 07:32:51 +0200 Subject: [PATCH 01/43] - switch Python 3.12 to non-future and change with-future-python behavior --- config/c-code/manylinux-install.sh.j2 | 8 +++++--- config/c-code/tox.ini.j2 | 3 ++- config/config-package.py | 7 +++++-- config/default/tests.yml.j2 | 6 ++++-- config/default/tox-envlist.j2 | 3 ++- config/default/tox-testenv.j2 | 8 +++----- config/toolkit/tox.ini.j2 | 6 ++---- config/zope-product/tox.ini.j2 | 6 ++---- 8 files changed, 25 insertions(+), 22 deletions(-) diff --git a/config/c-code/manylinux-install.sh.j2 b/config/c-code/manylinux-install.sh.j2 index f55056a..b8cc00f 100644 --- a/config/c-code/manylinux-install.sh.j2 +++ b/config/c-code/manylinux-install.sh.j2 @@ -30,13 +30,14 @@ yum -y install libffi-devel tox_env_map() { case $1 in {% if with_future_python %} - *"cp312"*) echo 'py312';; + *"cp313"*) echo 'py313';; {% endif %} *"cp37"*) echo 'py37';; *"cp38"*) echo 'py38';; *"cp39"*) echo 'py39';; *"cp310"*) echo 'py310';; *"cp311"*) echo 'py311';; + *"cp312"*) echo 'py312';; *) echo 'py';; esac } @@ -45,15 +46,16 @@ tox_env_map() { for PYBIN in /opt/python/*/bin; do if \ {% if with_future_python %} - [[ "${PYBIN}" == *"cp312"* ]] || \ + [[ "${PYBIN}" == *"cp313"* ]] || \ {% endif %} [[ "${PYBIN}" == *"cp311"* ]] || \ + [[ "${PYBIN}" == *"cp312"* ]] || \ [[ "${PYBIN}" == *"cp37"* ]] || \ [[ "${PYBIN}" == *"cp38"* ]] || \ [[ "${PYBIN}" == *"cp39"* ]] || \ [[ "${PYBIN}" == *"cp310"* ]] ; then {% if with_future_python %} - if [[ "${PYBIN}" == *"cp312"* ]] ; then + if [[ "${PYBIN}" == *"cp313"* ]] ; then "${PYBIN}/pip" install --pre -e /io/ "${PYBIN}/pip" wheel /io/ --pre -w wheelhouse/ else diff --git a/config/c-code/tox.ini.j2 b/config/c-code/tox.ini.j2 index f896452..872d38a 100644 --- a/config/c-code/tox.ini.j2 +++ b/config/c-code/tox.ini.j2 @@ -11,8 +11,9 @@ envlist = py39,py39-pure py310,py310-pure py311,py311-pure -{% if with_future_python %} py312,py312-pure +{% if with_future_python %} + py313,py313-pure {% endif %} {% if with_pypy %} pypy3 diff --git a/config/config-package.py b/config/config-package.py index 17a73fd..0a8d0f3 100755 --- a/config/config-package.py +++ b/config/config-package.py @@ -23,7 +23,7 @@ Generated from: https://github.com/zopefoundation/meta/tree/master/config/{config_type} --> """ -FUTURE_PYTHON_VERSION = "3.12.0-rc.3" +FUTURE_PYTHON_VERSION = "" DEFAULT = object() @@ -226,7 +226,10 @@ def with_pypy(self): @cached_property def with_future_python(self): - return self._set_python_config_value('future-python') + if FUTURE_PYTHON_VERSION: + return self._set_python_config_value('future-python') + else: + return False @cached_property def with_docs(self): diff --git a/config/default/tests.yml.j2 b/config/default/tests.yml.j2 index 0511a07..c23e0bd 100644 --- a/config/default/tests.yml.j2 +++ b/config/default/tests.yml.j2 @@ -41,8 +41,9 @@ jobs: - ["3.9", "py39"] - ["3.10", "py310"] - ["3.11", "py311"] + - ["3.12", "py312"] {% if with_future_python %} - - ["%(future_python_version)s", "py312"] + - ["%(future_python_version)s", "py313"] {% endif %} {% if with_pypy %} - ["pypy-3.9", "pypy3"] @@ -75,7 +76,8 @@ jobs: # macOS/Python 3.11+ is set up for universal2 architecture # which causes build and package selection issues. - { os: ["macos", "macos-11"], config: ["3.11", "py311"] } - - { os: ["macos", "macos-11"], config: ["%(future_python_version)s", "py312"] } + - { os: ["macos", "macos-11"], config: ["3.12", "py312"] } + - { os: ["macos", "macos-11"], config: ["%(future_python_version)s", "py313"] } {% endif %} {% for line in gha_additional_exclude %} %(line)s diff --git a/config/default/tox-envlist.j2 b/config/default/tox-envlist.j2 index 460cfef..9a6ae42 100644 --- a/config/default/tox-envlist.j2 +++ b/config/default/tox-envlist.j2 @@ -7,8 +7,9 @@ envlist = py39 py310 py311 -{% if with_future_python %} py312 +{% if with_future_python %} + py313 {% endif %} {% if with_pypy %} pypy3 diff --git a/config/default/tox-testenv.j2 b/config/default/tox-testenv.j2 index f264940..5b6e5f4 100644 --- a/config/default/tox-testenv.j2 +++ b/config/default/tox-testenv.j2 @@ -6,7 +6,7 @@ package = wheel wheel_build_env = .pkg {% endif %} {% if with_future_python %} -pip_pre = py312: true +pip_pre = py313: true {% endif %} deps = {% for line in testenv_deps %} @@ -15,16 +15,14 @@ deps = {% if with_sphinx_doctests and with_future_python %} Sphinx {% endif %} -{% if testenv_setenv or with_future_python %} setenv = +{% if testenv_setenv %} {% for line in testenv_setenv %} %(line)s {% endfor %} - {% if with_future_python %} +{% endif %} py312: VIRTUALENV_PIP=23.1.2 py312: PIP_REQUIRE_VIRTUALENV=0 - {% endif %} -{% endif %} {% if testenv_commands_pre %} commands_pre = {% for line in testenv_commands_pre %} diff --git a/config/toolkit/tox.ini.j2 b/config/toolkit/tox.ini.j2 index d90dd62..c9f5702 100644 --- a/config/toolkit/tox.ini.j2 +++ b/config/toolkit/tox.ini.j2 @@ -9,16 +9,14 @@ deps = {% for line in testenv_deps %} %(line)s {% endfor %} -{% if testenv_setenv or with_future_python %} setenv = +{% if testenv_setenv %} {% for line in testenv_setenv %} %(line)s {% endfor %} - {% if with_future_python %} +{% endif %} py312: VIRTUALENV_PIP=23.1.2 py312: PIP_REQUIRE_VIRTUALENV=0 - {% endif %} -{% endif %} commands_pre = {% if testenv_commands_pre %} {% for line in testenv_commands_pre %} diff --git a/config/zope-product/tox.ini.j2 b/config/zope-product/tox.ini.j2 index 577d28a..532ae08 100644 --- a/config/zope-product/tox.ini.j2 +++ b/config/zope-product/tox.ini.j2 @@ -9,16 +9,14 @@ deps = {% for line in testenv_deps %} %(line)s {% endfor %} -{% if testenv_setenv or with_future_python %} setenv = +{% if testenv_setenv %} {% for line in testenv_setenv %} %(line)s {% endfor %} - {% if with_future_python %} +{% endif %} py312: VIRTUALENV_PIP=23.1.2 py312: PIP_REQUIRE_VIRTUALENV=0 - {% endif %} -{% endif %} commands_pre = {% if testenv_commands_pre %} {% for line in testenv_commands_pre %} From 4a6085d0d32bf91e0c9265b956a12aa10238c9fb Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Thu, 5 Oct 2023 08:18:16 +0200 Subject: [PATCH 02/43] Add documentation for readthedocs support. (#212) Co-authored-by: Jens Vagelpohl --- config/README.rst | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/config/README.rst b/config/README.rst index 620dfd2..33820b8 100644 --- a/config/README.rst +++ b/config/README.rst @@ -70,7 +70,12 @@ Each directory contains the following files if they differ from the default - Configuration file for the MANIFEST to include all needed files in sdist and wheel. -* setup.cfg +* readthedocs.yaml.j2 + + - Configuration for https://readthedocs.org to build the documentation over + there if the package has documentation. + +* setup.cfg.j2 - common setup.cfg, which should be copied to the repository of the package @@ -106,8 +111,8 @@ The script does the following steps: 1. Add the package name to ``packages.txt`` of the selected configuration type if it is not yet added. -2. Copy ``setup.cfg``, ``tox.ini``, ``tests.yml``, ``MANIFEST.in`` and - ``.gitignore`` to the repository. +2. Copy ``setup.cfg``, ``tox.ini``, ``tests.yml``, ``MANIFEST.in``, + ``.readthedocs.yaml`` (if needed), and ``.gitignore`` to the repository. 3. Remove a possibly existing ``.coveragerc`` and ``bootstrap.py``. (Coverage is now configured in ``tox.ini`` for packages which are no buildout recipes.) @@ -170,7 +175,9 @@ The following options are only needed one time as their values are stored in packages. --with-docs - Enable building the documentation using Sphinx. + Enable building the documentation using Sphinx. This will also create a + configuration file `.readthedocs.yaml` for integration with + https://readthedocs.org. --with-sphinx-doctests Enable running the documentation as doctest using Sphinx. From badd5b6eb079e26905022c00c2c1e45b95ccc016 Mon Sep 17 00:00:00 2001 From: Jens Vagelpohl Date: Thu, 5 Oct 2023 08:55:56 +0200 Subject: [PATCH 03/43] - add ability to specify additional RTD build options --- config/README.rst | 17 ++++++++++++++++- config/config-package.py | 8 ++++++-- config/default/readthedocs.yaml.j2 | 5 +++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/config/README.rst b/config/README.rst index 33820b8..58b8062 100644 --- a/config/README.rst +++ b/config/README.rst @@ -377,6 +377,12 @@ updated. Example: "*.mo", ] + [readthedocs] + build-extra = [ + "apt_packages:", + " - libldap2-dev", + ] + Meta Options ```````````` @@ -688,7 +694,6 @@ options (Additional) options used to configure ``zest.releaser``. This option has to be a list of strings and defaults to an empty list. - git options ``````````` @@ -698,6 +703,16 @@ ignore Additional lines to be added to the ``.gitignore`` file. This option has to be a list of strings and defaults to an empty list. +ReadTheDocs options +``````````````````` + +The corresponding section is named: ``[readthedocs]``. + +build-extra + Additional lines to be added to the ``build`` configuration in the + ReadTheDocs configuration file ``.readthedocs.yaml``. This option has to + be a list of strings and defaults to an empty list. + Hints ----- diff --git a/config/config-package.py b/config/config-package.py index 0a8d0f3..b850fee 100755 --- a/config/config-package.py +++ b/config/config-package.py @@ -332,9 +332,13 @@ def gitignore(self): ) def readthedocs(self): + build_extra = self.cfg_option( + 'readthedocs', 'build-extra', default=[]) self.copy_with_meta( - 'readthedocs.yaml.j2', self.path / '.readthedocs.yaml', - self.config_type + 'readthedocs.yaml.j2', + self.path / '.readthedocs.yaml', + self.config_type, + build_extra=build_extra, ) def coveragerc(self): diff --git a/config/default/readthedocs.yaml.j2 b/config/default/readthedocs.yaml.j2 index eb6674b..36707af 100644 --- a/config/default/readthedocs.yaml.j2 +++ b/config/default/readthedocs.yaml.j2 @@ -9,6 +9,11 @@ build: os: ubuntu-22.04 tools: python: "3.11" +{% if build_extra %} + {% for line in build_extra %} + %(line)s + {% endfor %} +{% endif %} # Build documentation in the docs/ directory with Sphinx sphinx: From a361e1fddff21f561c862cda9ff70c095741d3b9 Mon Sep 17 00:00:00 2001 From: Jens Vagelpohl Date: Thu, 5 Oct 2023 10:37:34 +0200 Subject: [PATCH 04/43] - don't call "git add" if the --no-commit flag is set --- config/config-package.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/config/config-package.py b/config/config-package.py index 0a8d0f3..551164f 100755 --- a/config/config-package.py +++ b/config/config-package.py @@ -588,7 +588,8 @@ def configure(self): with change_dir(self.path): # We have to add it here otherwise the linter complains # that it is not added. - call('git', 'add', 'CONTRIBUTING.md') + if self.args.commit: + call('git', 'add', 'CONTRIBUTING.md') self.coveragerc() self.manylinux_sh() @@ -606,13 +607,13 @@ def configure(self): call('git', 'rm', '.travis.yml') if self.rm_coveragerc: call('git', 'rm', '.coveragerc') - if self.add_coveragerc: + if self.add_coveragerc and self.args.commit: call('git', 'add', '.coveragerc') - if self.with_appveyor: + if self.with_appveyor and self.args.commit: call('git', 'add', 'appveyor.yml') - if self.with_docs: + if self.with_docs and self.args.commit: call('git', 'add', '.readthedocs.yaml') - if self.add_manylinux: + if self.add_manylinux and self.args.commit: call('git', 'add', '.manylinux.sh', '.manylinux-install.sh') # Remove empty sections: meta_cfg = {k: v for k, v in self.meta_cfg.items() if v} From 44c9af32126edb42c648b02bae718b84ad98f7eb Mon Sep 17 00:00:00 2001 From: Jens Vagelpohl Date: Thu, 5 Oct 2023 15:53:30 +0200 Subject: [PATCH 05/43] - forgot two places for Python 3.12 --- config/c-code/tests-strategy.j2 | 1 + config/default/appveyor.yml.j2 | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/config/c-code/tests-strategy.j2 b/config/c-code/tests-strategy.j2 index 8d4ede1..e4c6e7d 100644 --- a/config/c-code/tests-strategy.j2 +++ b/config/c-code/tests-strategy.j2 @@ -10,6 +10,7 @@ - "3.9" - "3.10" - "3.11" + - "3.12" {% if with_future_python %} - "%(future_python_version)s" {% endif %} diff --git a/config/default/appveyor.yml.j2 b/config/default/appveyor.yml.j2 index 5c32846..f6db6a6 100644 --- a/config/default/appveyor.yml.j2 +++ b/config/default/appveyor.yml.j2 @@ -14,10 +14,11 @@ environment: - python: 39-x64 - python: 310-x64 - python: 311-x64 + - python: 312-x64 {% if with_future_python %} # `multibuild` cannot install non-final versions as they are not on - # ftp.python.org, so we skip Python 3.11 until its final release: - # - python: 312-x64 + # ftp.python.org, so we skip Python 3.13 until its final release: + # - python: 313-x64 {% endif %} {% for line in additional_matrix %} %(line)s From babc889ca53be5e964eeea4c698b483964cf6669 Mon Sep 17 00:00:00 2001 From: Jens Vagelpohl Date: Fri, 6 Oct 2023 08:08:56 +0200 Subject: [PATCH 06/43] - only refer to future_python if it is set --- config/default/tests.yml.j2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/default/tests.yml.j2 b/config/default/tests.yml.j2 index c23e0bd..e6877a3 100644 --- a/config/default/tests.yml.j2 +++ b/config/default/tests.yml.j2 @@ -77,7 +77,9 @@ jobs: # which causes build and package selection issues. - { os: ["macos", "macos-11"], config: ["3.11", "py311"] } - { os: ["macos", "macos-11"], config: ["3.12", "py312"] } + {% if with_future_python %} - { os: ["macos", "macos-11"], config: ["%(future_python_version)s", "py313"] } + {% endif %} {% endif %} {% for line in gha_additional_exclude %} %(line)s From f16fa11187fb71749c68063d76cedcac9e663b05 Mon Sep 17 00:00:00 2001 From: Alexander Loechel Date: Sat, 7 Oct 2023 12:55:03 +0200 Subject: [PATCH 07/43] remove Python 3.7 from list of supported Python Versions as of today (2023-10-07) Python 3.7 is already end of Life (since 2023-06-27). see https://devguide.python.org/versions/ for reference --- config/drop-legacy-python.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/config/drop-legacy-python.py b/config/drop-legacy-python.py index aec2cc6..fcdd72a 100644 --- a/config/drop-legacy-python.py +++ b/config/drop-legacy-python.py @@ -14,7 +14,7 @@ parser = argparse.ArgumentParser( - description='Drop support of Python 2.7 up to 3.6 from a package.') + description='Drop support of Python 2.7 up to 3.7 from a package.') parser.add_argument( 'path', type=pathlib.Path, help='path to the repository to be configured') parser.add_argument( @@ -52,13 +52,13 @@ if not args.interactive: call(bin_dir / 'bumpversion', '--breaking', '--no-input') call(bin_dir / 'addchangelogentry', - 'Drop support for Python 2.7, 3.5, 3.6.', '--no-input') + 'Drop support for Python 2.7, 3.5, 3.6., 3.7.', '--no-input') else: call(bin_dir / 'bumpversion', '--breaking') call(bin_dir / 'addchangelogentry', - 'Drop support for Python 2.7, 3.5, 3.6.') + 'Drop support for Python 2.7, 3.5, 3.6., 3.7.') call(bin_dir / 'check-python-versions', - '--drop=2.7,3.5,3.6', '--only=setup.py') + '--drop=2.7,3.5,3.6,3.7', '--only=setup.py') print('Remove legacy Python specific settings from .meta.toml') call(os.environ['EDITOR'], '.meta.toml') @@ -76,8 +76,8 @@ call(os.environ['EDITOR'], 'setup.py') src = path.resolve() / 'src' call('find', src, '-name', '*.py', '-exec', - bin_dir / 'pyupgrade', '--py3-plus', '--py37-plus', '{}', ';') - call(bin_dir / 'pyupgrade', '--py3-plus', '--py37-plus', 'setup.py', + bin_dir / 'pyupgrade', '--py3-plus', '--py38-plus', '{}', ';') + call(bin_dir / 'pyupgrade', '--py3-plus', '--py38-plus', 'setup.py', allowed_return_codes=(0, 1)) excludes = ('--exclude-dir', '__pycache__', '--exclude-dir', '*.egg-info', @@ -88,7 +88,7 @@ wait_for_accept() print('Replace any remaining code that may support legacy Python 2:') call('egrep', '-rn', - '2.7|3.5|3.6|sys.version|PY2|PY3|Py2|Py3|Python 2|Python 3' + '2.7|3.5|3.6|3.7|sys.version|PY2|PY3|Py2|Py3|Python 2|Python 3' '|__unicode__|ImportError', src, *excludes, allowed_return_codes=(0, 1)) wait_for_accept() @@ -97,7 +97,7 @@ if not args.interactive: print('Adding, committing and pushing all changes ...') call('git', 'add', '.') - call('git', 'commit', '-m', 'Drop support for Python 2.7 up to 3.6.') + call('git', 'commit', '-m', 'Drop support for Python 2.7 up to 3.7.') call('git', 'push', '--set-upstream', 'origin', branch_name) if updating: print('Updated the previously created PR.') From 17a81220a286eff56f8272a967c9cfe3df181817 Mon Sep 17 00:00:00 2001 From: Alexander Loechel Date: Sat, 7 Oct 2023 12:56:33 +0200 Subject: [PATCH 08/43] separate tox testenvs for lint and package-checks, as those are different things --- config/README.rst | 2 +- config/default/tox-lint.j2 | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/config/README.rst b/config/README.rst index 58b8062..fc770aa 100644 --- a/config/README.rst +++ b/config/README.rst @@ -98,7 +98,7 @@ Preparation The script needs a ``venv`` with some packages installed:: - $ python3.11 -m venv . + $ python3 -m venv . $ bin/pip install -r requirements.txt To use the configuration provided here in a package call the following script:: diff --git a/config/default/tox-lint.j2 b/config/default/tox-lint.j2 index 519edd8..a0ec5ab 100644 --- a/config/default/tox-lint.j2 +++ b/config/default/tox-lint.j2 @@ -1,21 +1,24 @@ - -[testenv:lint] +[testenv:package-checks] basepython = python3 skip_install = true -commands = -{% if use_flake8 %} - isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py%(isort_additional_sources)s - flake8 src setup.py%(flake8_additional_sources)s -{% endif %} - check-manifest - check-python-versions deps = check-manifest - check-python-versions >= 0.19.1 + check-python-versions >= 0.20.0 wheel +commands = + check-manifest + check-python-versions + {% if use_flake8 %} +[testenv:lint] +basepython = python3 +skip_install = true +deps = flake8 isort +commands = + isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py%(isort_additional_sources)s + flake8 src setup.py%(flake8_additional_sources)s [testenv:isort-apply] basepython = python3 From 29a2445d858d8ef307759bf17b56deb6fb41be13 Mon Sep 17 00:00:00 2001 From: Alexander Loechel Date: Sat, 7 Oct 2023 13:08:45 +0200 Subject: [PATCH 09/43] adapt tox-envlist --- config/default/tox-envlist.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/default/tox-envlist.j2 b/config/default/tox-envlist.j2 index 9a6ae42..308b070 100644 --- a/config/default/tox-envlist.j2 +++ b/config/default/tox-envlist.j2 @@ -1,8 +1,8 @@ [tox] minversion = 3.18 envlist = + package-checks lint - py37 py38 py39 py310 From 469bfaafa1a9eb848942b8505e3534c9a7f7d42d Mon Sep 17 00:00:00 2001 From: Alexander Loechel Date: Sat, 7 Oct 2023 15:16:12 +0200 Subject: [PATCH 10/43] lint is not optional, the isort command is mandatory for all zope packages, usage of flake8 is optional. --- config/default/tox-lint.j2 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/config/default/tox-lint.j2 b/config/default/tox-lint.j2 index a0ec5ab..798c4eb 100644 --- a/config/default/tox-lint.j2 +++ b/config/default/tox-lint.j2 @@ -9,16 +9,22 @@ commands = check-manifest check-python-versions -{% if use_flake8 %} [testenv:lint] basepython = python3 skip_install = true deps = - flake8 isort +{% if use_flake8 %} + flake8 +{% for line in flake8_addons %} + %(line)s +{% endfor %} +{% endif %} commands = isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py%(isort_additional_sources)s +{% if use_flake8 %} flake8 src setup.py%(flake8_additional_sources)s +{% endif %} [testenv:isort-apply] basepython = python3 @@ -28,4 +34,4 @@ deps = isort commands = isort {toxinidir}/src {toxinidir}/setup.py%(isort_additional_sources)s [] -{% endif %} + From 0ee53bd5fd187d7bec628eb868abb8e26807ec99 Mon Sep 17 00:00:00 2001 From: Alexander Loechel Date: Sat, 7 Oct 2023 15:19:21 +0200 Subject: [PATCH 11/43] fix lint error on template --- config/default/tox-lint.j2 | 1 - 1 file changed, 1 deletion(-) diff --git a/config/default/tox-lint.j2 b/config/default/tox-lint.j2 index 798c4eb..5431927 100644 --- a/config/default/tox-lint.j2 +++ b/config/default/tox-lint.j2 @@ -34,4 +34,3 @@ deps = isort commands = isort {toxinidir}/src {toxinidir}/setup.py%(isort_additional_sources)s [] - From 77d9eb2c8ec54ebb1d6dfdd3b4357416c7945a20 Mon Sep 17 00:00:00 2001 From: Alexander Loechel Date: Sat, 7 Oct 2023 15:21:30 +0200 Subject: [PATCH 12/43] revert changes to drop Python 3.7 Support --- config/drop-legacy-python.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/config/drop-legacy-python.py b/config/drop-legacy-python.py index fcdd72a..aec2cc6 100644 --- a/config/drop-legacy-python.py +++ b/config/drop-legacy-python.py @@ -14,7 +14,7 @@ parser = argparse.ArgumentParser( - description='Drop support of Python 2.7 up to 3.7 from a package.') + description='Drop support of Python 2.7 up to 3.6 from a package.') parser.add_argument( 'path', type=pathlib.Path, help='path to the repository to be configured') parser.add_argument( @@ -52,13 +52,13 @@ if not args.interactive: call(bin_dir / 'bumpversion', '--breaking', '--no-input') call(bin_dir / 'addchangelogentry', - 'Drop support for Python 2.7, 3.5, 3.6., 3.7.', '--no-input') + 'Drop support for Python 2.7, 3.5, 3.6.', '--no-input') else: call(bin_dir / 'bumpversion', '--breaking') call(bin_dir / 'addchangelogentry', - 'Drop support for Python 2.7, 3.5, 3.6., 3.7.') + 'Drop support for Python 2.7, 3.5, 3.6.') call(bin_dir / 'check-python-versions', - '--drop=2.7,3.5,3.6,3.7', '--only=setup.py') + '--drop=2.7,3.5,3.6', '--only=setup.py') print('Remove legacy Python specific settings from .meta.toml') call(os.environ['EDITOR'], '.meta.toml') @@ -76,8 +76,8 @@ call(os.environ['EDITOR'], 'setup.py') src = path.resolve() / 'src' call('find', src, '-name', '*.py', '-exec', - bin_dir / 'pyupgrade', '--py3-plus', '--py38-plus', '{}', ';') - call(bin_dir / 'pyupgrade', '--py3-plus', '--py38-plus', 'setup.py', + bin_dir / 'pyupgrade', '--py3-plus', '--py37-plus', '{}', ';') + call(bin_dir / 'pyupgrade', '--py3-plus', '--py37-plus', 'setup.py', allowed_return_codes=(0, 1)) excludes = ('--exclude-dir', '__pycache__', '--exclude-dir', '*.egg-info', @@ -88,7 +88,7 @@ wait_for_accept() print('Replace any remaining code that may support legacy Python 2:') call('egrep', '-rn', - '2.7|3.5|3.6|3.7|sys.version|PY2|PY3|Py2|Py3|Python 2|Python 3' + '2.7|3.5|3.6|sys.version|PY2|PY3|Py2|Py3|Python 2|Python 3' '|__unicode__|ImportError', src, *excludes, allowed_return_codes=(0, 1)) wait_for_accept() @@ -97,7 +97,7 @@ if not args.interactive: print('Adding, committing and pushing all changes ...') call('git', 'add', '.') - call('git', 'commit', '-m', 'Drop support for Python 2.7 up to 3.7.') + call('git', 'commit', '-m', 'Drop support for Python 2.7 up to 3.6.') call('git', 'push', '--set-upstream', 'origin', branch_name) if updating: print('Updated the previously created PR.') From 66b997e7081fb7ba3c69e6bc9378982a7fc4a416 Mon Sep 17 00:00:00 2001 From: Alexander Loechel Date: Sat, 7 Oct 2023 16:06:24 +0200 Subject: [PATCH 13/43] flkae8 plugins --- config/README.rst | 7 +++++++ config/config-package.py | 2 ++ config/default/tox-lint.j2 | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/config/README.rst b/config/README.rst index fc770aa..3df90de 100644 --- a/config/README.rst +++ b/config/README.rst @@ -271,6 +271,9 @@ updated. Example: " src/foo/bar.py: E221 E222", "extend-ignore = D203, W503", ] + additional-addons = [ + "maccabe" + ] additional-sources = "testproj foo bar.py" [manifest] @@ -522,6 +525,10 @@ additional-config list of strings so the leading white spaces and comments are preserved when writing the value to ``setup.cfg``. +additional-plugins + Some packages want to have additional flake8 plugins installed. + *Caution:* This option has to be a list of strings. + additional-sources Sometimes not only ``src`` and ``setup.py`` contain Python code to be checked by flake8. Additional files or directories can be configured here. This diff --git a/config/config-package.py b/config/config-package.py index b97dc56..b6a6298 100755 --- a/config/config-package.py +++ b/config/config-package.py @@ -423,6 +423,8 @@ def tox(self): coverage_setenv = self.tox_option('coverage-setenv') coverage_run_additional_config = self.meta_cfg['coverage-run'].get( 'additional-config', []) + flake8_additional_plugins = self.meta_cfg['flake8'].get( + 'additional-plugins', '') flake8_additional_sources = self.meta_cfg['flake8'].get( 'additional-sources', '') if flake8_additional_sources: diff --git a/config/default/tox-lint.j2 b/config/default/tox-lint.j2 index 5431927..ec1a69d 100644 --- a/config/default/tox-lint.j2 +++ b/config/default/tox-lint.j2 @@ -16,7 +16,7 @@ deps = isort {% if use_flake8 %} flake8 -{% for line in flake8_addons %} +{% for line in flake8_additional_plugins %} %(line)s {% endfor %} {% endif %} From beeaad2701c1d983b0e56fae1c7c5595930385db Mon Sep 17 00:00:00 2001 From: Jens Vagelpohl Date: Sat, 7 Oct 2023 16:57:02 +0200 Subject: [PATCH 14/43] - restore py37 in the tox env list --- config/default/tox-envlist.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/config/default/tox-envlist.j2 b/config/default/tox-envlist.j2 index 308b070..9cbde2f 100644 --- a/config/default/tox-envlist.j2 +++ b/config/default/tox-envlist.j2 @@ -3,6 +3,7 @@ minversion = 3.18 envlist = package-checks lint + py37 py38 py39 py310 From cf5793083ece5c15d4452851fea25bc9c637abab Mon Sep 17 00:00:00 2001 From: Jens Vagelpohl Date: Sat, 7 Oct 2023 16:59:16 +0200 Subject: [PATCH 15/43] - pass along new parameter --- config/config-package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/config/config-package.py b/config/config-package.py index b6a6298..59f924f 100755 --- a/config/config-package.py +++ b/config/config-package.py @@ -456,6 +456,7 @@ def tox(self): coverage_setenv=coverage_setenv, fail_under=self.fail_under, flake8_additional_sources=flake8_additional_sources, + flake8_additional_plugins=flake8_additional_plugins, isort_additional_sources=isort_additional_sources, testenv_additional=testenv_additional, testenv_additional_extras=testenv_additional_extras, From 24b5582137590be848c54c4cc3cb38d5ca227ea9 Mon Sep 17 00:00:00 2001 From: Alexander Loechel Date: Sat, 7 Oct 2023 18:13:55 +0200 Subject: [PATCH 16/43] rename testenv from package-checks to release-check following plone/meta --- config/default/tox-envlist.j2 | 2 +- config/default/tox-lint.j2 | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/config/default/tox-envlist.j2 b/config/default/tox-envlist.j2 index 9cbde2f..199cb60 100644 --- a/config/default/tox-envlist.j2 +++ b/config/default/tox-envlist.j2 @@ -1,7 +1,7 @@ [tox] minversion = 3.18 envlist = - package-checks + release-check lint py37 py38 diff --git a/config/default/tox-lint.j2 b/config/default/tox-lint.j2 index ec1a69d..ad095cf 100644 --- a/config/default/tox-lint.j2 +++ b/config/default/tox-lint.j2 @@ -1,13 +1,18 @@ -[testenv:package-checks] +[testenv:release-check] +description = ensure that the distribution is ready to release basepython = python3 skip_install = true deps = + twine + build check-manifest check-python-versions >= 0.20.0 wheel commands = check-manifest check-python-versions + python -m build --sdist --no-isolation + twine check dist/* [testenv:lint] basepython = python3 From 0990b7c1c35c2d27567b25e81834a008367d9de5 Mon Sep 17 00:00:00 2001 From: Jens Vagelpohl Date: Sun, 8 Oct 2023 10:37:25 +0200 Subject: [PATCH 17/43] - fix misnomer in README --- config/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/README.rst b/config/README.rst index 3df90de..03e1813 100644 --- a/config/README.rst +++ b/config/README.rst @@ -271,7 +271,7 @@ updated. Example: " src/foo/bar.py: E221 E222", "extend-ignore = D203, W503", ] - additional-addons = [ + additional-plugins = [ "maccabe" ] additional-sources = "testproj foo bar.py" From f52819781b1596b683b997e1a04ba9441ab922dc Mon Sep 17 00:00:00 2001 From: Jens Vagelpohl Date: Wed, 11 Oct 2023 16:28:06 +0200 Subject: [PATCH 18/43] - specify FUTURE_PYTHON_VERSION as version range --- config/config-package.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/config/config-package.py b/config/config-package.py index b97dc56..6e1623d 100755 --- a/config/config-package.py +++ b/config/config-package.py @@ -23,7 +23,7 @@ Generated from: https://github.com/zopefoundation/meta/tree/master/config/{config_type} --> """ -FUTURE_PYTHON_VERSION = "" +FUTURE_PYTHON_VERSION = "3.13.0-alpha - 3.13.0" DEFAULT = object() @@ -226,10 +226,7 @@ def with_pypy(self): @cached_property def with_future_python(self): - if FUTURE_PYTHON_VERSION: - return self._set_python_config_value('future-python') - else: - return False + return self._set_python_config_value('future-python') @cached_property def with_docs(self): From 13b9049c6e3fbfbfa04bae5f18ff7396140e1933 Mon Sep 17 00:00:00 2001 From: Jens Vagelpohl Date: Sat, 14 Oct 2023 08:51:59 +0200 Subject: [PATCH 19/43] - apply changes from #216 to the zope-product tox template --- config/zope-product/tox.ini.j2 | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/config/zope-product/tox.ini.j2 b/config/zope-product/tox.ini.j2 index 532ae08..46fab7d 100644 --- a/config/zope-product/tox.ini.j2 +++ b/config/zope-product/tox.ini.j2 @@ -37,6 +37,23 @@ commands = %(line)s {% endfor %} +[testenv:release-check] +description = ensure that the distribution is ready to release +basepython = python3 +skip_install = true +deps = + twine + build + check-manifest + check-python-versions >= 0.20.0 + wheel +commands_pre = +commands = + check-manifest + check-python-versions + python -m build --sdist --no-isolation + twine check dist/* + [testenv:lint] basepython = python3 commands_pre = @@ -50,11 +67,7 @@ commands = isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py%(isort_additional_sources)s flake8 {toxinidir}/src {toxinidir}/setup.py%(flake8_additional_sources)s {% endif %} - check-manifest - check-python-versions deps = - check-manifest - check-python-versions {% if use_flake8 %} flake8 isort From f262b2e9f0fa46e3c5a449ca691a1dc189c79ea8 Mon Sep 17 00:00:00 2001 From: Jens Vagelpohl Date: Mon, 23 Oct 2023 10:22:12 +0200 Subject: [PATCH 20/43] - address issues from PR #216 --- config/README.rst | 6 +++--- config/default/tests.yml.j2 | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/config/README.rst b/config/README.rst index 03e1813..fb28d48 100644 --- a/config/README.rst +++ b/config/README.rst @@ -98,7 +98,7 @@ Preparation The script needs a ``venv`` with some packages installed:: - $ python3 -m venv . + $ python3.11 -m venv . $ bin/pip install -r requirements.txt To use the configuration provided here in a package call the following script:: @@ -272,7 +272,7 @@ updated. Example: "extend-ignore = D203, W503", ] additional-plugins = [ - "maccabe" + "mccabe", ] additional-sources = "testproj foo bar.py" @@ -527,7 +527,7 @@ additional-config additional-plugins Some packages want to have additional flake8 plugins installed. - *Caution:* This option has to be a list of strings. + This option is a list of strings. additional-sources Sometimes not only ``src`` and ``setup.py`` contain Python code to be checked diff --git a/config/default/tests.yml.j2 b/config/default/tests.yml.j2 index e6877a3..592d72d 100644 --- a/config/default/tests.yml.j2 +++ b/config/default/tests.yml.j2 @@ -35,6 +35,7 @@ jobs: {% endif %} config: # [Python version, tox env] + - ["3.9"], "release-check"] - ["3.9", "lint"] - ["3.7", "py37"] - ["3.8", "py38"] @@ -61,6 +62,7 @@ jobs: exclude: {% endif %} {% if with_windows %} + - { os: ["windows", "windows-latest"], config: ["3.9", "release-check"] } - { os: ["windows", "windows-latest"], config: ["3.9", "lint"] } {% if with_docs %} - { os: ["windows", "windows-latest"], config: ["3.9", "docs"] } @@ -68,6 +70,7 @@ jobs: - { os: ["windows", "windows-latest"], config: ["3.9", "coverage"] } {% endif %} {% if with_macos %} + - { os: ["macos", "macos-11"], config: ["3.9", "release-check"] } - { os: ["macos", "macos-11"], config: ["3.9", "lint"] } {% if with_docs %} - { os: ["macos", "macos-11"], config: ["3.9", "docs"] } From 18d45cde093e40867a6dbe36900fe8808df065bd Mon Sep 17 00:00:00 2001 From: Jens Vagelpohl Date: Mon, 23 Oct 2023 14:22:03 +0200 Subject: [PATCH 21/43] - fix typo --- config/default/tests.yml.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/default/tests.yml.j2 b/config/default/tests.yml.j2 index 592d72d..547dc68 100644 --- a/config/default/tests.yml.j2 +++ b/config/default/tests.yml.j2 @@ -35,7 +35,7 @@ jobs: {% endif %} config: # [Python version, tox env] - - ["3.9"], "release-check"] + - ["3.9", "release-check"] - ["3.9", "lint"] - ["3.7", "py37"] - ["3.8", "py38"] From a2131923d165bf6cc689c285c167729c6e527f54 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Tue, 14 Nov 2023 08:55:16 +0100 Subject: [PATCH 22/43] Update versions to (hopefully) fix GHA run. --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 312d099..342b0cd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ --- repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -11,13 +11,13 @@ repos: - id: debug-statements language_version: python3 - repo: https://github.com/PyCQA/flake8 - rev: 6.0.0 + rev: 6.1.0 hooks: - id: flake8 language_version: python3 additional_dependencies: [flake8-typing-imports==1.14.0] - repo: https://github.com/pre-commit/mirrors-autopep8 - rev: v2.0.1 + rev: v2.0.4 hooks: - id: autopep8 - repo: https://github.com/timothycrosley/isort @@ -38,7 +38,7 @@ repos: additional_dependencies: [pygments, restructuredtext_lint] # This can deal with sphinx directives - repo: https://github.com/myint/rstcheck - rev: "v6.1.1" + rev: "v6.2.0" hooks: - id: rstcheck args: [--ignore-messages, Duplicate implicit target.*] From e849e375ae07670863b448930765b74229d725c7 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Tue, 14 Nov 2023 08:57:21 +0100 Subject: [PATCH 23/43] Update second level dependency. --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 342b0cd..318910e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,7 +15,7 @@ repos: hooks: - id: flake8 language_version: python3 - additional_dependencies: [flake8-typing-imports==1.14.0] + additional_dependencies: [flake8-typing-imports==1.15.0] - repo: https://github.com/pre-commit/mirrors-autopep8 rev: v2.0.4 hooks: From cb0568c7ddbbe8ad0da769d9d2bc0185acaaadd1 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Tue, 14 Nov 2023 09:04:37 +0100 Subject: [PATCH 24/43] Revert "Fix path to ``test`` script on Windows" (#223) --- config/zope-product/tox.ini.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/zope-product/tox.ini.j2 b/config/zope-product/tox.ini.j2 index 46fab7d..10d932e 100644 --- a/config/zope-product/tox.ini.j2 +++ b/config/zope-product/tox.ini.j2 @@ -31,7 +31,7 @@ commands = %(line)s {% endfor %} {% else %} - {envdir}/bin/test {posargs:-cv} + {envbindir}/test {posargs:-cv} {% endif %} {% for line in testenv_additional %} %(line)s @@ -108,7 +108,7 @@ commands = %(line)s {% endfor %} {% else %} - coverage run {envdir}/bin/test {posargs:-cv} + coverage run {envbindir}/test {posargs:-cv} {% endif %} coverage html coverage report -m --fail-under=%(fail_under)s From 1a1f5e2771ee0f047c9e32cdea09653cd7337b91 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Mon, 18 Dec 2023 15:11:12 +0100 Subject: [PATCH 25/43] Also re-enable toolkit type repos. --- config/re-enable-actions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/re-enable-actions.py b/config/re-enable-actions.py index f43e192..be09079 100644 --- a/config/re-enable-actions.py +++ b/config/re-enable-actions.py @@ -9,7 +9,7 @@ org = 'zopefoundation' base_url = f'https://github.com/{org}' base_path = pathlib.Path(__file__).parent -types = ['buildout-recipe', 'c-code', 'pure-python', 'zope-product'] +types = ['buildout-recipe', 'c-code', 'pure-python', 'zope-product', 'toolkit'] parser = argparse.ArgumentParser( From cee3e026874553a367c6632d46b2461994012fd0 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Wed, 20 Dec 2023 15:51:01 +0100 Subject: [PATCH 26/43] Include release check also in toolkit type. --- config/default/tox-lint.j2 | 16 +--------------- config/default/tox-release-check.j2 | 16 ++++++++++++++++ config/toolkit/tox.ini.j2 | 1 + config/zope-product/tox.ini.j2 | 18 +----------------- 4 files changed, 19 insertions(+), 32 deletions(-) create mode 100644 config/default/tox-release-check.j2 diff --git a/config/default/tox-lint.j2 b/config/default/tox-lint.j2 index ad095cf..bdd6ec5 100644 --- a/config/default/tox-lint.j2 +++ b/config/default/tox-lint.j2 @@ -1,18 +1,4 @@ -[testenv:release-check] -description = ensure that the distribution is ready to release -basepython = python3 -skip_install = true -deps = - twine - build - check-manifest - check-python-versions >= 0.20.0 - wheel -commands = - check-manifest - check-python-versions - python -m build --sdist --no-isolation - twine check dist/* +{% include 'tox-release-check.j2' %} [testenv:lint] basepython = python3 diff --git a/config/default/tox-release-check.j2 b/config/default/tox-release-check.j2 new file mode 100644 index 0000000..92d06b9 --- /dev/null +++ b/config/default/tox-release-check.j2 @@ -0,0 +1,16 @@ +[testenv:release-check] +description = ensure that the distribution is ready to release +basepython = python3 +skip_install = true +deps = + twine + build + check-manifest + check-python-versions >= 0.20.0 + wheel +commands_pre = +commands = + check-manifest + check-python-versions + python -m build --sdist --no-isolation + twine check dist/* diff --git a/config/toolkit/tox.ini.j2 b/config/toolkit/tox.ini.j2 index c9f5702..6ea08e7 100644 --- a/config/toolkit/tox.ini.j2 +++ b/config/toolkit/tox.ini.j2 @@ -54,6 +54,7 @@ deps = {% if use_flake8 %} flake8 isort +{% include 'tox-release-check.j2' %} [testenv:isort-apply] basepython = python3 diff --git a/config/zope-product/tox.ini.j2 b/config/zope-product/tox.ini.j2 index 10d932e..1158711 100644 --- a/config/zope-product/tox.ini.j2 +++ b/config/zope-product/tox.ini.j2 @@ -36,23 +36,7 @@ commands = {% for line in testenv_additional %} %(line)s {% endfor %} - -[testenv:release-check] -description = ensure that the distribution is ready to release -basepython = python3 -skip_install = true -deps = - twine - build - check-manifest - check-python-versions >= 0.20.0 - wheel -commands_pre = -commands = - check-manifest - check-python-versions - python -m build --sdist --no-isolation - twine check dist/* +{% include 'tox-release-check.j2' %} [testenv:lint] basepython = python3 From acd8d23975a82c8036efd81625ee650645172099 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Wed, 20 Dec 2023 15:51:14 +0100 Subject: [PATCH 27/43] Add new repos. --- config/toolkit/packages.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/config/toolkit/packages.txt b/config/toolkit/packages.txt index 2df7eb2..e429104 100644 --- a/config/toolkit/packages.txt +++ b/config/toolkit/packages.txt @@ -2,3 +2,4 @@ # Do not edit the file by hand but use the script config-package.py as # described in README.rst zopetoolkit +groktoolkit From 9e626d3b8eb8b2f2eb252f0ef386e234b5bdddb9 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Thu, 11 Jan 2024 08:43:43 +0100 Subject: [PATCH 28/43] Update GH actions + PyPy version. (#224) --- config/README.rst | 4 ++-- config/c-code/tests-cache.j2 | 4 ++-- config/c-code/tests-download.j2 | 2 +- config/c-code/tests-strategy.j2 | 4 ++-- config/c-code/tests.yml.j2 | 4 ++-- config/default/tests.yml.j2 | 6 +++--- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/config/README.rst b/config/README.rst index fb28d48..436f2b7 100644 --- a/config/README.rst +++ b/config/README.rst @@ -306,8 +306,8 @@ updated. Example: "- [\"3.8\", \"py38-slim\"]", ] additional-exclude = [ - "- { os: windows, config: [\"pypy-3.9\", \"pypy\"] }", - "- { os: macos, config: [\"pypy-3.9\", \"pypy\"] }", + "- { os: windows, config: [\"pypy-3.10\", \"pypy3\"] }", + "- { os: macos, config: [\"pypy-3.10\", \"pypy3\"] }", ] steps-before-checkout = [ "- name: \"Set some Postgres settings\"", diff --git a/config/c-code/tests-cache.j2 b/config/c-code/tests-cache.j2 index d475fd4..d4ddcb5 100644 --- a/config/c-code/tests-cache.j2 +++ b/config/c-code/tests-cache.j2 @@ -1,7 +1,7 @@ - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} ### diff --git a/config/c-code/tests-download.j2 b/config/c-code/tests-download.j2 index 048bc3c..c89cf27 100644 --- a/config/c-code/tests-download.j2 +++ b/config/c-code/tests-download.j2 @@ -1,6 +1,6 @@ - name: Download %(package_name)s wheel - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: %(package_name)s-${{ runner.os }}-${{ matrix.python-version }}.whl path: dist/ diff --git a/config/c-code/tests-strategy.j2 b/config/c-code/tests-strategy.j2 index e4c6e7d..8885aed 100644 --- a/config/c-code/tests-strategy.j2 +++ b/config/c-code/tests-strategy.j2 @@ -3,7 +3,7 @@ matrix: python-version: {% if with_pypy %} - - "pypy-3.9" + - "pypy-3.10" {% endif %} - "3.7" - "3.8" @@ -20,7 +20,7 @@ {% endif %} {% if with_pypy %} - os: macos-11 - python-version: "pypy-3.9" + python-version: "pypy-3.10" {% endif %} {% for line in gha_additional_exclude %} %(line)s diff --git a/config/c-code/tests.yml.j2 b/config/c-code/tests.yml.j2 index 32557a1..658fc99 100644 --- a/config/c-code/tests.yml.j2 +++ b/config/c-code/tests.yml.j2 @@ -182,7 +182,7 @@ jobs: {% else %} !startsWith(runner.os, 'Mac') {% endif %} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: {% if kind == 'macOS arm64' %} # The arm64 wheel is uploaded with a different name just so it can be @@ -398,7 +398,7 @@ jobs: bash .manylinux.sh - name: Upload %(package_name)s wheels - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: path: wheelhouse/*whl name: manylinux_${{ matrix.image }}_wheels.zip diff --git a/config/default/tests.yml.j2 b/config/default/tests.yml.j2 index 547dc68..c5404e0 100644 --- a/config/default/tests.yml.j2 +++ b/config/default/tests.yml.j2 @@ -47,7 +47,7 @@ jobs: - ["%(future_python_version)s", "py313"] {% endif %} {% if with_pypy %} - - ["pypy-3.9", "pypy3"] + - ["pypy-3.10", "pypy3"] {% endif %} {% if with_docs %} - ["3.9", "docs"] @@ -99,9 +99,9 @@ jobs: {% for line in steps_before_checkout %} %(line)s {% endfor %} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.config[0] }} - name: Pip cache From eb4b9bb890354a0eed6521bccbb743109ec8a4f0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 11 Jan 2024 20:19:06 +0000 Subject: [PATCH 29/43] Bump jinja2 from 3.1.2 to 3.1.3 in /config Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.2 to 3.1.3. - [Release notes](https://github.com/pallets/jinja/releases) - [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst) - [Commits](https://github.com/pallets/jinja/compare/3.1.2...3.1.3) --- updated-dependencies: - dependency-name: jinja2 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- config/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/requirements.txt b/config/requirements.txt index 0d4dadf..d419f51 100644 --- a/config/requirements.txt +++ b/config/requirements.txt @@ -1,5 +1,5 @@ check-python-versions==0.20.0 -Jinja2==3.1.2 +Jinja2==3.1.3 pyupgrade==3.3.1 toml==0.10.2 tox==4.0.14 From e45966cd82c3b37e44011a246af0fe68929eeda4 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Tue, 23 Jan 2024 09:31:28 +0100 Subject: [PATCH 30/43] Support Python 3.13a3 by installing not yet released packages. (#227) --- config/c-code/tests.yml.j2 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/config/c-code/tests.yml.j2 b/config/c-code/tests.yml.j2 index 658fc99..c8b5d6b 100644 --- a/config/c-code/tests.yml.j2 +++ b/config/c-code/tests.yml.j2 @@ -96,7 +96,22 @@ jobs: steps: {% include 'tests-cache.j2' %} +{% if with_future_python %} + - name: Install Build Dependencies (%(future_python_version)s) + if: matrix.python-version == '%(future_python_version)s' + run: | + pip install -U pip + pip install -U setuptools wheel twine + # cffi will probably have no public release until a Python 3.13 beta + # or even RC release, see https://github.com/python-cffi/cffi/issues/23 + pip install -U "cffi @ https://github.com/python-cffi/cffi/archive/refs/heads/main.zip" + # twine has no release for 3.13, yet, see https://github.com/pypa/twine/issues/1030 + pip install -U "git+https://github.com/pypa/twine.git#egg=twine" +{% endif %} - name: Install Build Dependencies +{% if with_future_python %} + if: matrix.python-version != '%(future_python_version)s' +{% endif %} run: | pip install -U pip pip install -U setuptools wheel twine cffi @@ -241,6 +256,9 @@ jobs: if: ${{ startsWith(matrix.python-version, '%(future_python_version)s') }} run: | pip install -U wheel setuptools + # cffi will probably have no public release until a beta or even RC + # version of Python 3.13, see https://github.com/python-cffi/cffi/issues/23 + pip install -U 'cffi @ https://github.com/python-cffi/cffi/archive/refs/heads/main.zip ; platform_python_implementation == "CPython"' # coverage has 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 From 08a3cc691b8a880a983fe2949c7406c038f02e2c Mon Sep 17 00:00:00 2001 From: Jens Vagelpohl Date: Thu, 25 Jan 2024 07:32:07 +0000 Subject: [PATCH 31/43] Update GitHub cache action to version 4 (#228) --- config/c-code/tests-cache.j2 | 2 +- config/default/tests.yml.j2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/c-code/tests-cache.j2 b/config/c-code/tests-cache.j2 index d4ddcb5..bbb0410 100644 --- a/config/c-code/tests-cache.j2 +++ b/config/c-code/tests-cache.j2 @@ -16,7 +16,7 @@ echo "dir=$(pip cache dir)" >>$GITHUB_OUTPUT - name: pip cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.pip-cache.outputs.dir }} key: %(cache_key)s diff --git a/config/default/tests.yml.j2 b/config/default/tests.yml.j2 index c5404e0..92dd6a6 100644 --- a/config/default/tests.yml.j2 +++ b/config/default/tests.yml.j2 @@ -105,7 +105,7 @@ jobs: with: python-version: ${{ matrix.config[0] }} - name: Pip cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('setup.*', 'tox.ini') }} From d30051883163a0d78d661906847751b9ee31107b Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Fri, 2 Feb 2024 08:55:17 +0100 Subject: [PATCH 32/43] Implement suggestions to circumvent problem with pip. Taken from https://github.com/python-cffi/cffi/issues/23#issuecomment-1922041418 --- config/c-code/tests.yml.j2 | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/config/c-code/tests.yml.j2 b/config/c-code/tests.yml.j2 index c8b5d6b..4124693 100644 --- a/config/c-code/tests.yml.j2 +++ b/config/c-code/tests.yml.j2 @@ -104,7 +104,8 @@ jobs: pip install -U setuptools wheel twine # cffi will probably have no public release until a Python 3.13 beta # or even RC release, see https://github.com/python-cffi/cffi/issues/23 - pip install -U "cffi @ https://github.com/python-cffi/cffi/archive/refs/heads/main.zip" + echo "cffi @ git+https://github.com/python-cffi/cffi.git@954cab4f889fb019a7f90df153ee1be501495f58" > cffi_constraint.txt + PIP_CONSTRAINT=cffi_constraint.txt pip install cffi # twine has no release for 3.13, yet, see https://github.com/pypa/twine/issues/1030 pip install -U "git+https://github.com/pypa/twine.git#egg=twine" {% endif %} @@ -167,9 +168,12 @@ jobs: if: matrix.python-version == '%(future_python_version)s' run: | # Install to collect dependencies into the (pip) cache. + # cffi will probably have no public release until a Python 3.13 beta + # or even RC release, see https://github.com/python-cffi/cffi/issues/23 + echo "cffi @ git+https://github.com/python-cffi/cffi.git@954cab4f889fb019a7f90df153ee1be501495f58" > cffi_constraint.txt # Use "--pre" here because dependencies with support for this future # Python release may only be available as pre-releases - pip install --pre .[test] + PIP_CONSTRAINT=cffi_constraint.txt pip install --pre .[test] {% endif %} - name: Install %(package_name)s and dependencies {% if with_future_python %} @@ -258,17 +262,17 @@ jobs: pip install -U wheel setuptools # cffi will probably have no public release until a beta or even RC # version of Python 3.13, see https://github.com/python-cffi/cffi/issues/23 - pip install -U 'cffi @ https://github.com/python-cffi/cffi/archive/refs/heads/main.zip ; platform_python_implementation == "CPython"' + echo 'cffi @ git+https://github.com/python-cffi/cffi.git@954cab4f889fb019a7f90df153ee1be501495f58 ; platform_python_implementation == "CPython"' > cffi_constraint.txt # coverage has 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/%(package_name)s-*whl -d src + 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 -U -e .[test] + PIP_CONSTRAINT=cffi_constraint.txt pip install --pre -U -e .[test] {% endif %} - name: Install %(package_name)s {% if with_future_python %} From 17113b949bc328afc86fdcb02074d3f85648c629 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Fri, 2 Feb 2024 20:57:13 +0100 Subject: [PATCH 33/43] Fix previous commit. --- config/c-code/tests.yml.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/c-code/tests.yml.j2 b/config/c-code/tests.yml.j2 index 4124693..8eb6ad7 100644 --- a/config/c-code/tests.yml.j2 +++ b/config/c-code/tests.yml.j2 @@ -269,7 +269,7 @@ jobs: # 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 + unzip -n dist/%(package_name)s-*whl -d src # Use "--pre" here because dependencies with support for this future # Python release may only be available as pre-releases PIP_CONSTRAINT=cffi_constraint.txt pip install --pre -U -e .[test] From d3d78a7be79f274e672e514e5a2d408d2bf6f022 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Fri, 9 Feb 2024 08:09:10 +0100 Subject: [PATCH 34/43] Add LICENSE (#231) * add file preambles * move shebangs to the top * update GH actions --------- Co-authored-by: Jens Vagelpohl --- .github/workflows/pre-commit.yml | 6 ++--- COPYRIGHT.txt | 1 + LICENSE.txt | 44 ++++++++++++++++++++++++++++++++ config/config-package.py | 12 +++++++++ config/drop-legacy-python.py | 14 +++++++++- config/meta-cfg-to-toml.py | 12 +++++++++ config/multi-call.py | 12 +++++++++ config/re-enable-actions.py | 14 +++++++++- config/shared/call.py | 12 +++++++++ config/shared/git.py | 12 +++++++++ config/shared/packages.py | 12 +++++++++ config/shared/path.py | 12 +++++++++ config/shared/toml_encoder.py | 12 +++++++++ 13 files changed, 170 insertions(+), 5 deletions(-) create mode 100644 COPYRIGHT.txt create mode 100644 LICENSE.txt diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 0f1b979..bb49834 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -14,10 +14,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.cache/pip @@ -27,7 +27,7 @@ jobs: restore-keys: | lint-v1- - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.x' diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt new file mode 100644 index 0000000..b8581dd --- /dev/null +++ b/COPYRIGHT.txt @@ -0,0 +1 @@ +Zope Foundation and Contributors diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..e1f9ad7 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,44 @@ +Zope Public License (ZPL) Version 2.1 + +A copyright notice accompanies this license document that identifies the +copyright holders. + +This license has been certified as open source. It has also been designated as +GPL compatible by the Free Software Foundation (FSF). + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions in source code must retain the accompanying copyright +notice, this list of conditions, and the following disclaimer. + +2. Redistributions in binary form must reproduce the accompanying copyright +notice, this list of conditions, and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +3. Names of the copyright holders must not be used to endorse or promote +products derived from this software without prior written permission from the +copyright holders. + +4. The right to distribute this software or to use it for any purpose does not +give you the right to use Servicemarks (sm) or Trademarks (tm) of the +copyright +holders. Use of them is covered by separate agreement with the copyright +holders. + +5. If any files are modified, you must cause the modified files to carry +prominent notices stating that you changed the files and the date of any +change. + +Disclaimer + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED +OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/config/config-package.py b/config/config-package.py index 739f3e9..0c3ec1e 100755 --- a/config/config-package.py +++ b/config/config-package.py @@ -1,4 +1,16 @@ #!/usr/bin/env python3 +############################################################################## +# +# Copyright (c) 2019 Zope Foundation and Contributors. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## from functools import cached_property from shared.call import abort from shared.call import call diff --git a/config/drop-legacy-python.py b/config/drop-legacy-python.py index aec2cc6..e24ac7a 100644 --- a/config/drop-legacy-python.py +++ b/config/drop-legacy-python.py @@ -1,4 +1,16 @@ -#!/usr/bin/env', 'python3 +#!/usr/bin/env python3 +############################################################################## +# +# Copyright (c) 2022 Zope Foundation and Contributors. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## from shared.call import call from shared.call import wait_for_accept from shared.git import get_branch_name diff --git a/config/meta-cfg-to-toml.py b/config/meta-cfg-to-toml.py index 1955b32..5d079f6 100644 --- a/config/meta-cfg-to-toml.py +++ b/config/meta-cfg-to-toml.py @@ -1,4 +1,16 @@ #!/usr/bin/env python3 +############################################################################## +# +# Copyright (c) 2020 Zope Foundation and Contributors. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## from configparser import ConfigParser from shared.call import call from shared.path import change_dir diff --git a/config/multi-call.py b/config/multi-call.py index 0253135..bceae41 100644 --- a/config/multi-call.py +++ b/config/multi-call.py @@ -1,4 +1,16 @@ #!/usr/bin/env python3 +############################################################################## +# +# Copyright (c) 2020 Zope Foundation and Contributors. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## from shared.call import call from shared.packages import list_packages from shared.path import change_dir diff --git a/config/re-enable-actions.py b/config/re-enable-actions.py index be09079..1fe0041 100644 --- a/config/re-enable-actions.py +++ b/config/re-enable-actions.py @@ -1,4 +1,16 @@ -#!/bin/env python3 +#!/usr/bin/env python3 +############################################################################## +# +# Copyright (c) 2021 Zope Foundation and Contributors. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## from shared.call import call from shared.packages import list_packages import argparse diff --git a/config/shared/call.py b/config/shared/call.py index 0b18ae7..fd16b5c 100644 --- a/config/shared/call.py +++ b/config/shared/call.py @@ -1,3 +1,15 @@ +############################################################################## +# +# Copyright (c) 2020 Zope Foundation and Contributors. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## import subprocess import sys diff --git a/config/shared/git.py b/config/shared/git.py index 2cd648f..88f8c1d 100644 --- a/config/shared/git.py +++ b/config/shared/git.py @@ -1,3 +1,15 @@ +############################################################################## +# +# Copyright (c) 2022 Zope Foundation and Contributors. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## from .call import call from .path import change_dir import pathlib diff --git a/config/shared/packages.py b/config/shared/packages.py index 83b1dcf..5dee802 100644 --- a/config/shared/packages.py +++ b/config/shared/packages.py @@ -1,3 +1,15 @@ +############################################################################## +# +# Copyright (c) 2021 Zope Foundation and Contributors. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## import pathlib diff --git a/config/shared/path.py b/config/shared/path.py index 42a81c3..a1f83c7 100644 --- a/config/shared/path.py +++ b/config/shared/path.py @@ -1,3 +1,15 @@ +############################################################################## +# +# Copyright (c) 2020 Zope Foundation and Contributors. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## import argparse import contextlib import os diff --git a/config/shared/toml_encoder.py b/config/shared/toml_encoder.py index a75b72c..e84625f 100644 --- a/config/shared/toml_encoder.py +++ b/config/shared/toml_encoder.py @@ -1,3 +1,15 @@ +############################################################################## +# +# Copyright (c) 2020 Zope Foundation and Contributors. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## import toml From ea22d70cd57a84f24d7ad31c27cb78b1187a2fcb Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Mon, 12 Feb 2024 17:44:37 +0100 Subject: [PATCH 35/43] Only check workflows which contain python tests. toolkit repos have a sync workflow which breaks the check otherwise. --- config/default/tox-release-check.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/default/tox-release-check.j2 b/config/default/tox-release-check.j2 index 92d06b9..db35b26 100644 --- a/config/default/tox-release-check.j2 +++ b/config/default/tox-release-check.j2 @@ -11,6 +11,6 @@ deps = commands_pre = commands = check-manifest - check-python-versions + check-python-versions --only setup.py,tox.ini,.github/workflows/tests.yml python -m build --sdist --no-isolation twine check dist/* From 74a0f0f221c46735c1aa957cc43314ff211e62ee Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Wed, 14 Feb 2024 08:42:56 +0100 Subject: [PATCH 36/43] Update to twine 5.0. (#232) It contains the needed fix for Python 3.13. --- config/c-code/tests.yml.j2 | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/c-code/tests.yml.j2 b/config/c-code/tests.yml.j2 index 8eb6ad7..f681bcf 100644 --- a/config/c-code/tests.yml.j2 +++ b/config/c-code/tests.yml.j2 @@ -106,8 +106,6 @@ jobs: # or even RC release, see https://github.com/python-cffi/cffi/issues/23 echo "cffi @ git+https://github.com/python-cffi/cffi.git@954cab4f889fb019a7f90df153ee1be501495f58" > cffi_constraint.txt PIP_CONSTRAINT=cffi_constraint.txt pip install cffi - # twine has no release for 3.13, yet, see https://github.com/pypa/twine/issues/1030 - pip install -U "git+https://github.com/pypa/twine.git#egg=twine" {% endif %} - name: Install Build Dependencies {% if with_future_python %} From 1aefa8a2217dc7dc15355c2c1d8573d27c3a24af Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Tue, 20 Feb 2024 10:29:04 +0100 Subject: [PATCH 37/43] Remove archived repos. --- config/pure-python/packages.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/config/pure-python/packages.txt b/config/pure-python/packages.txt index a2090d3..64b82dd 100644 --- a/config/pure-python/packages.txt +++ b/config/pure-python/packages.txt @@ -113,7 +113,6 @@ zope.app.dependable zope.app.component z3c.batching zc.set -cipher.encryptingstorage zope.app.testing transaction zope.sequencesort From 3e2142325ea531da3f1ff822b64454572811f64d Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Wed, 21 Feb 2024 08:17:27 +0100 Subject: [PATCH 38/43] Make `PIP_CONSTRAINT` path absolute as learned in https://github.com/zopefoundation/zope.security/pull/105 --- config/c-code/tests.yml.j2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/c-code/tests.yml.j2 b/config/c-code/tests.yml.j2 index f681bcf..2ada6bc 100644 --- a/config/c-code/tests.yml.j2 +++ b/config/c-code/tests.yml.j2 @@ -105,7 +105,7 @@ jobs: # cffi will probably have no public release until a Python 3.13 beta # or even RC release, see https://github.com/python-cffi/cffi/issues/23 echo "cffi @ git+https://github.com/python-cffi/cffi.git@954cab4f889fb019a7f90df153ee1be501495f58" > cffi_constraint.txt - PIP_CONSTRAINT=cffi_constraint.txt pip install cffi + PIP_CONSTRAINT=$PWD/cffi_constraint.txt pip install cffi {% endif %} - name: Install Build Dependencies {% if with_future_python %} @@ -171,7 +171,7 @@ jobs: echo "cffi @ git+https://github.com/python-cffi/cffi.git@954cab4f889fb019a7f90df153ee1be501495f58" > cffi_constraint.txt # Use "--pre" here because dependencies with support for this future # Python release may only be available as pre-releases - PIP_CONSTRAINT=cffi_constraint.txt pip install --pre .[test] + PIP_CONSTRAINT=$PWD/cffi_constraint.txt pip install --pre .[test] {% endif %} - name: Install %(package_name)s and dependencies {% if with_future_python %} @@ -270,7 +270,7 @@ jobs: unzip -n dist/%(package_name)s-*whl -d src # Use "--pre" here because dependencies with support for this future # Python release may only be available as pre-releases - PIP_CONSTRAINT=cffi_constraint.txt pip install --pre -U -e .[test] + PIP_CONSTRAINT=$PWD/cffi_constraint.txt pip install --pre -U -e .[test] {% endif %} - name: Install %(package_name)s {% if with_future_python %} From 1351c95dde7eb7e990e3cb296d2f42120fd1624e Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Fri, 23 Feb 2024 08:44:13 +0100 Subject: [PATCH 39/43] Remove config which is the default nowadays. --- config/default/setup.cfg.j2 | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/default/setup.cfg.j2 b/config/default/setup.cfg.j2 index adc04a0..7d6a325 100644 --- a/config/default/setup.cfg.j2 +++ b/config/default/setup.cfg.j2 @@ -1,5 +1,3 @@ -[bdist_wheel] -universal = 0 {% if zest_releaser_options %} [zest.releaser] From f631b4806f524bd659be484081777d3c9a54815e Mon Sep 17 00:00:00 2001 From: Jens Vagelpohl Date: Fri, 22 Mar 2024 17:12:53 +0000 Subject: [PATCH 40/43] Use tomlkit for TOML read/write operations (#215) * small cleanups * clean up argparse defaults --------- Co-authored-by: Michael Howitz --- config/config-package.py | 17 +++-- config/drop-legacy-python.py | 5 +- config/meta-cfg-to-toml.py | 114 ---------------------------------- config/requirements.txt | 10 +-- config/shared/toml_encoder.py | 47 -------------- 5 files changed, 15 insertions(+), 178 deletions(-) delete mode 100644 config/meta-cfg-to-toml.py delete mode 100644 config/shared/toml_encoder.py diff --git a/config/config-package.py b/config/config-package.py index 0c3ec1e..e28ebaa 100755 --- a/config/config-package.py +++ b/config/config-package.py @@ -18,13 +18,12 @@ from shared.git import get_commit_id from shared.git import git_branch from shared.path import change_dir -from shared.toml_encoder import TomlArraySeparatorEncoderWithNewline import argparse import collections import jinja2 import pathlib import shutil -import toml +import tomlkit META_HINT = """\ @@ -67,13 +66,13 @@ def handle_command_line_arguments(): '--no-flake8', dest='use_flake8', action='store_false', - default=None, + default=True, help='Do not include flake8 and isort in the linting configuration.') parser.add_argument( '--with-appveyor', dest='with_appveyor', action='store_true', - default=None, + default=False, help='Activate running tests on AppVeyor, too, ' 'if not already configured in .meta.toml.') parser.add_argument( @@ -111,7 +110,7 @@ def handle_command_line_arguments(): '--with-sphinx', dest='with_docs', action='store_true', - default=None, + default=False, help='Activate building docs if not already configured in .meta.toml.') parser.add_argument( '--with-sphinx-doctests', @@ -178,7 +177,8 @@ def _read_meta_configuration(self): """Read and update meta configuration""" meta_toml_path = self.path / '.meta.toml' if meta_toml_path.exists(): - meta_cfg = toml.load(meta_toml_path) + with open(meta_toml_path, 'rb') as meta_f: + meta_cfg = tomlkit.load(meta_f) meta_cfg = collections.defaultdict(dict, **meta_cfg) else: meta_cfg = collections.defaultdict(dict) @@ -636,10 +636,7 @@ def configure(self): with open('.meta.toml', 'w') as meta_f: meta_f.write(META_HINT.format(config_type=self.config_type)) meta_f.write('\n') - toml.dump( - meta_cfg, meta_f, - TomlArraySeparatorEncoderWithNewline( - separator=',\n ', indent_first_line=True)) + tomlkit.dump(meta_cfg, meta_f) tox_path = shutil.which('tox') or ( pathlib.Path(cwd) / 'bin' / 'tox') diff --git a/config/drop-legacy-python.py b/config/drop-legacy-python.py index e24ac7a..50ab1de 100644 --- a/config/drop-legacy-python.py +++ b/config/drop-legacy-python.py @@ -22,7 +22,7 @@ import pathlib import shutil import sys -import toml +import tomlkit parser = argparse.ArgumentParser( @@ -56,7 +56,8 @@ with change_dir(path) as cwd_str: cwd = pathlib.Path(cwd_str) bin_dir = cwd / 'bin' - meta_cfg = collections.defaultdict(dict, **toml.load('.meta.toml')) + with open('.meta.toml', 'rb') as meta_f: + meta_cfg = collections.defaultdict(dict, **tomlkit.load(meta_f)) config_type = meta_cfg['meta']['template'] branch_name = get_branch_name(args.branch_name, config_type) updating = git_branch(branch_name) diff --git a/config/meta-cfg-to-toml.py b/config/meta-cfg-to-toml.py deleted file mode 100644 index 5d079f6..0000000 --- a/config/meta-cfg-to-toml.py +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/env python3 -############################################################################## -# -# Copyright (c) 2020 Zope Foundation and Contributors. -# -# This software is subject to the provisions of the Zope Public License, -# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. -# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED -# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS -# FOR A PARTICULAR PURPOSE. -# -############################################################################## -from configparser import ConfigParser -from shared.call import call -from shared.path import change_dir -from shared.toml_encoder import TomlArraySeparatorEncoderWithNewline -import argparse -import collections -import pathlib -import sys -import toml - - -parser = argparse.ArgumentParser( - description='Convert the .meta.cfg in a package to a .meta.toml.') -parser.add_argument( - 'path', type=pathlib.Path, help='path to the repository to be changed') -parser.add_argument( - '--no-push', - dest='no_push', - action='store_true', - help='Prevent direct push.') - - -args = parser.parse_args() -path = args.path -meta_cfg_path = path / '.meta.cfg' - -if not (path / '.git').exists(): - raise ValueError('`path` does not point to a git clone of a repository!') - -if not meta_cfg_path.exists(): - raise ValueError('`path` does have a `.meta.cfg`!') - - -src = ConfigParser() -src.read(meta_cfg_path) -src = src['meta'] - -dest = collections.defaultdict(dict) -dest['meta']['template'] = src['template'] -dest['meta']['commit-id'] = src['commit-id'] - -dest['python']['with-pypy'] = src.getboolean('with-pypy', False) -dest['python']['with-docs'] = src.getboolean('with-docs', False) -dest['python']['with-sphinx-doctests'] = src.getboolean( - 'with-sphinx-doctests', False) - -dest['coverage']['fail-under'] = int(src.setdefault('fail-under', 0)) - -flake8_config = src.get('additional-flake8-config', '').strip() -if flake8_config: - dest['flake8']['additional-config'] = flake8_config.splitlines() - -manifest_rules = src.get('additional-manifest-rules', '').strip() -if manifest_rules: - dest['manifest']['additional-rules'] = manifest_rules.splitlines() - -check_manifest = src.get('additional-check-manifest-ignores', '').strip() -if check_manifest: - dest['check-manifest']['additional-ignores'] = check_manifest.splitlines() - - -branch_name = 'covert.meta.cfg-to-.meta.toml' -with change_dir(path) as cwd: - with open('.meta.toml', 'w') as meta_f: - meta_f.write( - '# Generated from:\n' - '# https://github.com/zopefoundation/meta/tree/master/config/' - f'{src["template"]}\n') - toml.dump( - dest, meta_f, - TomlArraySeparatorEncoderWithNewline( - separator=',\n ', indent_first_line=True)) - - branches = call( - 'git', 'branch', '--format', '%(refname:short)', - capture_output=True).stdout.splitlines() - if branch_name in branches: - call('git', 'checkout', branch_name) - updating = True - else: - call('git', 'checkout', '-b', branch_name) - updating = False - call('git', 'rm', '.meta.cfg') - call('git', 'add', '.meta.toml') - call('git', 'commit', '-m', 'Switching from .meta.cfg to .meta.toml.') - config_package_args = [ - sys.executable, - 'config-package.py', - path, - f'--branch={branch_name}', - ] - if args.no_push: - config_package_args.append('--no-push') - call(*config_package_args, cwd=cwd) - print() - print('Created resp. updated branch', end='') - if args.no_push: - print(', but did not push upstream.') - else: - call('git', 'push', '--set-upstream', 'origin', branch_name) - print('and pushed upstream.') diff --git a/config/requirements.txt b/config/requirements.txt index d419f51..b0ec9b3 100644 --- a/config/requirements.txt +++ b/config/requirements.txt @@ -1,6 +1,6 @@ -check-python-versions==0.20.0 +check-python-versions==0.21.3 Jinja2==3.1.3 -pyupgrade==3.3.1 -toml==0.10.2 -tox==4.0.14 -zest.releaser==7.2.0 +pyupgrade==3.3.2 +tomlkit==0.12.1 +tox==4.8.0 +zest.releaser==8.0.0 diff --git a/config/shared/toml_encoder.py b/config/shared/toml_encoder.py deleted file mode 100644 index e84625f..0000000 --- a/config/shared/toml_encoder.py +++ /dev/null @@ -1,47 +0,0 @@ -############################################################################## -# -# Copyright (c) 2020 Zope Foundation and Contributors. -# -# This software is subject to the provisions of the Zope Public License, -# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. -# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED -# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS -# FOR A PARTICULAR PURPOSE. -# -############################################################################## -import toml - - -class TomlArraySeparatorEncoderWithNewline(toml.TomlArraySeparatorEncoder): - """Special version indenting the first element of and array. - - In https://github.com/zopefoundation/meta/issues/118 we suggest to switch - to Python 3.11 and its built-in toml support. We'll see if this path is - still needed then. - """ - - def __init__(self, _dict=dict, preserve=False, separator=",", - indent_first_line=False): - super(TomlArraySeparatorEncoderWithNewline, self).__init__( - _dict=_dict, preserve=preserve, separator=separator) - self.indent_first_line = indent_first_line - - def dump_list(self, v): - t = [] - retval = "[" - if self.indent_first_line: - retval += self.separator.strip(',') - for u in v: - t.append(self.dump_value(u)) - while t != []: - s = [] - for u in t: - if isinstance(u, list): - for r in u: - s.append(r) - else: - retval += " " + u + self.separator - t = s - retval += " ]" - return retval From 1404d28b278f55d6c380091a3ff9744a043e58f8 Mon Sep 17 00:00:00 2001 From: Jeremy Kolbe Date: Thu, 28 Mar 2024 07:27:03 +0100 Subject: [PATCH 41/43] #112 Add windows to github actions (#208) * Rip out appveyor. --------- Co-authored-by: Jens Vagelpohl Co-authored-by: Michael Howitz --- config/README.rst | 77 ----------------------------- config/buildout-recipe/packages.txt | 1 - config/c-code/appveyor-publish.j2 | 8 --- config/c-code/tests-cache.j2 | 25 ++++++++-- config/c-code/tests-strategy.j2 | 4 ++ config/c-code/tests.yml.j2 | 71 ++++++++++++++++++++++---- config/config-package.py | 55 ++------------------- config/default/MANIFEST.in.j2 | 3 -- config/default/appveyor.yml.j2 | 64 ------------------------ 9 files changed, 90 insertions(+), 218 deletions(-) delete mode 100644 config/c-code/appveyor-publish.j2 delete mode 100644 config/default/appveyor.yml.j2 diff --git a/config/README.rst b/config/README.rst index 436f2b7..b3e4723 100644 --- a/config/README.rst +++ b/config/README.rst @@ -157,9 +157,6 @@ The following options are only needed one time as their values are stored in Define the configuration type (see `Types`_ section above) to be used for the repository. ---with-appveyor - Enable running the tests on AppVeyor, too. - --with-macos Enable running the tests on macOS on GitHub Actions. @@ -204,7 +201,6 @@ updated. Example: commit-id = "< commit-hash >" [python] - with-appveyor = false with-pypy = false with-docs = true with-sphinx-doctests = false @@ -328,36 +324,6 @@ updated. Example: "tox -f ${{ matrix.config[1] }}", ] - [appveyor] - global-env-vars = [ - "ZOPE_INTERFACE_STRICT_IRO: 1", - ] - additional-matrix = [ - "- { PYTHON: 38, PURE_PYTHON: 1 }", - "- { PYTHON: 38-x64, PURE_PYTHON: 1 }", - ] - install-steps = [ - "- pip install zc.buildout", - "- buildout", - ] - build-script = [ - "- python -W ignore setup.py -q bdist_wheel", - ] - test-steps = [ - "- zope-testrunner --test-path=src", - "- jasmine", - ] - additional-lines = [ - "artifacts:", - " - path: 'dist\*.whl'", - " name: wheel", - ] - replacement = [ - "environment:", - " matrix:", - " ...", - ] - [c-code] manylinux-install-setup = [ "export CFLAGS=\"-pipe\"", @@ -402,9 +368,6 @@ commit-id Python options `````````````` -with-appveyor - Run the tests also on AppVeyor: true/false - with-macos Run the tests also on macOS on GitHub Actions: true/false, default: false @@ -636,46 +599,6 @@ test-commands This option has to be a list of strings. -AppVeyor options -```````````````` - -The corresponding section is named: ``[appveyor]``. - -global-env-vars - Environment variables to specify globally. This option has to be a list of - strings. - -additional-matrix - Additional environment matrix rows. This option has to be a list of strings, - each starting with a ``-`` (unless you know what you're doing). - -install-steps - Steps to install the package under test on AppVeyor. This option has to be a - list of strings. It defaults to ``["- pip install -U -e .[test]"]``. - -build-script - Steps to to build the project. If this option is not given because no - additional build steps are necessary ``build: false`` is rendered to the - AppVeyor configuration. But if the config type is ``c-code`` it defaults to - ``['- python -W ignore setup.py -q bdist_wheel']``. This option has to be a - list of strings, each one starting with a ``-``. - -test-steps - Steps to run the tests on AppVeyor. This option has to be a list of strings - , each one starting with a ``-``. It defaults to - ``["- zope-testrunner --test-path=src"]``. - -additional-lines - This option allows to add arbitrary additional lines to the end of the - configuration file. It has to be a list of strings. - -replacement - Replace the whole template of the AppVeyor configuration with the contents of - this option. Use this option as last resort if your needed changes are too - big to configure AppVeyor in another way. This option has to be a list of - strings. - - C-code options `````````````` diff --git a/config/buildout-recipe/packages.txt b/config/buildout-recipe/packages.txt index 18a73f4..a327657 100644 --- a/config/buildout-recipe/packages.txt +++ b/config/buildout-recipe/packages.txt @@ -9,7 +9,6 @@ z3c.recipe.i18n zc.recipe.cmmi zdaemon zc.recipe.filestorage -five.customerize z3c.recipe.compattest zc.relation zc.zodbrecipes diff --git a/config/c-code/appveyor-publish.j2 b/config/c-code/appveyor-publish.j2 deleted file mode 100644 index b5b2113..0000000 --- a/config/c-code/appveyor-publish.j2 +++ /dev/null @@ -1,8 +0,0 @@ -artifacts: - - path: 'dist\*.whl' - name: wheel - -deploy_script: - - ps: if ($env:APPVEYOR_REPO_TAG -eq $TRUE) { pip install twine; twine upload --skip-existing dist\*.whl } - -deploy: on diff --git a/config/c-code/tests-cache.j2 b/config/c-code/tests-cache.j2 index bbb0410..f19b1d2 100644 --- a/config/c-code/tests-cache.j2 +++ b/config/c-code/tests-cache.j2 @@ -10,15 +10,32 @@ # to save the cache. So it must come before the thing we want to use # the cache. ### - - name: Get pip cache dir - id: pip-cache + - name: Get pip cache dir (default) + id: pip-cache-default + if: ${{ !startsWith(runner.os, 'Windows') }} run: | echo "dir=$(pip cache dir)" >>$GITHUB_OUTPUT - - name: pip cache + - name: Get pip cache dir (Windows) + id: pip-cache-windows + if: ${{ startsWith(runner.os, 'Windows') }} + run: | + echo "dir=$(pip cache dir)" >> $Env:GITHUB_OUTPUT + + - name: pip cache (default) + uses: actions/cache@v4 + if: ${{ !startsWith(runner.os, 'Windows') }} + with: + path: ${{ steps.pip-cache-default.outputs.dir }} + key: %(cache_key)s + restore-keys: | + ${{ runner.os }}-pip- + + - name: pip cache (Windows) uses: actions/cache@v4 + if: ${{ startsWith(runner.os, 'Windows') }} with: - path: ${{ steps.pip-cache.outputs.dir }} + path: ${{ steps.pip-cache-windows.outputs.dir }} key: %(cache_key)s restore-keys: | ${{ runner.os }}-pip- diff --git a/config/c-code/tests-strategy.j2 b/config/c-code/tests-strategy.j2 index 8885aed..2a15505 100644 --- a/config/c-code/tests-strategy.j2 +++ b/config/c-code/tests-strategy.j2 @@ -14,7 +14,11 @@ {% if with_future_python %} - "%(future_python_version)s" {% endif %} +{% if with_windows %} + os: [ubuntu-20.04, macos-11, windows-latest] +{% else %} os: [ubuntu-20.04, macos-11] +{% endif %} {% if with_pypy or gha_additional_exclude %} exclude: {% endif %} diff --git a/config/c-code/tests.yml.j2 b/config/c-code/tests.yml.j2 index 2ada6bc..6d69525 100644 --- a/config/c-code/tests.yml.j2 +++ b/config/c-code/tests.yml.j2 @@ -97,8 +97,10 @@ jobs: {% include 'tests-cache.j2' %} {% if with_future_python %} - - name: Install Build Dependencies (%(future_python_version)s) - if: matrix.python-version == '%(future_python_version)s' + - name: Install Build Dependencies (%(future_python_version)s) - no Windows + if: > + matrix.python-version == '%(future_python_version)s' + && !startsWith(runner.os, 'Windows') run: | pip install -U pip pip install -U setuptools wheel twine @@ -106,6 +108,18 @@ jobs: # or even RC release, see https://github.com/python-cffi/cffi/issues/23 echo "cffi @ git+https://github.com/python-cffi/cffi.git@954cab4f889fb019a7f90df153ee1be501495f58" > cffi_constraint.txt PIP_CONSTRAINT=$PWD/cffi_constraint.txt pip install cffi + - name: Install Build Dependencies (%(future_python_version)s) - on Windows + if: > + matrix.python-version == '%(future_python_version)s' + && startsWith(runner.os, 'Windows') + run: | + # cffi will probably have no public release until a Python 3.13 beta + # or even RC release, see https://github.com/python-cffi/cffi/issues/23 + echo "cffi @ git+https://github.com/python-cffi/cffi.git@954cab4f889fb019a7f90df153ee1be501495f58" > cffi_constraint.txt + set PIP_CONSTRAINT=%cd%\cffi_constraint.txt + pip install cffi + pip install -U pip + pip install -U setuptools wheel twine {% endif %} - name: Install Build Dependencies {% if with_future_python %} @@ -162,8 +176,10 @@ jobs: {% endfor %} {% if with_future_python %} - - name: Install %(package_name)s and dependencies (%(future_python_version)s) - if: matrix.python-version == '%(future_python_version)s' + - name: Install %(package_name)s and dependencies (%(future_python_version)s) - no Windows + if: > + matrix.python-version == '%(future_python_version)s' + && !startsWith(runner.os, 'Windows') run: | # Install to collect dependencies into the (pip) cache. # cffi will probably have no public release until a Python 3.13 beta @@ -172,6 +188,19 @@ jobs: # Use "--pre" here because dependencies with support for this future # Python release may only be available as pre-releases PIP_CONSTRAINT=$PWD/cffi_constraint.txt pip install --pre .[test] + - name: Install %(package_name)s and dependencies (%(future_python_version)s) - on Windows + if: > + matrix.python-version == '%(future_python_version)s' + && startsWith(runner.os, 'Windows') + run: | + # Install to collect dependencies into the (pip) cache. + # cffi will probably have no public release until a Python 3.13 beta + # or even RC release, see https://github.com/python-cffi/cffi/issues/23 + echo "cffi @ git+https://github.com/python-cffi/cffi.git@954cab4f889fb019a7f90df153ee1be501495f58" > cffi_constraint.txt + # Use "--pre" here because dependencies with support for this future + # Python release may only be available as pre-releases + set PIP_CONSTRAINT=%cd%\cffi_constraint.txt + pip install --pre .[test] {% endif %} - name: Install %(package_name)s and dependencies {% if with_future_python %} @@ -254,8 +283,10 @@ jobs: {% endfor %} {% else %} {% if with_future_python %} - - name: Install %(package_name)s %(future_python_version)s - if: ${{ startsWith(matrix.python-version, '%(future_python_version)s') }} + - name: Install %(package_name)s %(future_python_version)s ${{ matrix.python-version }}- no Windows + if: > + matrix.python-version == '%(future_python_version)s' + && !startsWith(runner.os, 'Windows') run: | pip install -U wheel setuptools # cffi will probably have no public release until a beta or even RC @@ -271,6 +302,26 @@ jobs: # Use "--pre" here because dependencies with support for this future # Python release may only be available as pre-releases PIP_CONSTRAINT=$PWD/cffi_constraint.txt pip install --pre -U -e .[test] + - name: Install %(package_name)s %(future_python_version)s - on Windows + if: > + matrix.python-version == '%(future_python_version)s' + && startsWith(runner.os, 'Windows') + run: | + pip install -U wheel setuptools + # cffi will probably have no public release until a beta or even RC + # version of Python 3.13, see https://github.com/python-cffi/cffi/issues/23 + echo 'cffi @ git+https://github.com/python-cffi/cffi.git@954cab4f889fb019a7f90df153ee1be501495f58 ; platform_python_implementation == "CPython"' > cffi_constraint.txt + # coverage has 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/%(package_name)s-*whl -d src + # Use "--pre" here because dependencies with support for this future + # Python release may only be available as pre-releases + set PIP_CONSTRAINT=%cd%\cffi_constraint.txt + pip install --pre -U -e .[test] {% endif %} - name: Install %(package_name)s {% if with_future_python %} @@ -299,12 +350,14 @@ jobs: run: {% if gha_test_commands %} {% for line in gha_test_commands %} - PURE_PYTHON=1 %(line)s + %(line)s {% endfor %} {% else %} # coverage makes PyPy run about 3x slower! - PURE_PYTHON=1 python -m coverage run -p -m zope.testrunner --test-path=src --auto-color --auto-progress + python -m coverage run -p -m zope.testrunner --test-path=src --auto-color --auto-progress {% endif %} + env: + PURE_PYTHON: 1 - name: Report Coverage run: | coverage combine @@ -423,7 +476,7 @@ jobs: path: wheelhouse/*whl name: manylinux_${{ matrix.image }}_wheels.zip - name: Restore pip cache permissions - run: sudo chown -R $(whoami) ${{ steps.pip-cache.outputs.dir }} + run: sudo chown -R $(whoami) ${{ steps.pip-cache-default.outputs.dir }} - name: Publish package to PyPI uses: pypa/gh-action-pypi-publish@release/v1 if: > diff --git a/config/config-package.py b/config/config-package.py index e28ebaa..3251e97 100755 --- a/config/config-package.py +++ b/config/config-package.py @@ -68,13 +68,6 @@ def handle_command_line_arguments(): action='store_false', default=True, help='Do not include flake8 and isort in the linting configuration.') - parser.add_argument( - '--with-appveyor', - dest='with_appveyor', - action='store_true', - default=False, - help='Activate running tests on AppVeyor, too, ' - 'if not already configured in .meta.toml.') parser.add_argument( '--with-macos', dest='with_macos', @@ -185,10 +178,6 @@ def _read_meta_configuration(self): if self.args.with_docs is None: self.args.with_docs = (self.path / "docs" / "conf.py").exists() print(f"Autodetecting --with-docs: {self.args.with_docs}") - if self.args.with_appveyor is None: - value = (self.path / "appveyor.yml").exists() - self.args.with_appveyor = value - print(f"Autodetecting --with-appveyor: {value}") return meta_cfg @cached_property @@ -220,10 +209,6 @@ def jinja_env(self): lstrip_blocks=True, ) - @cached_property - def with_appveyor(self): - return self._set_python_config_value('appveyor') - @cached_property def with_macos(self): return self._set_python_config_value('macos') @@ -530,38 +515,7 @@ def manifest_in(self): self.copy_with_meta( 'MANIFEST.in.j2', self.path / 'MANIFEST.in', self.config_type, additional_rules=additional_manifest_rules, - with_docs=self.with_docs, with_appveyor=self.with_appveyor) - - def appveyor(self): - appveyor_global_env_vars = self.meta_cfg['appveyor'].get( - 'global-env-vars', []) - appveyor_additional_matrix = self.meta_cfg['appveyor'].get( - 'additional-matrix', []) - appveyor_install_steps = self.meta_cfg['appveyor'].get( - 'install-steps', ['- pip install -U -e .[test]']) - appveyor_build_script = self.meta_cfg['appveyor'].get( - 'build-script', []) - if self.config_type == 'c-code' and not appveyor_build_script: - appveyor_build_script = [ - '- python -W ignore setup.py -q bdist_wheel'] - appveyor_test_steps = self.meta_cfg['appveyor'].get( - 'test-steps', ['- zope-testrunner --test-path=src']) - appveyor_additional_lines = self.meta_cfg['appveyor'].get( - 'additional-lines', []) - appveyor_replacement = self.meta_cfg['appveyor'].get('replacement', []) - self.copy_with_meta( - 'appveyor.yml.j2', - self.path / 'appveyor.yml', - self.config_type, - with_future_python=self.with_future_python, - global_env_vars=appveyor_global_env_vars, - additional_matrix=appveyor_additional_matrix, - install_steps=appveyor_install_steps, - test_steps=appveyor_test_steps, - build_script=appveyor_build_script, - additional_lines=appveyor_additional_lines, - replacement=appveyor_replacement, - ) + with_docs=self.with_docs) def copy_with_meta( self, template_name, destination, config_type, @@ -613,9 +567,6 @@ def configure(self): self.tests_yml() self.manifest_in() - if self.with_appveyor: - self.appveyor() - with change_dir(self.path) as cwd: if pathlib.Path('bootstrap.py').exists(): call('git', 'rm', 'bootstrap.py') @@ -625,8 +576,8 @@ def configure(self): call('git', 'rm', '.coveragerc') if self.add_coveragerc and self.args.commit: call('git', 'add', '.coveragerc') - if self.with_appveyor and self.args.commit: - call('git', 'add', 'appveyor.yml') + if pathlib.Path('appveyor.yml').exists(): + call('git', 'rm', 'appveyor.yml') if self.with_docs and self.args.commit: call('git', 'add', '.readthedocs.yaml') if self.add_manylinux and self.args.commit: diff --git a/config/default/MANIFEST.in.j2 b/config/default/MANIFEST.in.j2 index 130577d..69c679a 100644 --- a/config/default/MANIFEST.in.j2 +++ b/config/default/MANIFEST.in.j2 @@ -3,9 +3,6 @@ include *.rst include *.txt include buildout.cfg include tox.ini -{% if with_appveyor %} -include appveyor.yml -{% endif %} {% if config_type in ('buildout-recipe', 'c-code') %} include .coveragerc {% endif %} diff --git a/config/default/appveyor.yml.j2 b/config/default/appveyor.yml.j2 deleted file mode 100644 index f6db6a6..0000000 --- a/config/default/appveyor.yml.j2 +++ /dev/null @@ -1,64 +0,0 @@ -{% if replacement %} -{% for line in replacement %} -%(line)s -{% endfor %} -{% else %} -environment: -{% for line in global_env_vars %} - %(line)s -{% endfor %} - - matrix: - - python: 37-x64 - - python: 38-x64 - - python: 39-x64 - - python: 310-x64 - - python: 311-x64 - - python: 312-x64 -{% if with_future_python %} - # `multibuild` cannot install non-final versions as they are not on - # ftp.python.org, so we skip Python 3.13 until its final release: - # - python: 313-x64 -{% endif %} -{% for line in additional_matrix %} - %(line)s -{% endfor %} - -install: - - "SET PYTHONVERSION=%PYTHON%" - - "SET PATH=C:\\Python%PYTHON%;c:\\Python%PYTHON%\\scripts;%PATH%" - - ps: | - $env:PYTHON = "C:\\Python${env:PYTHON}" - if (-not (Test-Path $env:PYTHON)) { - curl -o install_python.ps1 https://raw.githubusercontent.com/matthew-brett/multibuild/11a389d78892cf90addac8f69433d5e22bfa422a/install_python.ps1 - .\install_python.ps1 - } - - ps: if (-not (Test-Path $env:PYTHON)) { throw "No $env:PYTHON" } - - echo "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 > "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\vcvars64.bat" - - python -m pip install -U pip - - pip install -U setuptools wheel -{% for line in install_steps %} - %(line)s -{% endfor %} - -matrix: - fast_finish: true - -{% if build_script %} -build_script: - {% for line in build_script %} - %(line)s - {% endfor %} -{% else %} -build: false -{% endif %} - -test_script: -{% for line in test_steps %} - %(line)s -{% endfor %} -{% include 'appveyor-publish.j2' %} -{% for line in additional_lines %} -%(line)s -{% endfor %} -{% endif %} From 4b5b69cf30185a977e047d4d46d5e80147c9a5f5 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Thu, 4 Apr 2024 08:41:57 +0200 Subject: [PATCH 42/43] Drop special handling for not yet released cffi. (#234) It does not work and I spent too much time trying to get it working. So I gave up and decided to wait for a cffi release. --- config/c-code/tests.yml.j2 | 79 +++++--------------------------------- 1 file changed, 9 insertions(+), 70 deletions(-) diff --git a/config/c-code/tests.yml.j2 b/config/c-code/tests.yml.j2 index 6d69525..8e6422a 100644 --- a/config/c-code/tests.yml.j2 +++ b/config/c-code/tests.yml.j2 @@ -97,29 +97,11 @@ jobs: {% include 'tests-cache.j2' %} {% if with_future_python %} - - name: Install Build Dependencies (%(future_python_version)s) - no Windows - if: > - matrix.python-version == '%(future_python_version)s' - && !startsWith(runner.os, 'Windows') - run: | - pip install -U pip - pip install -U setuptools wheel twine - # cffi will probably have no public release until a Python 3.13 beta - # or even RC release, see https://github.com/python-cffi/cffi/issues/23 - echo "cffi @ git+https://github.com/python-cffi/cffi.git@954cab4f889fb019a7f90df153ee1be501495f58" > cffi_constraint.txt - PIP_CONSTRAINT=$PWD/cffi_constraint.txt pip install cffi - - name: Install Build Dependencies (%(future_python_version)s) - on Windows - if: > - matrix.python-version == '%(future_python_version)s' - && startsWith(runner.os, 'Windows') + - name: Install Build Dependencies (%(future_python_version)s) + if: matrix.python-version == '%(future_python_version)s' run: | - # cffi will probably have no public release until a Python 3.13 beta - # or even RC release, see https://github.com/python-cffi/cffi/issues/23 - echo "cffi @ git+https://github.com/python-cffi/cffi.git@954cab4f889fb019a7f90df153ee1be501495f58" > cffi_constraint.txt - set PIP_CONSTRAINT=%cd%\cffi_constraint.txt - pip install cffi pip install -U pip - pip install -U setuptools wheel twine + pip install -U setuptools wheel twine cffi {% endif %} - name: Install Build Dependencies {% if with_future_python %} @@ -176,30 +158,12 @@ jobs: {% endfor %} {% if with_future_python %} - - name: Install %(package_name)s and dependencies (%(future_python_version)s) - no Windows - if: > - matrix.python-version == '%(future_python_version)s' - && !startsWith(runner.os, 'Windows') + - name: Install %(package_name)s and dependencies (%(future_python_version)s) + if: matrix.python-version == '%(future_python_version)s' run: | # Install to collect dependencies into the (pip) cache. - # cffi will probably have no public release until a Python 3.13 beta - # or even RC release, see https://github.com/python-cffi/cffi/issues/23 - echo "cffi @ git+https://github.com/python-cffi/cffi.git@954cab4f889fb019a7f90df153ee1be501495f58" > cffi_constraint.txt # Use "--pre" here because dependencies with support for this future # Python release may only be available as pre-releases - PIP_CONSTRAINT=$PWD/cffi_constraint.txt pip install --pre .[test] - - name: Install %(package_name)s and dependencies (%(future_python_version)s) - on Windows - if: > - matrix.python-version == '%(future_python_version)s' - && startsWith(runner.os, 'Windows') - run: | - # Install to collect dependencies into the (pip) cache. - # cffi will probably have no public release until a Python 3.13 beta - # or even RC release, see https://github.com/python-cffi/cffi/issues/23 - echo "cffi @ git+https://github.com/python-cffi/cffi.git@954cab4f889fb019a7f90df153ee1be501495f58" > cffi_constraint.txt - # Use "--pre" here because dependencies with support for this future - # Python release may only be available as pre-releases - set PIP_CONSTRAINT=%cd%\cffi_constraint.txt pip install --pre .[test] {% endif %} - name: Install %(package_name)s and dependencies @@ -283,35 +247,11 @@ jobs: {% endfor %} {% else %} {% if with_future_python %} - - name: Install %(package_name)s %(future_python_version)s ${{ matrix.python-version }}- no Windows - if: > - matrix.python-version == '%(future_python_version)s' - && !startsWith(runner.os, 'Windows') - run: | - pip install -U wheel setuptools - # cffi will probably have no public release until a beta or even RC - # version of Python 3.13, see https://github.com/python-cffi/cffi/issues/23 - echo 'cffi @ git+https://github.com/python-cffi/cffi.git@954cab4f889fb019a7f90df153ee1be501495f58 ; platform_python_implementation == "CPython"' > cffi_constraint.txt - # coverage has 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/%(package_name)s-*whl -d src - # Use "--pre" here because dependencies with support for this future - # Python release may only be available as pre-releases - PIP_CONSTRAINT=$PWD/cffi_constraint.txt pip install --pre -U -e .[test] - - name: Install %(package_name)s %(future_python_version)s - on Windows - if: > - matrix.python-version == '%(future_python_version)s' - && startsWith(runner.os, 'Windows') + - name: Install %(package_name)s %(future_python_version)s ${{ matrix.python-version }} + if: matrix.python-version == '%(future_python_version)s' run: | pip install -U wheel setuptools - # cffi will probably have no public release until a beta or even RC - # version of Python 3.13, see https://github.com/python-cffi/cffi/issues/23 - echo 'cffi @ git+https://github.com/python-cffi/cffi.git@954cab4f889fb019a7f90df153ee1be501495f58 ; platform_python_implementation == "CPython"' > cffi_constraint.txt - # coverage has a wheel on PyPI for a future python version which is + # 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 @@ -320,8 +260,7 @@ jobs: unzip -n dist/%(package_name)s-*whl -d src # Use "--pre" here because dependencies with support for this future # Python release may only be available as pre-releases - set PIP_CONSTRAINT=%cd%\cffi_constraint.txt - pip install --pre -U -e .[test] + txt pip install --pre -U -e .[test] {% endif %} - name: Install %(package_name)s {% if with_future_python %} From 930b8787df4928021d7587d456a6d803b9bdae41 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Thu, 11 Apr 2024 09:15:06 +0200 Subject: [PATCH 43/43] Fix syntax --- config/c-code/tests.yml.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/c-code/tests.yml.j2 b/config/c-code/tests.yml.j2 index 8e6422a..5adadad 100644 --- a/config/c-code/tests.yml.j2 +++ b/config/c-code/tests.yml.j2 @@ -260,7 +260,7 @@ jobs: unzip -n dist/%(package_name)s-*whl -d src # Use "--pre" here because dependencies with support for this future # Python release may only be available as pre-releases - txt pip install --pre -U -e .[test] + pip install --pre -U -e .[test] {% endif %} - name: Install %(package_name)s {% if with_future_python %}