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/.pre-commit-config.yaml b/.pre-commit-config.yaml index 312d099..318910e 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] + additional_dependencies: [flake8-typing-imports==1.15.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.*] 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/README.rst b/config/README.rst index 620dfd2..b3e4723 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.) @@ -152,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. @@ -170,7 +172,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. @@ -197,7 +201,6 @@ updated. Example: commit-id = "< commit-hash >" [python] - with-appveyor = false with-pypy = false with-docs = true with-sphinx-doctests = false @@ -264,6 +267,9 @@ updated. Example: " src/foo/bar.py: E221 E222", "extend-ignore = D203, W503", ] + additional-plugins = [ + "mccabe", + ] additional-sources = "testproj foo bar.py" [manifest] @@ -296,8 +302,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\"", @@ -318,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\"", @@ -370,6 +346,12 @@ updated. Example: "*.mo", ] + [readthedocs] + build-extra = [ + "apt_packages:", + " - libldap2-dev", + ] + Meta Options ```````````` @@ -386,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 @@ -509,6 +488,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. + This option is 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 @@ -616,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 `````````````` @@ -681,7 +624,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 ``````````` @@ -691,6 +633,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/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/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/tests-cache.j2 b/config/c-code/tests-cache.j2 index d475fd4..f19b1d2 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 }} ### @@ -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 - uses: actions/cache@v3 + - 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-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 8d4ede1..2a15505 100644 --- a/config/c-code/tests-strategy.j2 +++ b/config/c-code/tests-strategy.j2 @@ -3,23 +3,28 @@ matrix: python-version: {% if with_pypy %} - - "pypy-3.9" + - "pypy-3.10" {% endif %} - "3.7" - "3.8" - "3.9" - "3.10" - "3.11" + - "3.12" {% 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 %} {% 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 c0e378e..b32b65b 100644 --- a/config/c-code/tests.yml.j2 +++ b/config/c-code/tests.yml.j2 @@ -96,7 +96,17 @@ 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 +{% 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 @@ -182,7 +192,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 @@ -237,11 +247,11 @@ 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 }} + if: matrix.python-version == '%(future_python_version)s' run: | pip install -U wheel setuptools - # 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 @@ -279,12 +289,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 @@ -398,12 +410,12 @@ 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 - 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/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 34ba0d9..1e0a4f8 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 @@ -7,13 +19,12 @@ from shared.git import git_branch from shared.packages import MANYLINUX_PYTHON_VERSION 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 = """\ @@ -24,7 +35,7 @@ Generated from: https://github.com/zopefoundation/meta/tree/master/config/{config_type} --> """ -FUTURE_PYTHON_VERSION = "3.12.0-rc.3" +FUTURE_PYTHON_VERSION = "3.13.0-alpha - 3.13.0" DEFAULT = object() @@ -56,15 +67,8 @@ 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, - help='Activate running tests on AppVeyor, too, ' - 'if not already configured in .meta.toml.') parser.add_argument( '--with-macos', dest='with_macos', @@ -100,7 +104,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', @@ -167,17 +171,14 @@ 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) 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 @@ -209,10 +210,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') @@ -330,9 +327,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): @@ -417,6 +418,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: @@ -448,6 +451,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, @@ -513,38 +517,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, @@ -587,7 +560,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() @@ -595,9 +569,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') @@ -605,23 +576,20 @@ 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: - call('git', 'add', 'appveyor.yml') - if self.with_docs: + 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: + 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} 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/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 5c32846..0000000 --- a/config/default/appveyor.yml.j2 +++ /dev/null @@ -1,63 +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 -{% 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 -{% 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 %} 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: 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] diff --git a/config/default/tests.yml.j2 b/config/default/tests.yml.j2 index 0511a07..92dd6a6 100644 --- a/config/default/tests.yml.j2 +++ b/config/default/tests.yml.j2 @@ -35,17 +35,19 @@ jobs: {% endif %} config: # [Python version, tox env] + - ["3.9", "release-check"] - ["3.9", "lint"] - ["3.7", "py37"] - ["3.8", "py38"] - ["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"] + - ["pypy-3.10", "pypy3"] {% endif %} {% if with_docs %} - ["3.9", "docs"] @@ -60,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"] } @@ -67,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"] } @@ -75,7 +79,10 @@ 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"] } + {% if with_future_python %} + - { os: ["macos", "macos-11"], config: ["%(future_python_version)s", "py313"] } + {% endif %} {% endif %} {% for line in gha_additional_exclude %} %(line)s @@ -92,13 +99,13 @@ 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 - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('setup.*', 'tox.ini') }} diff --git a/config/default/tox-envlist.j2 b/config/default/tox-envlist.j2 index 460cfef..199cb60 100644 --- a/config/default/tox-envlist.j2 +++ b/config/default/tox-envlist.j2 @@ -1,14 +1,16 @@ [tox] minversion = 3.18 envlist = + release-check lint py37 py38 py39 py310 py311 -{% if with_future_python %} py312 +{% if with_future_python %} + py313 {% endif %} {% if with_pypy %} pypy3 diff --git a/config/default/tox-lint.j2 b/config/default/tox-lint.j2 index 519edd8..bdd6ec5 100644 --- a/config/default/tox-lint.j2 +++ b/config/default/tox-lint.j2 @@ -1,21 +1,21 @@ +{% include 'tox-release-check.j2' %} [testenv:lint] basepython = python3 skip_install = true -commands = +deps = + isort {% if use_flake8 %} + flake8 +{% for line in flake8_additional_plugins %} + %(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 %} - check-manifest - check-python-versions -deps = - check-manifest - check-python-versions >= 0.19.1 - wheel -{% if use_flake8 %} - flake8 - isort [testenv:isort-apply] basepython = python3 @@ -25,4 +25,3 @@ deps = isort commands = isort {toxinidir}/src {toxinidir}/setup.py%(isort_additional_sources)s [] -{% endif %} diff --git a/config/default/tox-release-check.j2 b/config/default/tox-release-check.j2 new file mode 100644 index 0000000..db35b26 --- /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 --only setup.py,tox.ini,.github/workflows/tests.yml + python -m build --sdist --no-isolation + twine check dist/* 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/drop-legacy-python.py b/config/drop-legacy-python.py index aec2cc6..50ab1de 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 @@ -10,7 +22,7 @@ import pathlib import shutil import sys -import toml +import tomlkit parser = argparse.ArgumentParser( @@ -44,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 1955b32..0000000 --- a/config/meta-cfg-to-toml.py +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/env python3 -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/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/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 diff --git a/config/re-enable-actions.py b/config/re-enable-actions.py index 4905108..fadc763 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 ALL_REPOS from shared.packages import ORG diff --git a/config/requirements.txt b/config/requirements.txt index b9270b7..729bc69 100644 --- a/config/requirements.txt +++ b/config/requirements.txt @@ -1,7 +1,7 @@ -check-python-versions==0.20.0 -Jinja2==3.1.2 -pyupgrade==3.3.1 -toml==0.10.2 -tox==4.0.14 -zest.releaser==7.2.0 +check-python-versions==0.21.3 +Jinja2==3.1.3 +pyupgrade==3.3.2 +tomlkit==0.12.1 +tox==4.8.0 requests==2.31.0 +zest.releaser==8.0.0 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 6416f78..b87fda1 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 itertools 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 deleted file mode 100644 index a75b72c..0000000 --- a/config/shared/toml_encoder.py +++ /dev/null @@ -1,35 +0,0 @@ -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 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 diff --git a/config/toolkit/tox.ini.j2 b/config/toolkit/tox.ini.j2 index d90dd62..6ea08e7 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 %} @@ -56,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 577d28a..1158711 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 %} @@ -33,11 +31,12 @@ commands = %(line)s {% endfor %} {% else %} - {envdir}/bin/test {posargs:-cv} + {envbindir}/test {posargs:-cv} {% endif %} {% for line in testenv_additional %} %(line)s {% endfor %} +{% include 'tox-release-check.j2' %} [testenv:lint] basepython = python3 @@ -52,11 +51,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 @@ -97,7 +92,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