diff --git a/.editorconfig b/.editorconfig index 5b3c112c..d054af15 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 38918f42..3e2d35f9 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 bbd3ab05..e5e4522d 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/meta.yml b/.github/workflows/meta.yml index 064618d8..f9a346ff 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,22 +25,21 @@ on: jobs: qa: - uses: plone/meta/.github/workflows/qa.yml@main - test: - uses: plone/meta/.github/workflows/test.yml@main + uses: plone/meta/.github/workflows/qa.yml@2.x coverage: - uses: plone/meta/.github/workflows/coverage.yml@main + 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@2.x ## # To modify the list of default jobs being created add in .meta.toml: # [github] # jobs = [ # "qa", -# "test", # "coverage", # "dependencies", # "release_ready", diff --git a/.github/workflows/plone_python.yml b/.github/workflows/plone_python.yml deleted file mode 100644 index d68b640b..00000000 --- a/.github/workflows/plone_python.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Plone backend tests - -on: - push: - branches: - - master - - main - pull_request: - branches: - - master - - main - -jobs: - plone_python: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: ["3.9", "3.10", "3.11"] - plone-version: ["6.0"] - - steps: - - uses: actions/checkout@v4 - - name: Install system libraries - run: | - sudo apt-get update - sudo apt-get install libxml2-dev libxslt1-dev libjpeg-dev - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install tox tox-gh-actions - - name: Test with tox - run: tox - env: - PLONE: ${{ matrix.plone-version }} diff --git a/.github/workflows/test-matrix.yml b/.github/workflows/test-matrix.yml new file mode 100644 index 00000000..8596af24 --- /dev/null +++ b/.github/workflows/test-matrix.yml @@ -0,0 +1,72 @@ +# 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.10", "6.2 on py3.10", "py310-plone62"] + + 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 0fc9fba1..a602abea 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 @@ -11,7 +11,6 @@ # tools related build/ -_build/ .coverage .*project coverage.xml @@ -19,7 +18,10 @@ dist/ docs/_build __pycache__/ .tox +.vscode/ node_modules/ +forest.dot +forest.json # venv / buildout related bin/ diff --git a/.meta.toml b/.meta.toml index 24bc2c57..d33e21f1 100644 --- a/.meta.toml +++ b/.meta.toml @@ -1,9 +1,9 @@ # 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 = "1c2155e4" +commit-id = "2.2.2" [pre_commit] codespell_extra_lines = """ @@ -16,8 +16,7 @@ check_manifest_ignores = """ "*.cfg", ".editorconfig", ".readthedocs.yaml", - "constraints_plone52.txt", - "constraints_plone60.txt", + "constraints_plone62.txt", "constraints.txt", "fix-converted-myst.py", "Makefile", @@ -25,58 +24,19 @@ check_manifest_ignores = """ "requirements.txt", """ dependencies_ignores = "['Products.PrintingMailHost', 'plone.app.iterate',]" -codespell_ignores = "manuel" +codespell_ignores = "manuel,checkin" [tox] +test_matrix = {"6.2" = ["*"]} envlist_lines = """ - py{38,39,310,311}-plone{60} linkcheck plone6docs docs """ config_lines = """ skip_missing_interpreters = True - -[gh-actions] -python = - 3.8: py38 - 3.9: py39 - 3.10: py310 - 3.11: py311 - -[gh-actions:env] -PLONE = - 60: plone60 """ extra_lines = """ -[testenv:py{38,39,310,311}-plone{60}] -skip_install = True - -commands = - python -VV - pip install -r requirements.txt - pip list - {envbindir}/buildout -c /{toxinidir}/{env:BUILDOUT_FILE} buildout:directory={envdir} buildout:develop={toxinidir} install test - {envbindir}/buildout -c {toxinidir}/{env:BUILDOUT_FILE} buildout:directory={envdir} buildout:develop={toxinidir} annotate - {envbindir}/test - -setenv = - BUILDOUT_FILE=test_plone-60.cfg - -deps = - pdbpp - manuel - -# tox < 4.0.0 -whitelist_externals = - mkdir - echo - -# tox >= 4.0.0 -allowlist_externals = - mkdir - echo - [testenv:plone6docs] # New docs with plone-sphinx-theme # See [testenv:docs] for classic documentation @@ -109,7 +69,7 @@ commands = sphinx-build -b html -d "{env:READTHEDOCS_OUTPUT}"/doctrees/ docs "{env:READTHEDOCS_OUTPUT}"/html/ [testenv:docs] -basepython = python3.9 +basepython = python3.11 skip_install = False usedevelop = True allowlist_externals = @@ -160,12 +120,3 @@ commands = mkdir -p {toxinidir}/_build/plone6docs sphinx-autobuild -b html -d _build/plone6docs/doctrees docs _build/plone6docs/html """ - -[github] -jobs = [ - "qa", - "test", - "coverage", - "dependencies", - "release_ready", - ] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5c2addd6..e894b502 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.3.0 +- 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: @@ -59,20 +59,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.1.0" + rev: "6.2.1" hooks: - id: i18ndude diff --git a/constraints.txt b/constraints.txt index c1fb3a1b..bbad1624 100644 --- a/constraints.txt +++ b/constraints.txt @@ -1 +1 @@ --c constraints_plone60.txt +-c constraints_plone62.txt diff --git a/constraints_plone52.txt b/constraints_plone52.txt deleted file mode 100644 index 71a9c7a6..00000000 --- a/constraints_plone52.txt +++ /dev/null @@ -1 +0,0 @@ --c https://dist.plone.org/release/5.2-latest/constraints.txt \ No newline at end of file diff --git a/constraints_plone60.txt b/constraints_plone60.txt deleted file mode 100644 index 228b6cc7..00000000 --- a/constraints_plone60.txt +++ /dev/null @@ -1 +0,0 @@ --c https://dist.plone.org/release/6.0-latest/constraints.txt diff --git a/constraints_plone62.txt b/constraints_plone62.txt new file mode 100644 index 00000000..d293e060 --- /dev/null +++ b/constraints_plone62.txt @@ -0,0 +1 @@ +-c https://dist.plone.org/release/6.2-latest/constraints.txt diff --git a/news/3928.breaking b/news/3928.breaking new file mode 100644 index 00000000..4fb7ad4e --- /dev/null +++ b/news/3928.breaking @@ -0,0 +1,2 @@ +Replace ``pkg_resources`` namespace with PEP 420 native namespace. +Support only Plone 6.2 and Python 3.10+. diff --git a/pyproject.toml b/pyproject.toml index 2daa06b2..9d2dfcb3 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,<77"] +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,manuel" +ignore-words-list = "discreet,assertin,thet,manuel,checkin" 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 = ['Products.PrintingMailHost', 'plone.app.iterate',] ## @@ -142,11 +143,11 @@ ignore = [ "dependabot.yml", "mx.ini", "tox.ini", + # From `.meta.toml`, pyproject.check_manifest_ignores. "*.cfg", ".editorconfig", ".readthedocs.yaml", - "constraints_plone52.txt", - "constraints_plone60.txt", + "constraints_plone62.txt", "constraints.txt", "fix-converted-myst.py", "Makefile", diff --git a/requirements-docs.txt b/requirements-docs.txt index a1fba02f..001ec327 100644 --- a/requirements-docs.txt +++ b/requirements-docs.txt @@ -1,4 +1,4 @@ --c https://dist.plone.org/release/6.0-dev/constraints.txt +-c https://dist.plone.org/release/6.2-dev/constraints.txt linkify-it-py myst-parser plone-sphinx-theme<2 diff --git a/setup.py b/setup.py index caa0675b..165cf47f 100644 --- a/setup.py +++ b/setup.py @@ -1,9 +1,8 @@ from pathlib import Path -from setuptools import find_packages from setuptools import setup -version = "2.5.4.dev0" +version = "3.0.0.dev0" long_description = "\n".join( [Path("README.md").read_text(), Path("CHANGES.md").read_text()] @@ -18,14 +17,11 @@ author="Plone Foundation", author_email="plone-developers@lists.sourceforge.net", license="GPL version 2", - packages=find_packages("src"), - package_dir={"": "src"}, - namespace_packages=["plone"], include_package_data=True, zip_safe=False, url="https://github.com/plone/plone.api", keywords="plone api", - python_requires=">=3.8", + python_requires=">=3.10", install_requires=[ "Acquisition", "Products.statusmessages", @@ -41,7 +37,6 @@ "plone.i18n", "plone.registry", "plone.uuid", - "setuptools", "zope.globalrequest", "Products.CMFCore", "z3c.relationfield", @@ -68,14 +63,12 @@ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Plone", - "Framework :: Plone :: 6.0", + "Framework :: Plone :: 6.2", "Framework :: Plone :: Core", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", "Operating System :: OS Independent", "Programming Language :: Python", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", ], diff --git a/src/plone/__init__.py b/src/plone/__init__.py deleted file mode 100644 index 5284146e..00000000 --- a/src/plone/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__import__("pkg_resources").declare_namespace(__name__) diff --git a/tox.ini b/tox.ini index 91631266..af38719a 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,28 +7,25 @@ min_version = 4.4.0 envlist = lint test + py313-plone62 + py312-plone62 + py311-plone62 + py310-plone62 dependencies - py{38,39,310,311}-plone{60} linkcheck plone6docs docs skip_missing_interpreters = True -[gh-actions] -python = - 3.8: py38 - 3.9: py39 - 3.10: py310 - 3.11: py311 - -[gh-actions:env] -PLONE = - 60: plone60 - ## # 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 # """ @@ -37,32 +34,14 @@ PLONE = # """ ## -[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 +allowlist_externals = + echo commands = echo "Initial setup complete" - [testenv:format] description = automatically reformat code skip_install = true @@ -103,11 +82,22 @@ 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 = + zope-testrunner --all --test-path={toxinidir}/src -s plone.api {posargs} +coverage = + coverage run --branch --source plone.api {envbindir}/zope-testrunner --quiet --all --test-path={toxinidir}/src -s plone.api {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 = True +constrain_package_deps = true set_env = ROBOT_BROWSER=headlesschrome @@ -120,26 +110,27 @@ set_env = # # Set constrain_package_deps .meta.toml: # [tox] -# constrain_package_deps = "false" +# constrain_package_deps = false ## deps = - zope.testrunner - -c https://dist.plone.org/release/6.0-dev/constraints.txt + {[test_runner]deps} + plone62: -c https://dist.plone.org/release/6.2-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 = - zope-testrunner --all --test-path={toxinidir}/src -s plone.api {posargs} extras = test + ## # Add extra configuration options in .meta.toml: # [tox] @@ -147,35 +138,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 = True -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 https://dist.plone.org/release/6.0-dev/constraints.txt + -c https://dist.plone.org/release/6.2-dev/constraints.txt -commands = - coverage run --branch --source plone.api {envbindir}/zope-testrunner --quiet --all --test-path={toxinidir}/src -s plone.api {posargs} - coverage report -m --format markdown - coverage xml - coverage html -extras = - test +commands = {[test_runner]coverage} +extras = {[base]extras} [testenv:release-check] @@ -185,8 +193,7 @@ deps = twine build towncrier - -c https://dist.plone.org/release/6.0-dev/constraints.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 @@ -201,7 +208,7 @@ use_develop = true skip_install = false # Here we must always constrain the package deps to what is already installed, # otherwise we simply get the latest from PyPI, which may not work. -constrain_package_deps = True +constrain_package_deps = true set_env = ## @@ -216,8 +223,7 @@ allowlist_externals = deps = pipdeptree pipforester - -c https://dist.plone.org/release/6.0-dev/constraints.txt - + -c https://dist.plone.org/release/6.2-dev/constraints.txt commands = # Generate the full dependency tree sh -c 'pipdeptree -j > forest.json' @@ -226,34 +232,6 @@ commands = # Report if there are any circular dependencies, i.e. error if there are any pipforester -i forest.json --check-cycles -o /dev/null -[testenv:py{38,39,310,311}-plone{60}] -skip_install = True - -commands = - python -VV - pip install -r requirements.txt - pip list - {envbindir}/buildout -c /{toxinidir}/{env:BUILDOUT_FILE} buildout:directory={envdir} buildout:develop={toxinidir} install test - {envbindir}/buildout -c {toxinidir}/{env:BUILDOUT_FILE} buildout:directory={envdir} buildout:develop={toxinidir} annotate - {envbindir}/test - -setenv = - BUILDOUT_FILE=test_plone-60.cfg - -deps = - pdbpp - manuel - -# tox < 4.0.0 -whitelist_externals = - mkdir - echo - -# tox >= 4.0.0 -allowlist_externals = - mkdir - echo - [testenv:plone6docs] # New docs with plone-sphinx-theme # See [testenv:docs] for classic documentation @@ -286,7 +264,7 @@ commands = sphinx-build -b html -d "{env:READTHEDOCS_OUTPUT}"/doctrees/ docs "{env:READTHEDOCS_OUTPUT}"/html/ [testenv:docs] -basepython = python3.9 +basepython = python3.11 skip_install = False usedevelop = True allowlist_externals =