From 2d511103b2a68a4478bbd873b77d96542c60ee74 Mon Sep 17 00:00:00 2001 From: Jens Vagelpohl Date: Fri, 31 Jan 2025 07:26:02 +0100 Subject: [PATCH] - drop support for Python 3.8, add support for Python 3.13 --- .github/workflows/pre-commit.yml | 36 +++++++++++ .github/workflows/tests.yml | 21 ++++--- .meta.toml | 2 +- .pre-commit-config.yaml | 28 +++++++++ CHANGES.rst | 4 +- CONTRIBUTING.md | 2 +- MANIFEST.in | 1 + pyproject.toml | 21 +++++++ setup.py | 6 +- .../MailHost/tests/test_exportimport.py | 4 +- tox.ini | 63 ++++++------------- 11 files changed, 127 insertions(+), 61 deletions(-) create mode 100644 .github/workflows/pre-commit.yml create mode 100644 .pre-commit-config.yaml create mode 100644 pyproject.toml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..19e7eb4 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,36 @@ +# Generated from: +# https://github.com/zopefoundation/meta/tree/master/config/zope-product +name: pre-commit + +on: + pull_request: + push: + branches: + - master + # Allow to run this workflow manually from the Actions tab + workflow_dispatch: + +env: + FORCE_COLOR: 1 + +jobs: + pre-commit: + permissions: + contents: read + pull-requests: write + name: linting + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd #v3.0.1 + with: + extra_args: --all-files --show-diff-on-failure + env: + PRE_COMMIT_COLOR: always + - uses: pre-commit-ci/lite-action@5d6cc0eb514c891a40562a58a8e71576c5c7fb43 #v1.1.0 + if: always() + with: + msg: Apply pre-commit code formatting diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2e30321..f0d7728 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,6 +12,9 @@ on: jobs: build: + permissions: + contents: read + pull-requests: write strategy: # We want to see all failures: fail-fast: false @@ -20,24 +23,26 @@ jobs: - ["ubuntu", "ubuntu-latest"] config: # [Python version, tox env] - - ["3.11", "release-check"] - - ["3.11", "lint"] - - ["3.8", "py38"] - - ["3.9", "py39"] - - ["3.10", "py310"] - - ["3.11", "py311"] - - ["3.12", "py312"] - - ["3.11", "coverage"] + - ["3.11", "release-check"] + - ["3.9", "py39"] + - ["3.10", "py310"] + - ["3.11", "py311"] + - ["3.12", "py312"] + - ["3.13", "py313"] + - ["3.11", "coverage"] runs-on: ${{ matrix.os[1] }} if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name name: ${{ matrix.config[1] }} steps: - uses: actions/checkout@v4 + with: + persist-credentials: false - name: Set up Python uses: actions/setup-python@v5 with: python-version: ${{ matrix.config[0] }} + allow-prereleases: true - name: Pip cache uses: actions/cache@v4 with: diff --git a/.meta.toml b/.meta.toml index 86ee2b6..eb28a54 100644 --- a/.meta.toml +++ b/.meta.toml @@ -2,7 +2,7 @@ # https://github.com/zopefoundation/meta/tree/master/config/zope-product [meta] template = "zope-product" -commit-id = "b1221c3c" +commit-id = "0754ed06" [python] with-pypy = false diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..748b80f --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,28 @@ +# Generated from: +# https://github.com/zopefoundation/meta/tree/master/config/zope-product +minimum_pre_commit_version: '3.6' +repos: + - repo: https://github.com/pycqa/isort + rev: "5.13.2" + hooks: + - id: isort + - repo: https://github.com/hhatto/autopep8 + rev: "v2.3.2" + hooks: + - id: autopep8 + args: [--in-place, --aggressive, --aggressive] + - repo: https://github.com/asottile/pyupgrade + rev: v3.19.1 + hooks: + - id: pyupgrade + args: [--py39-plus] + - repo: https://github.com/isidentical/teyit + rev: 0.4.3 + hooks: + - id: teyit + - repo: https://github.com/PyCQA/flake8 + rev: "7.1.1" + hooks: + - id: flake8 + additional_dependencies: + - flake8-debugger == 4.1.2 diff --git a/CHANGES.rst b/CHANGES.rst index 4d9b9bd..9bdfd00 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,9 @@ Changelog 6.0 (unreleased) ---------------- -- Drop support for Python 3.7. +- Drop support for Python 3.7, 3.8. + +- Add support for Python 3.13. - Add support to `implicit_tls` flag. With this flag set, MailHost use TLS from the beginning of the connection, diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b5c34d4..ce446a6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,7 +1,7 @@ +--> # Contributing to zopefoundation projects The projects under the zopefoundation GitHub organization are open source and diff --git a/MANIFEST.in b/MANIFEST.in index f98ea17..957b787 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -5,6 +5,7 @@ include *.rst include *.txt include buildout.cfg include tox.ini +include .pre-commit-config.yaml recursive-include src *.py recursive-include src *.dtml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..c6289c3 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,21 @@ +# +# Generated from: +# https://github.com/zopefoundation/meta/tree/master/config/zope-product + +[build-system] +requires = ["setuptools <= 75.6.0"] +build-backend = "setuptools.build_meta" + +[tool.coverage.run] +branch = true +source = ["Products.MailHost"] + +[tool.coverage.report] +fail_under = 83 +precision = 2 +ignore_errors = true +show_missing = true +exclude_lines = ["pragma: no cover", "pragma: nocover", "except ImportError:", "raise NotImplementedError", "if __name__ == '__main__':", "self.fail", "raise AssertionError", "raise unittest.Skip"] + +[tool.coverage.html] +directory = "parts/htmlcov" diff --git a/setup.py b/setup.py index 7cc4c67..cbba98c 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ def _read(fname): '/Products.MailHost/issues'), 'Sources': 'https://github.com/zopefoundation/Products.MailHost', }, - license='ZPL 2.1', + license='ZPL-2.1', description='zope.sendmail integration for Zope.', author='Zope Foundation and Contributors', author_email='zope-dev@zope.dev', @@ -47,15 +47,15 @@ def _read(fname): 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13', 'Programming Language :: Python :: Implementation :: CPython', 'Topic :: Communications :: Email', ], - python_requires='>=3.8', + python_requires='>=3.9', install_requires=[ 'setuptools', 'AccessControl', diff --git a/src/Products/MailHost/tests/test_exportimport.py b/src/Products/MailHost/tests/test_exportimport.py index a05fd14..cb48a19 100644 --- a/src/Products/MailHost/tests/test_exportimport.py +++ b/src/Products/MailHost/tests/test_exportimport.py @@ -74,8 +74,8 @@ def setUp(self): class MailHostXMLAdapterTestsWithoutQueue(MailHostXMLAdapterTests): def _verifyImport(self, obj): - self.assertFalse('smtp_queue' in obj.__dict__) - self.assertFalse('smtp_queue_directory' in obj.__dict__) + self.assertNotIn('smtp_queue', obj.__dict__) + self.assertNotIn('smtp_queue_directory', obj.__dict__) def setUp(self): from Products.MailHost.MailHost import MailHost diff --git a/tox.ini b/tox.ini index eedd8b3..4a3f998 100644 --- a/tox.ini +++ b/tox.ini @@ -5,33 +5,40 @@ minversion = 3.18 envlist = release-check lint - py38 py39 py310 py311 py312 + py313 coverage [testenv] skip_install = true deps = - setuptools < 69 - zc.buildout >= 3.0.1 + setuptools <= 75.6.0 + zc.buildout >= 3.1 wheel > 0.37 setenv = - py312: VIRTUALENV_PIP=23.1.2 - py312: PIP_REQUIRE_VIRTUALENV=0 commands_pre = {envbindir}/buildout -nc {toxinidir}/buildout.cfg buildout:directory={envdir} buildout:develop={toxinidir} install test test_with_gs commands = {envbindir}/test {posargs:-cv} {envbindir}/test_with_gs {posargs:-cv} +[testenv:setuptools-latest] +basepython = python3 +deps = + git+https://github.com/pypa/setuptools.git\#egg=setuptools + zc.buildout >= 3.1 + wheel > 0.37 + + [testenv:release-check] description = ensure that the distribution is ready to release basepython = python3 skip_install = true deps = + setuptools <= 75.6.0 twine build check-manifest @@ -45,29 +52,14 @@ commands = twine check dist/* [testenv:lint] +description = This env runs all linters configured in .pre-commit-config.yaml basepython = python3 -commands_pre = - mkdir -p {toxinidir}/parts/flake8 -allowlist_externals = - mkdir -commands = - isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py - flake8 {toxinidir}/src {toxinidir}/setup.py +skip_install = true deps = - flake8 - isort - # Useful flake8 plugins that are Python and Plone specific: - flake8-coding - flake8-debugger - mccabe - -[testenv:isort-apply] -basepython = python3 + pre-commit commands_pre = -deps = - isort commands = - isort {toxinidir}/src {toxinidir}/setup.py [] + pre-commit run --all-files --show-diff-on-failure [testenv:coverage] basepython = python3 @@ -77,28 +69,9 @@ allowlist_externals = mkdir deps = {[testenv]deps} - coverage + coverage[toml] commands = mkdir -p {toxinidir}/parts/htmlcov coverage run {envbindir}/test_with_gs {posargs:-cv} coverage html - coverage report -m --fail-under=83 - -[coverage:run] -branch = True -source = Products.MailHost - -[coverage:report] -precision = 2 -ignore_errors = True -exclude_lines = - pragma: no cover - pragma: nocover - except ImportError: - raise NotImplementedError - if __name__ == '__main__': - self.fail - raise AssertionError - -[coverage:html] -directory = parts/htmlcov + coverage report