diff --git a/dependabot.yml b/.github/dependabot.yml similarity index 100% rename from dependabot.yml rename to .github/dependabot.yml diff --git a/.github/workflows/meta.yml b/.github/workflows/meta.yml index 667d046..f9a346f 100644 --- a/.github/workflows/meta.yml +++ b/.github/workflows/meta.yml @@ -25,24 +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@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", @@ -57,13 +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']" -## - ## # 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..f96e807 --- /dev/null +++ b/.github/workflows/test-matrix.yml @@ -0,0 +1,59 @@ +# 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"] + - ["3.13", "6.1 on py3.13", "py313-plone61"] + - ["3.10", "6.1 on py3.10", "py310-plone61"] + - ["3.9", "6.0 on py3.9", "py39-plone60"] + - ["3.13", "6.0 on py3.13", "py313-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 + - 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] }} diff --git a/.meta.toml b/.meta.toml index 132dfb9..c58e80c 100644 --- a/.meta.toml +++ b/.meta.toml @@ -3,4 +3,4 @@ # See the inline comments on how to expand/tweak this configuration file [meta] template = "default" -commit-id = "d00886ad" +commit-id = "2.0.1.dev0" diff --git a/MANIFEST.in b/MANIFEST.in index 41e2de9..5119593 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,7 +1,7 @@ include *.rst graft docs -graft plone +graft src global-exclude *.pyc global-exclude *.pyo diff --git a/news/4217.internal b/news/4217.internal new file mode 100644 index 0000000..27a5f4a --- /dev/null +++ b/news/4217.internal @@ -0,0 +1 @@ +Move distribution to src layout [gforcada] diff --git a/pyproject.toml b/pyproject.toml index b454539..c20adb6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ # 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/" @@ -37,7 +37,7 @@ showcontent = true [[tool.towncrier.type]] directory = "tests" -name = "Tests" +name = "Tests:" showcontent = true ## diff --git a/setup.py b/setup.py index f4647e0..0f9c050 100644 --- a/setup.py +++ b/setup.py @@ -36,8 +36,9 @@ author_email="plone-developers@lists.sourceforge.net", url="https://github.com/plone/plone.alterego", license="LGPL", - packages=find_packages(), + packages=find_packages("src"), namespace_packages=["plone"], + package_dir={"": "src"}, include_package_data=True, zip_safe=False, python_requires=">=3.8", diff --git a/plone/__init__.py b/src/plone/__init__.py similarity index 100% rename from plone/__init__.py rename to src/plone/__init__.py diff --git a/plone/alterego/__init__.py b/src/plone/alterego/__init__.py similarity index 100% rename from plone/alterego/__init__.py rename to src/plone/alterego/__init__.py diff --git a/plone/alterego/alterego.txt b/src/plone/alterego/alterego.txt similarity index 100% rename from plone/alterego/alterego.txt rename to src/plone/alterego/alterego.txt diff --git a/plone/alterego/dynamic.py b/src/plone/alterego/dynamic.py similarity index 100% rename from plone/alterego/dynamic.py rename to src/plone/alterego/dynamic.py diff --git a/plone/alterego/interfaces.py b/src/plone/alterego/interfaces.py similarity index 100% rename from plone/alterego/interfaces.py rename to src/plone/alterego/interfaces.py diff --git a/plone/alterego/tests.py b/src/plone/alterego/tests.py similarity index 100% rename from plone/alterego/tests.py rename to src/plone/alterego/tests.py diff --git a/tox.ini b/tox.ini index d33c0a4..4c095a0 100644 --- a/tox.ini +++ b/tox.ini @@ -7,12 +7,29 @@ min_version = 4.4.0 envlist = lint test + py313-plone62 + py312-plone62 + py311-plone62 + py310-plone62 + py313-plone61 + py312-plone61 + py311-plone61 + py310-plone61 + py313-plone60 + py312-plone60 + py311-plone60 + py310-plone60 + py39-plone60 dependencies ## # Add extra configuration options in .meta.toml: +# - to specify a custom testing combination of Plone and python versions, use `test_matrix` +# - 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" = ["3.10", "3.9"]} # envlist_lines = """ # my_other_environment # """ @@ -21,32 +38,14 @@ envlist = # """ ## -[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 @@ -87,8 +86,19 @@ 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.alterego {posargs} +coverage = + coverage run --branch --source plone.alterego {envbindir}/zope-testrunner --quiet --all --test-path={toxinidir}/src -s plone.alterego {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 @@ -104,26 +114,29 @@ 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 + 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 = - zope-testrunner --all --test-path={toxinidir} -s plone.alterego {posargs} extras = test + ## # Add extra configuration options in .meta.toml: # [tox] @@ -131,35 +144,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.alterego {envbindir}/zope-testrunner --quiet --all --test-path={toxinidir} -s plone.alterego {posargs} - coverage report -m --format markdown - coverage xml - coverage html -extras = - test +commands = {[test_runner]coverage} +extras = {[base]extras} [testenv:release-check] @@ -169,7 +199,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 @@ -200,7 +230,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