From f16fa11187fb71749c68063d76cedcac9e663b05 Mon Sep 17 00:00:00 2001 From: Alexander Loechel Date: Sat, 7 Oct 2023 12:55:03 +0200 Subject: [PATCH 01/34] 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 02/34] 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 03/34] 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 04/34] 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 05/34] 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 06/34] 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 07/34] 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 08/34] - 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 09/34] - 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 10/34] 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 11/34] - 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 12/34] - 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 13/34] - 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 14/34] - 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 15/34] - 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 16/34] 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 17/34] 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 18/34] 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 19/34] 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 20/34] 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 21/34] 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 22/34] 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 23/34] 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 24/34] 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 25/34] 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 26/34] 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 27/34] 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 28/34] 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 29/34] 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 30/34] 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 31/34] 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 32/34] 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 33/34] 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 34/34] 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