diff --git a/.editorconfig b/.editorconfig index 5b3c112..d054af1 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,5 +1,5 @@ # Generated from: -# https://github.com/plone/meta/tree/main/config/default +# https://github.com/plone/meta/tree/main/src/plone/meta/default # See the inline comments on how to expand/tweak this configuration file # # EditorConfig Configuration file, for more details see: diff --git a/.flake8 b/.flake8 index 38918f4..3e2d35f 100644 --- a/.flake8 +++ b/.flake8 @@ -1,5 +1,5 @@ # Generated from: -# https://github.com/plone/meta/tree/main/config/default +# https://github.com/plone/meta/tree/main/src/plone/meta/default # See the inline comments on how to expand/tweak this configuration file [flake8] doctests = 1 diff --git a/dependabot.yml b/.github/dependabot.yml similarity index 80% rename from dependabot.yml rename to .github/dependabot.yml index bbd3ab0..e5e4522 100644 --- a/dependabot.yml +++ b/.github/dependabot.yml @@ -1,5 +1,5 @@ # Generated from: -# https://github.com/plone/meta/tree/main/config/default +# https://github.com/plone/meta/tree/main/src/plone/meta/default # See the inline comments on how to expand/tweak this configuration file version: 2 updates: diff --git a/.github/workflows/bandit.yml b/.github/workflows/bandit.yml deleted file mode 100644 index 205180f..0000000 --- a/.github/workflows/bandit.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Security check - Bandit - -on: push - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Security check - Bandit - uses: ioggstream/bandit-report-artifacts@v0.0.2 - with: - project_path: src - ignore_failure: true - - # This is optional - - name: Security check report artifacts - uses: actions/upload-artifact@v1 - with: - name: Security report - path: output/security_report.txt - diff --git a/.github/workflows/meta.yml b/.github/workflows/meta.yml index c7f8566..f9a346f 100644 --- a/.github/workflows/meta.yml +++ b/.github/workflows/meta.yml @@ -1,5 +1,5 @@ # Generated from: -# https://github.com/plone/meta/tree/main/config/default +# https://github.com/plone/meta/tree/main/src/plone/meta/default # See the inline comments on how to expand/tweak this configuration file name: Meta on: @@ -25,20 +25,21 @@ on: jobs: qa: - uses: plone/meta/.github/workflows/qa.yml@main + uses: plone/meta/.github/workflows/qa.yml@2.x + coverage: + uses: plone/meta/.github/workflows/coverage.yml@2.x dependencies: - uses: plone/meta/.github/workflows/dependencies.yml@main + uses: plone/meta/.github/workflows/dependencies.yml@2.x release_ready: - uses: plone/meta/.github/workflows/release_ready.yml@main + uses: plone/meta/.github/workflows/release_ready.yml@2.x circular: - uses: plone/meta/.github/workflows/circular.yml@main + uses: plone/meta/.github/workflows/circular.yml@2.x ## # To modify the list of default jobs being created add in .meta.toml: # [github] # jobs = [ # "qa", -# "test", # "coverage", # "dependencies", # "release_ready", @@ -53,19 +54,6 @@ jobs: # os_dependencies = "git libxml2 libxslt" ## -## -# To test against a specific matrix of python versions -# when running tests jobs, add in .meta.toml: -# [github] -# py_versions = "['3.12', '3.11']" -## - - plonetests: - uses: collective/workflow-plonematrix/.github/workflows/plonetest-matrix.yml@main - codecov: - uses: collective/workflow-plonematrix/.github/workflows/codecov.yml@main - secrets: - codecov-token: ${{ secrets.CODECOV_TOKEN }} ## # Specify additional jobs in .meta.toml: diff --git a/.github/workflows/test-matrix.yml b/.github/workflows/test-matrix.yml new file mode 100644 index 0000000..9aa4ca0 --- /dev/null +++ b/.github/workflows/test-matrix.yml @@ -0,0 +1,73 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/src/plone/meta/default +# See the inline comments on how to expand/tweak this configuration file +name: Tests + +on: + push: + +jobs: + build: + permissions: + contents: read + pull-requests: write + strategy: + # We want to see all failures: + fail-fast: false + matrix: + os: + - ["ubuntu", "ubuntu-latest"] + config: + # [Python version, visual name, tox env] + - ["3.13", "6.2 on py3.13", "py313-plone62"] + - ["3.13", "6.1 on py3.13", "py313-plone61"] + - ["3.10", "6.0 on py3.10", "py310-plone60"] + + 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@v5 + with: + persist-credentials: false + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.config[0] }} + allow-prereleases: true + +## +# Add extra configuration options in .meta.toml: +# [github] +# extra_lines_after_os_dependencies = """ +# _your own configuration lines_ +# """ +## + - name: Pip cache + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('setup.*', 'tox.ini') }} + restore-keys: | + ${{ runner.os }}-pip-${{ matrix.config[0] }}- + ${{ runner.os }}-pip- + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox + - name: Initialize tox + # the bash one-liner below does not work on Windows + if: contains(matrix.os, 'ubuntu') + run: | + if [ `tox list --no-desc -f init|wc -l` = 1 ]; then tox -e init;else true; fi + - name: Test + run: tox -e ${{ matrix.config[2] }} + + +## +# Add extra configuration options in .meta.toml: +# [github] +# extra_lines = """ +# _your own configuration lines_ +# """ +## diff --git a/.gitignore b/.gitignore index d83d3ee..154c918 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # Generated from: -# https://github.com/plone/meta/tree/main/config/default +# https://github.com/plone/meta/tree/main/src/plone/meta/default # See the inline comments on how to expand/tweak this configuration file # python related *.egg-info @@ -20,6 +20,8 @@ __pycache__/ .tox .vscode/ node_modules/ +forest.dot +forest.json # venv / buildout related bin/ @@ -49,11 +51,9 @@ local.cfg report.html log.html output.xml -robot_log.html -robot_output.xml -robot_report.html -forest.dot -forest.json +/robot_* +/forest.* +/.mxdev_* ## # Add extra configuration options in .meta.toml: diff --git a/.meta.toml b/.meta.toml index 4370167..5590a42 100644 --- a/.meta.toml +++ b/.meta.toml @@ -1,49 +1,24 @@ # Generated from: -# https://github.com/plone/meta/tree/main/config/default +# https://github.com/plone/meta/tree/main/src/plone/meta/default # See the inline comments on how to expand/tweak this configuration file [meta] template = "default" -commit-id = "721299ce" +commit-id = "2.2.2" [gitignore] extra_lines = """ report.html log.html output.xml -robot_log.html -robot_output.xml -robot_report.html -forest.dot -forest.json +/robot_* +/forest.* +/.mxdev_* """ -[github] -jobs = [ - "qa", - "dependencies", - "release_ready", - "circular", - ] -extra_lines = """ - plonetests: - uses: collective/workflow-plonematrix/.github/workflows/plonetest-matrix.yml@main - codecov: - uses: collective/workflow-plonematrix/.github/workflows/codecov.yml@main - secrets: - codecov-token: ${{ secrets.CODECOV_TOKEN }} -""" [tox] -use_mxdev = true -config_lines = """ -[gh-actions] -python = - 3.8: py38 - 3.9: py39 - 3.10: py310 - 3.11: py311 - 3.12: py312 -""" +use_mxdev = false +test_matrix = {"6.2" = ["3.13"], "6.1" = ["3.13"], "6.0" = ["3.10"]} [pre_commit] i18ndude_extra_lines = """ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ac85b27..22c71a6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,5 @@ # Generated from: -# https://github.com/plone/meta/tree/main/config/default +# https://github.com/plone/meta/tree/main/src/plone/meta/default # See the inline comments on how to expand/tweak this configuration file ci: autofix_prs: false @@ -7,20 +7,20 @@ ci: repos: - repo: https://github.com/asottile/pyupgrade - rev: v3.15.2 + rev: v3.21.0 hooks: - id: pyupgrade args: [--py38-plus] - repo: https://github.com/pycqa/isort - rev: 5.13.2 + rev: 7.0.0 hooks: - id: isort -- repo: https://github.com/psf/black - rev: 24.4.2 +- repo: https://github.com/psf/black-pre-commit-mirror + rev: 25.9.0 hooks: - id: black - repo: https://github.com/collective/zpretty - rev: 3.1.0 + rev: 3.1.1 hooks: - id: zpretty @@ -32,7 +32,7 @@ repos: # """ ## - repo: https://github.com/PyCQA/flake8 - rev: 7.0.0 + rev: 7.3.0 hooks: - id: flake8 @@ -44,7 +44,7 @@ repos: # """ ## - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 + rev: v2.4.1 hooks: - id: codespell additional_dependencies: @@ -58,20 +58,20 @@ repos: # """ ## - repo: https://github.com/mgedmin/check-manifest - rev: "0.49" + rev: "0.51" hooks: - id: check-manifest - repo: https://github.com/regebro/pyroma - rev: "4.2" + rev: "5.0" hooks: - id: pyroma - repo: https://github.com/mgedmin/check-python-versions - rev: "0.22.0" + rev: "0.23.0" hooks: - id: check-python-versions args: ['--only', 'setup.py,pyproject.toml'] - repo: https://github.com/collective/i18ndude - rev: "6.2.0" + rev: "6.2.1" hooks: - id: i18ndude pass_filenames: false diff --git a/mx.ini b/mx.ini deleted file mode 100644 index cb84ae0..0000000 --- a/mx.ini +++ /dev/null @@ -1,5 +0,0 @@ -[settings] -main-package = -e .[test] - -version-overrides = - zope.testrunner==6.4 diff --git a/pyproject.toml b/pyproject.toml index 6e3b4dd..790c5c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,8 @@ # Generated from: -# https://github.com/plone/meta/tree/main/config/default +# https://github.com/plone/meta/tree/main/src/plone/meta/default # See the inline comments on how to expand/tweak this configuration file [build-system] -requires = ["setuptools>=68.2"] +requires = ["setuptools>=68.2,<80", "wheel"] [tool.towncrier] directory = "news/" @@ -39,7 +39,7 @@ showcontent = true [[tool.towncrier.type]] directory = "tests" -name = "Tests" +name = "Tests:" showcontent = true ## @@ -73,7 +73,7 @@ target-version = ["py38"] ## [tool.codespell] -ignore-words-list = "discreet," +ignore-words-list = "discreet,assertin,thet," skip = "*.po," ## # Add extra configuration options in .meta.toml: @@ -121,6 +121,7 @@ Zope = [ 'Products.CMFCore', 'Products.CMFDynamicViewFTI', ] python-dateutil = ['dateutil'] +pytest-plone = ['pytest', 'zope.pytestlayer', 'plone.testing', 'plone.app.testing'] ignore-packages = ['iw.rejectanonymous'] ## diff --git a/requirements.txt b/requirements.txt index 38396bb..da44320 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1 @@ -c constraints.txt -setuptools - diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index e69de29..0000000 diff --git a/tox.ini b/tox.ini index d172b44..e218744 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ # Generated from: -# https://github.com/plone/meta/tree/main/config/default +# https://github.com/plone/meta/tree/main/src/plone/meta/default # See the inline comments on how to expand/tweak this configuration file [tox] # We need 4.4.0 for constrain_package_deps. @@ -7,19 +7,20 @@ min_version = 4.4.0 envlist = lint test + py313-plone62 + py313-plone61 + py310-plone60 dependencies -[gh-actions] -python = - 3.8: py38 - 3.9: py39 - 3.10: py310 - 3.11: py311 - 3.12: py312 ## # Add extra configuration options in .meta.toml: +# - to specify a custom testing combination of Plone and python versions, use `test_matrix` +# Use ["*"] to use all supported Python versions for this Plone version. +# - to specify extra custom environments, use `envlist_lines` +# - to specify extra `tox` top-level options, use `config_lines` # [tox] +# test_matrix = {"6.2" = ["3.13", "3.12"], "6.1" = ["*"]} # envlist_lines = """ # my_other_environment # """ @@ -28,34 +29,13 @@ python = # """ ## -[testenv] -skip_install = true -allowlist_externals = - echo - false -# Make sure typos like `tox -e formaat` are caught instead of silently doing nothing. -# See https://github.com/tox-dev/tox/issues/2858. -commands = - echo "Unrecognized environment name {envname}" - false - -## -# Add extra configuration options in .meta.toml: -# [tox] -# testenv_options = """ -# basepython = /usr/bin/python3.8 -# """ -## - [testenv:init] description = Prepare environment skip_install = true -deps = - mxdev +allowlist_externals = + echo commands = - mxdev -c mx.ini - echo "Initial setup for mxdev" - + echo "Initial setup complete" [testenv:format] description = automatically reformat code @@ -97,11 +77,24 @@ deps = commands = sh -c 'pipdeptree --exclude setuptools,wheel,pipdeptree,zope.interface,zope.component --graph-output svg > dependencies.svg' -[testenv:test] -description = run the distribution tests + +[test_runner] +deps = zope.testrunner +test = + rfbrowser init + zope-testrunner --all --test-path={toxinidir}/src -s pas.plugins.tfa {posargs} +coverage = + rfbrowser init + coverage run --branch --source pas.plugins.tfa {envbindir}/zope-testrunner --quiet --all --test-path={toxinidir}/src -s pas.plugins.tfa {posargs} + coverage report -m --format markdown + coverage xml + coverage html + +[base] +description = shared configuration for tests and coverage use_develop = true skip_install = false -constrain_package_deps = false +constrain_package_deps = true set_env = ROBOT_BROWSER=headlesschrome @@ -114,27 +107,29 @@ set_env = # # Set constrain_package_deps .meta.toml: # [tox] -# constrain_package_deps = "false" +# constrain_package_deps = false ## deps = - zope.testrunner - -c constraints-mxdev.txt + {[test_runner]deps} + plone62: -c https://dist.plone.org/release/6.2-dev/constraints.txt + plone61: -c https://dist.plone.org/release/6.1-dev/constraints.txt + plone60: -c https://dist.plone.org/release/6.0-dev/constraints.txt ## # Specify additional deps in .meta.toml: # [tox] -# test_deps_additional = "-esources/plonegovbr.portal_base[test]" +# test_deps_additional = """ +# -esources/plonegovbr.portal_base[test] +# """ # # Specify a custom constraints file in .meta.toml: # [tox] # constraints_file = "https://my-server.com/constraints.txt" ## -commands = - rfbrowser init - zope-testrunner --all --test-path={toxinidir}/src -s pas.plugins.tfa {posargs} extras = test + ## # Add extra configuration options in .meta.toml: # [tox] @@ -142,36 +137,52 @@ extras = # tests # widgets # """ +# +# Add extra configuration options in .meta.toml: +# [tox] +# testenv_options = """ +# basepython = /usr/bin/python3.8 +# """ ## +[testenv:test] +description = run the distribution tests +use_develop = {[base]use_develop} +skip_install = {[base]skip_install} +constrain_package_deps = {[base]constrain_package_deps} +set_env = {[base]set_env} +deps = + {[test_runner]deps} + -c https://dist.plone.org/release/6.2-dev/constraints.txt + +commands = {[test_runner]test} +extras = {[base]extras} + + +[testenv] +description = run the distribution tests (generative environments) +use_develop = {[base]use_develop} +skip_install = {[base]skip_install} +constrain_package_deps = {[base]constrain_package_deps} +set_env = {[base]set_env} +deps = {[base]deps} +commands = {[test_runner]test} +extras = {[base]extras} + + [testenv:coverage] description = get a test coverage report -use_develop = true -skip_install = false -constrain_package_deps = false -set_env = - ROBOT_BROWSER=headlesschrome - -## -# Specify extra test environment variables in .meta.toml: -# [tox] -# test_environment_variables = """ -# PIP_EXTRA_INDEX_URL=https://my-pypi.my-server.com/ -# """ -## +use_develop = {[base]use_develop} +skip_install = {[base]skip_install} +constrain_package_deps = {[base]constrain_package_deps} +set_env = {[base]set_env} deps = + {[test_runner]deps} coverage - zope.testrunner - -c constraints-mxdev.txt + -c https://dist.plone.org/release/6.2-dev/constraints.txt -commands = - rfbrowser init - coverage run --branch --source pas.plugins.tfa {envbindir}/zope-testrunner --quiet --all --test-path={toxinidir}/src -s pas.plugins.tfa {posargs} - coverage report -m --format markdown - coverage xml - coverage html -extras = - test +commands = {[test_runner]coverage} +extras = {[base]extras} [testenv:release-check] @@ -181,8 +192,7 @@ deps = twine build towncrier - -c constraints-mxdev.txt - + -c https://dist.plone.org/release/6.2-dev/constraints.txt commands = # fake version to not have to install the package # we build the change log as news entries might break @@ -212,8 +222,7 @@ allowlist_externals = deps = pipdeptree pipforester - -c constraints-mxdev.txt - + -c https://dist.plone.org/release/6.2-dev/constraints.txt commands = # Generate the full dependency tree sh -c 'pipdeptree -j > forest.json'