From e63aab21d59c964e62bc375c9dba63479edab6a3 Mon Sep 17 00:00:00 2001 From: Gil Forcada Codinachs Date: Sun, 25 Jun 2023 12:45:59 +0200 Subject: [PATCH 01/12] Configuring with plone/meta --- .editorconfig | 30 +++- .flake8 | 22 +++ .github/workflows/meta.yml | 66 ++++++++ .gitignore | 80 ++++++--- .meta.toml | 141 ++++++++++++++++ .pre-commit-config.yaml | 95 +++++++++++ dependabot.yml | 11 ++ news/cfffba8c.internal | 2 + pyproject.toml | 151 ++++++++++++++++- tox.ini | 325 +++++++++++++++++++++++++------------ 10 files changed, 779 insertions(+), 144 deletions(-) create mode 100644 .flake8 create mode 100644 .github/workflows/meta.yml create mode 100644 .meta.toml create mode 100644 .pre-commit-config.yaml create mode 100644 dependabot.yml create mode 100644 news/cfffba8c.internal diff --git a/.editorconfig b/.editorconfig index c85c9bc4..5b3c112c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,8 @@ -# EditorConfig Configurtaion file, for more details see: +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +# +# EditorConfig Configuration file, for more details see: # http://EditorConfig.org # EditorConfig is a convention description, that could be interpreted # by multiple editors to enforce common coding conventions for specific @@ -8,7 +12,9 @@ # Will ignore other EditorConfig files in Home directory or upper tree level. root = true -[*] # For All Files + +[*] +# Default settings for all files. # Unix-style newlines with a newline ending every file end_of_line = lf insert_final_newline = true @@ -24,19 +30,27 @@ max_line_length = off # 4 space indentation indent_size = 4 -[*.{yml}] +[*.{yml,zpt,pt,dtml,zcml,html,xml}] # 2 space indentation indent_size = 2 +[*.{json,jsonl,js,jsx,ts,tsx,css,less,scss}] +# Frontend development +# 2 space indentation +indent_size = 2 +max_line_length = 80 + [{Makefile,.gitmodules}] # Tab indentation (no size specified, but view as 4 spaces) indent_style = tab indent_size = unset tab_width = unset -[*.bat] -indent_style = tab -end_of_line = crlf -[LICENSE] -insert_final_newline = false +## +# Add extra configuration options in .meta.toml: +# [editorconfig] +# extra_lines = """ +# _your own configuration lines_ +# """ +## diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..38918f42 --- /dev/null +++ b/.flake8 @@ -0,0 +1,22 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +[flake8] +doctests = 1 +ignore = + # black takes care of line length + E501, + # black takes care of where to break lines + W503, + # black takes care of spaces within slicing (list[:]) + E203, + # black takes care of spaces after commas + E231, + +## +# Add extra configuration options in .meta.toml: +# [flake8] +# extra_lines = """ +# _your own configuration lines_ +# """ +## diff --git a/.github/workflows/meta.yml b/.github/workflows/meta.yml new file mode 100644 index 00000000..064618d8 --- /dev/null +++ b/.github/workflows/meta.yml @@ -0,0 +1,66 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +name: Meta +on: + push: + branches: + - master + - main + pull_request: + branches: + - master + - main + workflow_dispatch: + +## +# To set environment variables for all jobs, add in .meta.toml: +# [github] +# env = """ +# debug: 1 +# image-name: 'org/image' +# image-tag: 'latest' +# """ +## + +jobs: + qa: + uses: plone/meta/.github/workflows/qa.yml@main + test: + uses: plone/meta/.github/workflows/test.yml@main + coverage: + uses: plone/meta/.github/workflows/coverage.yml@main + dependencies: + uses: plone/meta/.github/workflows/dependencies.yml@main + release_ready: + uses: plone/meta/.github/workflows/release_ready.yml@main + +## +# To modify the list of default jobs being created add in .meta.toml: +# [github] +# jobs = [ +# "qa", +# "test", +# "coverage", +# "dependencies", +# "release_ready", +# "circular", +# ] +## + +## +# To request that some OS level dependencies get installed +# when running tests/coverage jobs, add in .meta.toml: +# [github] +# os_dependencies = "git libxml2 libxslt" +## + + +## +# Specify additional jobs in .meta.toml: +# [github] +# extra_lines = """ +# another: +# uses: org/repo/.github/workflows/file.yml@main +# """ +## diff --git a/.gitignore b/.gitignore index 6cb56eb9..486392f6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,28 +1,56 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +# python related +*.egg-info +*.pyc +*.pyo + +# translation related *.mo -*.py[cod] -*~ -/.Python -/.coverage* -/.installed.cfg -/bin/ -/build/ -/coverage* -/develop-eggs/ -/dist/ -/docs/Makefile -/docs/html/ -/eggs/ -/htmlcov -/include/ -/lib/ -/local.cfg -/local/ -/parts/ -/share/ -/src/plone.api.egg-info/ -/var/ -/reports/ -/pip-selfcheck.json -/_build/ -/.tox/ + +# tools related +build/ +.coverage +.*project +coverage.xml +dist/ +docs/_build +__pycache__/ +.tox +.vscode/ +node_modules/ + +# venv / buildout related +bin/ +develop-eggs/ +eggs/ +.eggs/ +etc/ +.installed.cfg +include/ +lib/ +lib64 +.mr.developer.cfg +parts/ pyvenv.cfg +var/ +local.cfg + +# mxdev +/instance/ +/.make-sentinels/ +/*-mxdev.txt +/reports/ +/sources/ +/venv/ +.installed.txt + + +## +# Add extra configuration options in .meta.toml: +# [gitignore] +# extra_lines = """ +# _your own configuration lines_ +# """ +## diff --git a/.meta.toml b/.meta.toml new file mode 100644 index 00000000..d0ae1c53 --- /dev/null +++ b/.meta.toml @@ -0,0 +1,141 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +[meta] +template = "default" +commit-id = "1c2155e4" + +[pre_commit] +codespell_extra_lines = """ + exclude: docs/locale/.*.pot +""" + +[pyproject] +check_manifest_ignores = """ + ".editorconfig", + "*.cfg", + "constraints_plone52.txt", + "constraints_plone60.txt", + "constraints.txt", + "fix-converted-myst.py", + "Makefile", + "netlify.toml", + "requirements-docs.txt", + "requirements.txt", +""" +dependencies_ignores = "['Products.PrintingMailHost', 'plone.app.iterate',]" +codespell_ignores = "manuel" + +[tox] +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 sphinx-book-theme +# See [testenv:docs] for classic documentation +basepython = python3.9 +skip_install = False +usedevelop = True +allowlist_externals = + mkdir +extras = + tests + +deps = + -r requirements-docs.txt + +commands = + python -VV + mkdir -p {toxinidir}/_build/plone6docs + sphinx-build -b html -d _build/plone6docs/doctrees docs _build/plone6docs/html + +[testenv:docs] +basepython = python3.9 +skip_install = False +usedevelop = True +allowlist_externals = + mkdir +extras = + tests + +deps = + -r requirements-docs.txt + +commands = + python -VV + mkdir -p {toxinidir}/_build/docs + sphinx-build -b html -D html_theme=alabaster -d _build/docs/doctrees docs _build/docs/html + +whitelist_externals = + mkdir + +[testenv:linkcheck] +basepython = python +skip_install = False +usedevelop = True +allowlist_externals = + mkdir +extras = + {[testenv:plone6docs]extras} +deps = + {[testenv:plone6docs]deps} +commands = + python -VV + mkdir -p {toxinidir}/_build/plone6docs + sphinx-build -b linkcheck -d _build/plone6docs/doctrees docs _build/plone6docs/linkcheck +""" + +[github] +jobs = [ + "qa", + "test", + "coverage", + "dependencies", + "release_ready", + ] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..5c2addd6 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,95 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +ci: + autofix_prs: false + autoupdate_schedule: monthly + +repos: +- repo: https://github.com/asottile/pyupgrade + rev: v3.15.2 + hooks: + - id: pyupgrade + args: [--py38-plus] +- repo: https://github.com/pycqa/isort + rev: 5.13.2 + hooks: + - id: isort +- repo: https://github.com/psf/black + rev: 24.3.0 + hooks: + - id: black +- repo: https://github.com/collective/zpretty + rev: 3.1.0 + hooks: + - id: zpretty + +## +# Add extra configuration options in .meta.toml: +# [pre_commit] +# zpretty_extra_lines = """ +# _your own configuration lines_ +# """ +## +- repo: https://github.com/PyCQA/flake8 + rev: 7.0.0 + hooks: + - id: flake8 + +## +# Add extra configuration options in .meta.toml: +# [pre_commit] +# flake8_extra_lines = """ +# _your own configuration lines_ +# """ +## +- repo: https://github.com/codespell-project/codespell + rev: v2.2.6 + hooks: + - id: codespell + additional_dependencies: + - tomli + exclude: docs/locale/.*.pot + +## +# Add extra configuration options in .meta.toml: +# [pre_commit] +# codespell_extra_lines = """ +# _your own configuration lines_ +# """ +## +- repo: https://github.com/mgedmin/check-manifest + rev: "0.49" + hooks: + - id: check-manifest +- repo: https://github.com/regebro/pyroma + rev: "4.2" + hooks: + - id: pyroma +- repo: https://github.com/mgedmin/check-python-versions + rev: "0.22.0" + hooks: + - id: check-python-versions + args: ['--only', 'setup.py,pyproject.toml'] +- repo: https://github.com/collective/i18ndude + rev: "6.1.0" + hooks: + - id: i18ndude + + +## +# Add extra configuration options in .meta.toml: +# [pre_commit] +# i18ndude_extra_lines = """ +# _your own configuration lines_ +# """ +## + + +## +# Add extra configuration options in .meta.toml: +# [pre_commit] +# extra_lines = """ +# _your own configuration lines_ +# """ +## diff --git a/dependabot.yml b/dependabot.yml new file mode 100644 index 00000000..bbd3ab05 --- /dev/null +++ b/dependabot.yml @@ -0,0 +1,11 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +version: 2 +updates: + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + # Check for updates to GitHub Actions every week + interval: "weekly" diff --git a/news/cfffba8c.internal b/news/cfffba8c.internal new file mode 100644 index 00000000..c08f5399 --- /dev/null +++ b/news/cfffba8c.internal @@ -0,0 +1,2 @@ +Update configuration files. +[plone devs] diff --git a/pyproject.toml b/pyproject.toml index 057abc23..2066aabf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,12 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +[build-system] +requires = ["setuptools>=68.2"] + [tool.towncrier] -filename = "CHANGES.rst" directory = "news/" +filename = "CHANGES.rst" title_format = "{version} ({project_date})" underlines = ["-", ""] @@ -27,4 +33,145 @@ showcontent = true [[tool.towncrier.type]] directory = "documentation" name = "Documentation:" -showcontent = true \ No newline at end of file +showcontent = true + +[[tool.towncrier.type]] +directory = "tests" +name = "Tests" +showcontent = true + +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# towncrier_extra_lines = """ +# extra_configuration +# """ +## + +[tool.isort] +profile = "plone" + +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# isort_extra_lines = """ +# extra_configuration +# """ +## + +[tool.black] +target-version = ["py38"] + +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# black_extra_lines = """ +# extra_configuration +# """ +## + +[tool.codespell] +ignore-words-list = "discreet,manuel" +skip = "*.po," +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# codespell_ignores = "foo,bar" +# codespell_skip = "*.po,*.map,package-lock.json" +## + +[tool.dependencychecker] +Zope = [ + # Zope own provided namespaces + 'App', 'OFS', 'Products.Five', 'Products.OFSP', 'Products.PageTemplates', + 'Products.SiteAccess', 'Shared', 'Testing', 'ZPublisher', 'ZTUtils', + 'Zope2', 'webdav', 'zmi', + # ExtensionClass own provided namespaces + 'ExtensionClass', 'ComputedAttribute', 'MethodObject', + # Zope dependencies + 'AccessControl', 'Acquisition', 'AuthEncoding', 'beautifulsoup4', 'BTrees', + 'cffi', 'Chameleon', 'DateTime', 'DocumentTemplate', + 'MultiMapping', 'multipart', 'PasteDeploy', 'Persistence', 'persistent', + 'pycparser', 'python-gettext', 'pytz', 'RestrictedPython', 'roman', + 'soupsieve', 'transaction', 'waitress', 'WebOb', 'WebTest', 'WSGIProxy2', + 'z3c.pt', 'zc.lockfile', 'ZConfig', 'zExceptions', 'ZODB', 'zodbpickle', + 'zope.annotation', 'zope.browser', 'zope.browsermenu', 'zope.browserpage', + 'zope.browserresource', 'zope.cachedescriptors', 'zope.component', + 'zope.configuration', 'zope.container', 'zope.contentprovider', + 'zope.contenttype', 'zope.datetime', 'zope.deferredimport', + 'zope.deprecation', 'zope.dottedname', 'zope.event', 'zope.exceptions', + 'zope.filerepresentation', 'zope.globalrequest', 'zope.hookable', + 'zope.i18n', 'zope.i18nmessageid', 'zope.interface', 'zope.lifecycleevent', + 'zope.location', 'zope.pagetemplate', 'zope.processlifetime', 'zope.proxy', + 'zope.ptresource', 'zope.publisher', 'zope.schema', 'zope.security', + 'zope.sequencesort', 'zope.site', 'zope.size', 'zope.structuredtext', + 'zope.tal', 'zope.tales', 'zope.testbrowser', 'zope.testing', + 'zope.traversing', 'zope.viewlet' +] +'Products.CMFCore' = [ + 'docutils', 'five.localsitemanager', 'Missing', 'Products.BTreeFolder2', + 'Products.GenericSetup', 'Products.MailHost', 'Products.PythonScripts', + 'Products.StandardCacheManagers', 'Products.ZCatalog', 'Record', + 'zope.sendmail', 'Zope' +] +'plone.base' = [ + 'plone.batching', 'plone.registry', 'plone.schema','plone.z3cform', + 'Products.CMFCore', 'Products.CMFDynamicViewFTI', +] +python-dateutil = ['dateutil'] +ignore-packages = ['Products.PrintingMailHost', 'plone.app.iterate',] + +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# dependencies_ignores = "['zestreleaser.towncrier']" +# dependencies_mappings = [ +# "gitpython = ['git']", +# "pygithub = ['github']", +# ] +## + +[tool.check-manifest] +ignore = [ + ".editorconfig", + ".flake8", + ".meta.toml", + ".pre-commit-config.yaml", + "dependabot.yml", + "mx.ini", + "tox.ini", + ".editorconfig", + "*.cfg", + "constraints_plone52.txt", + "constraints_plone60.txt", + "constraints.txt", + "fix-converted-myst.py", + "Makefile", + "netlify.toml", + "requirements-docs.txt", + "requirements.txt", + +] + +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# check_manifest_ignores = """ +# "*.map.js", +# "*.pyc", +# """ +# check_manifest_extra_lines = """ +# ignore-bad-ideas = [ +# "some/test/file/PKG-INFO", +# ] +# """ +## + + +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# extra_lines = """ +# _your own configuration lines_ +# """ +## diff --git a/tox.ini b/tox.ini index 4ec548d9..701ba2af 100644 --- a/tox.ini +++ b/tox.ini @@ -1,13 +1,14 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file [tox] +# We need 4.4.0 for constrain_package_deps. +min_version = 4.4.0 envlist = - py{38,39,310,311}-plone{60} - # towncrier - # black-enforce - black-check - # isort-apply - isort lint -# coverage-report + test + dependencies + py{38,39,310,311}-plone{60} linkcheck plone6docs docs @@ -25,126 +26,233 @@ python = PLONE = 60: plone60 +## +# Add extra configuration options in .meta.toml: +# [tox] +# envlist_lines = """ +# my_other_environment +# """ +# config_lines = """ +# my_extra_top_level_tox_configuration_lines +# """ +## [testenv] -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 +skip_install = true allowlist_externals = - mkdir 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 +commands = + echo "Initial setup complete" -[testenv:coverage-report] -basepython = python3.9 -deps = coverage - -setenv = - COVERAGE_FILE=.coverage - -skip_install = True +[testenv:format] +description = automatically reformat code +skip_install = true +deps = + pre-commit commands = - python -VV - coverage erase - coverage combine - coverage report - coverage html - coverage xml + pre-commit run -a pyupgrade + pre-commit run -a isort + pre-commit run -a black + pre-commit run -a zpretty -[testenv:black-check] -basepython = python3.9 -skip_install = True +[testenv:lint] +description = run linters that will help improve the code style +skip_install = true deps = - black - + pre-commit commands = - python -VV - black --check --diff -v src setup.py + pre-commit run -a -[testenv:black-enforce] -basepython = python3.9 -skip_install = True +[testenv:dependencies] +description = check if the package defines all its dependencies +skip_install = true deps = - black - + build + z3c.dependencychecker==2.14.3 commands = - python -VV - black -v src setup.py + python -m build --sdist + dependencychecker -[testenv:isort] -basepython = python3.9 -skip_install = True +[testenv:dependencies-graph] +description = generate a graph out of the dependencies of the package +skip_install = false +allowlist_externals = + sh +deps = + pipdeptree==2.5.1 + graphviz # optional dependency of pipdeptree +commands = + sh -c 'pipdeptree --exclude setuptools,wheel,pipdeptree,zope.interface,zope.component --graph-output svg > dependencies.svg' + +[testenv:test] +description = run the distribution tests +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/ +# """ +# +# Set constrain_package_deps .meta.toml: +# [tox] +# constrain_package_deps = "false" +## deps = - isort + zope.testrunner + -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]" +# +# 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] +# test_extras = """ +# tests +# widgets +# """ +## + +[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/ +# """ +## +deps = + coverage + zope.testrunner + -c https://dist.plone.org/release/6.0-dev/constraints.txt commands = - python -VV - isort --check-only --diff src setup.py + 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 -[testenv:isort-apply] -basepython = python3.9 -skip_install = True +[testenv:release-check] +description = ensure that the distribution is ready to release +skip_install = true deps = - isort + twine + build + towncrier + -c https://dist.plone.org/release/6.0-dev/constraints.txt commands = - python -VV - isort src setup.py {posargs} + # fake version to not have to install the package + # we build the change log as news entries might break + # the README that is displayed on PyPI + towncrier build --version=100.0.0 --yes + python -m build --sdist + twine check dist/* + +[testenv:circular] +description = ensure there are no cyclic dependencies +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 +set_env = + +## +# Specify extra test environment variables in .meta.toml: +# [tox] +# test_environment_variables = """ +# PIP_EXTRA_INDEX_URL=https://my-pypi.my-server.com/ +# """ +## +allowlist_externals = + sh +deps = + pipdeptree + pipforester + -c https://dist.plone.org/release/6.0-dev/constraints.txt -[testenv:lint] -basepython = python3.9 +commands = + # Generate the full dependency tree + sh -c 'pipdeptree -j > forest.json' + # Generate a DOT graph with the circular dependencies, if any + pipforester -i forest.json -o forest.dot --cycles + # 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 -deps = - Jinja2<=3.0.3 - isort - flake8 - # helper to generate HTML reports: - flake8-html - flake8-blind-except - flake8-coding - # flake8-commas - flake8-debugger - flake8-deprecated - # flake8-docstrings - flake8-isort - flake8-pep3101 - flake8-plone-hasattr - flake8-print - # flake8-quotes - flake8-string-format - flake8-todo - commands = python -VV - mkdir -p {toxinidir}/_build/flake8 - - flake8 --format=html --htmldir={toxinidir}/_build/flake8 --ignore=C101 src setup.py - flake8 --ignore=C101,P101,Q000 src setup.py + 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 sphinx-book-theme @@ -152,6 +260,8 @@ whitelist_externals = basepython = python3.9 skip_install = False usedevelop = True +allowlist_externals = + mkdir extras = tests @@ -163,11 +273,12 @@ commands = mkdir -p {toxinidir}/_build/plone6docs sphinx-build -b html -d _build/plone6docs/doctrees docs _build/plone6docs/html - [testenv:docs] basepython = python3.9 skip_install = False usedevelop = True +allowlist_externals = + mkdir extras = tests @@ -182,11 +293,12 @@ commands = whitelist_externals = mkdir - [testenv:linkcheck] basepython = python skip_install = False usedevelop = True +allowlist_externals = + mkdir extras = {[testenv:plone6docs]extras} deps = @@ -196,13 +308,10 @@ commands = mkdir -p {toxinidir}/_build/plone6docs sphinx-build -b linkcheck -d _build/plone6docs/doctrees docs _build/plone6docs/linkcheck - -[testenv:towncrier] -basepython = python -skip_install = True - -deps= - towncrier - -commands = - towncrier --draft +## +# Add extra configuration options in .meta.toml: +# [tox] +# extra_lines = """ +# _your own configuration lines_ +# """ +## From 1948ac03fc2265d32b886fe956c556327f738965 Mon Sep 17 00:00:00 2001 From: Gil Forcada Codinachs Date: Sun, 15 Oct 2023 00:33:47 +0200 Subject: [PATCH 02/12] cleanup(gha): remove now duplicated actions --- .github/workflows/black.yml | 32 -------------------------------- .github/workflows/isort.yml | 32 -------------------------------- 2 files changed, 64 deletions(-) delete mode 100644 .github/workflows/black.yml delete mode 100644 .github/workflows/isort.yml diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml deleted file mode 100644 index fc5371c7..00000000 --- a/.github/workflows/black.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Black -on: [push] -jobs: - build: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: [3.9] - - steps: - # git checkout - - uses: actions/checkout@v4 - - # python setup - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install tox tox-gh-actions - - # python cache - - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - - - name: Test with tox - run: tox -e black-check diff --git a/.github/workflows/isort.yml b/.github/workflows/isort.yml deleted file mode 100644 index 3176e03f..00000000 --- a/.github/workflows/isort.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Isort -on: [push] -jobs: - build: - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - python-version: [3.9] - - steps: - # git checkout - - uses: actions/checkout@v4 - - # python setup - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install tox tox-gh-actions - - # python cache - - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - - - name: Test with tox - run: tox -e isort From af85bd29397f30f450293c87c6affaf8b877e25f Mon Sep 17 00:00:00 2001 From: Gil Forcada Codinachs Date: Sun, 25 Jun 2023 12:46:51 +0200 Subject: [PATCH 03/12] chore: remove not needed sections --- setup.cfg | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/setup.cfg b/setup.cfg index 84355524..c11c22e5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,26 +1,3 @@ -[check-manifest] -ignore = - .editorconfig - *.cfg - constraints_plone52.txt - constraints_plone60.txt - constraints.txt - fix-converted-myst.py - Makefile - netlify.toml - requirements-docs.txt - requirements.txt - -[flake8] -max-line-length = 88 -extend-ignore = E203, W503 - -[isort] -force_alphabetical_sort=True -force_single_line=True -lines_after_imports=2 -line_length=200 - [coverage:run] branch = True source = @@ -41,6 +18,3 @@ omit = [coverage:html] directory = _build/coverage - -[bdist_wheel] -universal = 0 From dcd0260819e5ebd8def8a320023714a8b1642f61 Mon Sep 17 00:00:00 2001 From: Gil Forcada Codinachs Date: Sun, 25 Jun 2023 12:48:07 +0200 Subject: [PATCH 04/12] chore: run pyupgrade --- src/plone/api/content.py | 4 ++-- src/plone/api/portal.py | 4 ++-- src/plone/api/relation.py | 18 +++++++++--------- src/plone/api/tests/test_content.py | 2 +- src/plone/api/tests/test_doctests.py | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/plone/api/content.py b/src/plone/api/content.py index 6be66dec..19865baf 100644 --- a/src/plone/api/content.py +++ b/src/plone/api/content.py @@ -127,7 +127,7 @@ def get(path=None, UID=None): if path: site = portal.get() site_absolute_path = "/".join(site.getPhysicalPath()) - if not path.startswith("{path}".format(path=site_absolute_path)): + if not path.startswith(f"{site_absolute_path}"): path = "{site_path}{relative_path}".format( site_path=site_absolute_path, relative_path=path, @@ -297,7 +297,7 @@ def delete(obj=None, objects=None, check_linkintegrity=True): breaches = linkintegrity_view.get_breaches(objects) if breaches: raise LinkIntegrityNotificationException( - "Linkintegrity-breaches: {}".format(breaches), + f"Linkintegrity-breaches: {breaches}", ) for obj_ in objects: diff --git a/src/plone/api/portal.py b/src/plone/api/portal.py index 1aec4997..6080093f 100644 --- a/src/plone/api/portal.py +++ b/src/plone/api/portal.py @@ -280,7 +280,7 @@ def get_registry_record(name=None, interface=None, default=MISSING): records = registry.forInterface(interface, check=False) _marker = object() if getattr(records, name, _marker) != _marker: - return registry["{}.{}".format(interface.__identifier__, name)] + return registry[f"{interface.__identifier__}.{name}"] if default is not MISSING: return default @@ -307,7 +307,7 @@ def get_registry_record(name=None, interface=None, default=MISSING): # Show all records that 'look like' name. # We don't dump the whole list, because it 1500+ items. - msg = "Cannot find a record with name '{name}'".format(name=name) + msg = f"Cannot find a record with name '{name}'" records = [key for key in registry.records.keys() if name in key] if records: msg = ( diff --git a/src/plone/api/relation.py b/src/plone/api/relation.py index 5540d4ca..bf39a8aa 100644 --- a/src/plone/api/relation.py +++ b/src/plone/api/relation.py @@ -76,16 +76,16 @@ def get( :Example: :ref:`relation-get-example` """ if source is not None and not base_hasattr(source, "portal_type"): - raise InvalidParameterError("{} has no portal_type".format(source)) + raise InvalidParameterError(f"{source} has no portal_type") if target is not None and not base_hasattr(target, "portal_type"): - raise InvalidParameterError("{} has no portal_type".format(target)) + raise InvalidParameterError(f"{target} has no portal_type") if relationship is not None and not isinstance( relationship, str, ): - raise InvalidParameterError("{} is no string".format(relationship)) + raise InvalidParameterError(f"{relationship} is no string") intids = getUtility(IIntIds) relation_catalog = getUtility(ICatalog) @@ -150,13 +150,13 @@ def create(source=None, target=None, relationship=None): :Example: :ref:`relation-create-example` """ if source is not None and not base_hasattr(source, "portal_type"): - raise InvalidParameterError("{} has no portal_type".format(source)) + raise InvalidParameterError(f"{source} has no portal_type") if target is not None and not base_hasattr(target, "portal_type"): - raise InvalidParameterError("{} has no portal_type".format(target)) + raise InvalidParameterError(f"{target} has no portal_type") if not isinstance(relationship, str): - raise InvalidParameterError("{} is no string".format(relationship)) + raise InvalidParameterError(f"{relationship} is no string") relation_catalog = getUtility(ICatalog) intids = getUtility(IIntIds) @@ -267,16 +267,16 @@ def delete(source=None, target=None, relationship=None): :Example: :ref:`relation-delete-example` """ if source is not None and not base_hasattr(source, "portal_type"): - raise InvalidParameterError("{} has no portal_type".format(source)) + raise InvalidParameterError(f"{source} has no portal_type") if target is not None and not base_hasattr(target, "portal_type"): - raise InvalidParameterError("{} has no portal_type".format(target)) + raise InvalidParameterError(f"{target} has no portal_type") if relationship is not None and not isinstance( relationship, str, ): - raise InvalidParameterError("{} is no string".format(relationship)) + raise InvalidParameterError(f"{relationship} is no string") query = {} relation_catalog = getUtility(ICatalog) diff --git a/src/plone/api/tests/test_content.py b/src/plone/api/tests/test_content.py index 637b1c64..41caebc0 100644 --- a/src/plone/api/tests/test_content.py +++ b/src/plone/api/tests/test_content.py @@ -461,7 +461,7 @@ def test_get(self): # Test getting the team document by path that has portal id included team_by_path = api.content.get( - "/{}/about/team".format(self.portal.getId()), + f"/{self.portal.getId()}/about/team", ) self.assertEqual(self.team, team_by_path) diff --git a/src/plone/api/tests/test_doctests.py b/src/plone/api/tests/test_doctests.py index 26a2fb18..53f9b1d4 100644 --- a/src/plone/api/tests/test_doctests.py +++ b/src/plone/api/tests/test_doctests.py @@ -125,7 +125,7 @@ def test_suite(): doctests.append(DocFileSuite(os.path.join(path, filename))) except OSError: logger.warning( - "test_doctest.py skipping {file}".format(file=filename), + f"test_doctest.py skipping {filename}", ) return unittest.TestSuite(doctests) From e5ba4eb550a624220e81e7785ebbc23d2320683f Mon Sep 17 00:00:00 2001 From: Gil Forcada Codinachs Date: Sun, 25 Jun 2023 12:48:21 +0200 Subject: [PATCH 05/12] chore: run isort --- docs/conf.py | 1 + fix-converted-myst.py | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index 788a5059..d5270674 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -2,6 +2,7 @@ import sys + project = 'plone.api' copyright = '2012, Plone Foundation' diff --git a/fix-converted-myst.py b/fix-converted-myst.py index e5053e69..62f3ca2f 100644 --- a/fix-converted-myst.py +++ b/fix-converted-myst.py @@ -2,6 +2,7 @@ import os import re + logging.basicConfig() logger = logging.getLogger("fix converted MyST documentation") logger.setLevel(logging.INFO) From d39f27a3bbe5d6160c768ff4a53642e6a176e749 Mon Sep 17 00:00:00 2001 From: Gil Forcada Codinachs Date: Sun, 25 Jun 2023 12:49:25 +0200 Subject: [PATCH 06/12] chore: run black --- docs/conf.py | 42 +++++++++++++++++++++------------------- fix-converted-myst.py | 15 +++++++------- src/plone/api/content.py | 2 +- 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index d5270674..9492f0a8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -3,8 +3,8 @@ import sys -project = 'plone.api' -copyright = '2012, Plone Foundation' +project = "plone.api" +copyright = "2012, Plone Foundation" version = release = get_distribution(project).version @@ -16,29 +16,31 @@ } extensions = [ - 'sphinx.ext.doctest', - 'sphinx.ext.coverage', - 'sphinx.ext.autodoc', - 'sphinx.ext.viewcode', - 'sphinx.ext.autosummary', + "sphinx.ext.doctest", + "sphinx.ext.coverage", + "sphinx.ext.autodoc", + "sphinx.ext.viewcode", + "sphinx.ext.autosummary", "myst_parser", "sphinx.ext.todo", ] -master_doc = 'index' +master_doc = "index" -locale_dirs = ['translated/'] -language = 'en' +locale_dirs = ["translated/"] +language = "en" # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]) # This enables PDF generation. -latex_documents = [( - 'index', - 'ploneapi.tex', - 'plone.api Documentation', - '', - 'manual', -)] +latex_documents = [ + ( + "index", + "ploneapi.tex", + "plone.api Documentation", + "", + "manual", + ) +] class Mock: @@ -50,8 +52,8 @@ def __call__(self, *args, **kwargs): @classmethod def __getattr__(cls, name): - if name in ('__file__', '__path__'): - return '/dev/null' + if name in ("__file__", "__path__"): + return "/dev/null" elif name[0] == name[0].upper(): mockType = type(name, (), {}) mockType.__module__ = __name__ @@ -60,7 +62,7 @@ def __getattr__(cls, name): return Mock() -MOCK_MODULES = ['lxml'] +MOCK_MODULES = ["lxml"] for mod_name in MOCK_MODULES: sys.modules[mod_name] = Mock() diff --git a/fix-converted-myst.py b/fix-converted-myst.py index 62f3ca2f..3091a14c 100644 --- a/fix-converted-myst.py +++ b/fix-converted-myst.py @@ -21,28 +21,27 @@ def replace_label_underscore(data): -> :Example: :ref:`portal-get-tool-example` """ - regex_label_underscore = '(?<=:ref:`)(.*)(?=`)' + regex_label_underscore = "(?<=:ref:`)(.*)(?=`)" def _replace(mobj): - return mobj.group(0).replace('_', '-') + return mobj.group(0).replace("_", "-") - data = re.sub( - regex_label_underscore, _replace, data) + data = re.sub(regex_label_underscore, _replace, data) return data def remove_github_warning(data): """Remove 'GitHub-only' warning""" - regex_github_warning = r':::{admonition} GitHub-only([\S\s]*?):::\n\n' - data = re.sub(regex_github_warning, '', data, flags=re.DOTALL) + regex_github_warning = r":::{admonition} GitHub-only([\S\s]*?):::\n\n" + data = re.sub(regex_github_warning, "", data, flags=re.DOTALL) return data -for root, dirs, files in (*os.walk('./src'), *os.walk('./docs')): +for root, dirs, files in (*os.walk("./src"), *os.walk("./docs")): for name in files: if name.endswith(".py") or name.endswith(".md"): filename = os.path.join(root, name) - with open(filename, 'r+') as f: + with open(filename, "r+") as f: data = f.read() data = replace_label_underscore(data) data = remove_github_warning(data) diff --git a/src/plone/api/content.py b/src/plone/api/content.py index 19865baf..95515de9 100644 --- a/src/plone/api/content.py +++ b/src/plone/api/content.py @@ -34,7 +34,7 @@ def create( id=None, title=None, safe_id=False, - **kwargs # NOQA: C816, S101 + **kwargs, # NOQA: C816, S101 ): """Create a new content item. From 9b304665a7fa9f2cf9a7cdd8ceb16614ce796499 Mon Sep 17 00:00:00 2001 From: Gil Forcada Codinachs Date: Sun, 25 Jun 2023 12:49:58 +0200 Subject: [PATCH 07/12] chore: run zpretty --- src/plone/api/configure.zcml | 3 +- .../api/profiles/testfixture/metadata.xml | 2 +- src/plone/api/profiles/testfixture/types.xml | 14 ++- .../testfixture/types/Dexterity_Folder.xml | 100 +++++++++++------- .../testfixture/types/Dexterity_Item.xml | 100 +++++++++++------- src/plone/api/testing.zcml | 24 +++-- src/plone/api/tests/Dexterity_Folder.xml | 4 +- src/plone/api/tests/Dexterity_Item.xml | 4 +- 8 files changed, 153 insertions(+), 98 deletions(-) diff --git a/src/plone/api/configure.zcml b/src/plone/api/configure.zcml index c25eee7b..fe29cba6 100644 --- a/src/plone/api/configure.zcml +++ b/src/plone/api/configure.zcml @@ -1,5 +1,6 @@ + i18n_domain="plone.api" + > diff --git a/src/plone/api/profiles/testfixture/metadata.xml b/src/plone/api/profiles/testfixture/metadata.xml index 9f02b5ec..db49627f 100644 --- a/src/plone/api/profiles/testfixture/metadata.xml +++ b/src/plone/api/profiles/testfixture/metadata.xml @@ -1,4 +1,4 @@ - + 1 diff --git a/src/plone/api/profiles/testfixture/types.xml b/src/plone/api/profiles/testfixture/types.xml index 9a3e48aa..a70943b1 100644 --- a/src/plone/api/profiles/testfixture/types.xml +++ b/src/plone/api/profiles/testfixture/types.xml @@ -1,5 +1,11 @@ - - - - + + + + diff --git a/src/plone/api/profiles/testfixture/types/Dexterity_Folder.xml b/src/plone/api/profiles/testfixture/types/Dexterity_Folder.xml index 40dd5203..9c61671e 100644 --- a/src/plone/api/profiles/testfixture/types/Dexterity_Folder.xml +++ b/src/plone/api/profiles/testfixture/types/Dexterity_Folder.xml @@ -1,40 +1,62 @@ - - - Dexterity Folder - - - - view - True - False - - False - view - - - - False - cmf.AddPortalContent - plone.dexterity.content.Container - - - - - - plone.api.tests:Dexterity_Folder.xml - - - - - - - - - - + + + Dexterity Folder + + + + view + True + False + + False + view + + + + False + cmf.AddPortalContent + plone.dexterity.content.Container + + + + + + plone.api.tests:Dexterity_Folder.xml + + + + + + + + + + diff --git a/src/plone/api/profiles/testfixture/types/Dexterity_Item.xml b/src/plone/api/profiles/testfixture/types/Dexterity_Item.xml index 3c31f131..74ef9bc0 100644 --- a/src/plone/api/profiles/testfixture/types/Dexterity_Item.xml +++ b/src/plone/api/profiles/testfixture/types/Dexterity_Item.xml @@ -1,40 +1,62 @@ - - - Dexterity Item - - - - view - True - True - - False - view - - - - False - cmf.AddPortalContent - plone.dexterity.content.Item - - - - - - plone.api.tests:Dexterity_Item.xml - - - - - - - - - - + + + Dexterity Item + + + + view + True + True + + False + view + + + + False + cmf.AddPortalContent + plone.dexterity.content.Item + + + + + + plone.api.tests:Dexterity_Item.xml + + + + + + + + + + diff --git a/src/plone/api/testing.zcml b/src/plone/api/testing.zcml index 26d9ce41..1a9fbf15 100644 --- a/src/plone/api/testing.zcml +++ b/src/plone/api/testing.zcml @@ -1,17 +1,21 @@ + i18n_domain="plone.api" + > - + - + diff --git a/src/plone/api/tests/Dexterity_Folder.xml b/src/plone/api/tests/Dexterity_Folder.xml index d93a4890..b1bc2ab7 100644 --- a/src/plone/api/tests/Dexterity_Folder.xml +++ b/src/plone/api/tests/Dexterity_Folder.xml @@ -1,4 +1,4 @@ - + - + diff --git a/src/plone/api/tests/Dexterity_Item.xml b/src/plone/api/tests/Dexterity_Item.xml index d93a4890..b1bc2ab7 100644 --- a/src/plone/api/tests/Dexterity_Item.xml +++ b/src/plone/api/tests/Dexterity_Item.xml @@ -1,4 +1,4 @@ - + - + From bc3a1cb63215b85c8ea1ab47075e3bf032e696b8 Mon Sep 17 00:00:00 2001 From: Gil Forcada Codinachs Date: Sun, 25 Jun 2023 12:55:12 +0200 Subject: [PATCH 08/12] chore: codespell typos --- CHANGES.rst | 6 +++--- docs/contribute/develop.md | 2 +- src/plone/api/tests/test_env.py | 2 +- src/plone/api/tests/test_group.py | 2 +- src/plone/api/tests/test_portal.py | 2 +- src/plone/api/tests/test_user.py | 2 +- src/plone/api/user.py | 2 +- src/plone/api/validation.py | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 65640cd8..8f5c9e19 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -84,8 +84,8 @@ Bug fixes: - Do not run GitHub Actions tests twice. - Only run GitHub Actions tests when commiting directly against master or main or - opening a pull request agains master or main. This avoids to run the same test + Only run GitHub Actions tests when committing directly against master or main or + opening a pull request against master or main. This avoids to run the same test suite for the same environment twice. [thet] (#0) - Mockup TinyMCE settings: Remove unused AtD related views. @@ -474,7 +474,7 @@ Bug fixes: - Simplify the ``plone.api.content.delete`` method. [thet] -- content.copy with safe_id=False should raise it's own exeception. Fixes #340 +- content.copy with safe_id=False should raise it's own exception. Fixes #340 [jaroel] diff --git a/docs/contribute/develop.md b/docs/contribute/develop.md index ccfe51b0..c2b0a699 100644 --- a/docs/contribute/develop.md +++ b/docs/contribute/develop.md @@ -70,7 +70,7 @@ Our repository on GitHub has the following layout: - **feature branches**: all development for new features must be done in dedicated branches, normally one branch per feature, - **master branch**: when features get completed they are merged into the - master branch; bugfixes are commited directly on the master branch, + master branch; bugfixes are committed directly on the master branch, - **tags**: whenever we create a new release we tag the repository so we can later re-trace our steps, re-release versions, etc. diff --git a/src/plone/api/tests/test_env.py b/src/plone/api/tests/test_env.py index 3086a4d4..e56161ba 100644 --- a/src/plone/api/tests/test_env.py +++ b/src/plone/api/tests/test_env.py @@ -486,7 +486,7 @@ def test_argument_requirement(self): api.env.adopt_roles() def test_debug_mode(self): - """Tests that the retured value is the same as + """Tests that the returned value is the same as getConfiguration.debug_mode.""" from App.config import getConfiguration from plone.api.env import debug_mode diff --git a/src/plone/api/tests/test_group.py b/src/plone/api/tests/test_group.py index c1718d48..d3ac9770 100644 --- a/src/plone/api/tests/test_group.py +++ b/src/plone/api/tests/test_group.py @@ -77,7 +77,7 @@ def test_create_with_roles_and_groups(self): self.assertIn("Reviewer", ham_group.getMemberIds()) def test_get_constraints(self): - """Test the constraints for geting a group.""" + """Test the constraints for getting a group.""" from plone.api.exc import MissingParameterError with self.assertRaises(MissingParameterError): diff --git a/src/plone/api/tests/test_portal.py b/src/plone/api/tests/test_portal.py index a467ba1a..39992127 100644 --- a/src/plone/api/tests/test_portal.py +++ b/src/plone/api/tests/test_portal.py @@ -520,7 +520,7 @@ def test_get_invalid_registry_record(self): def test_get_invalid_registry_record_msg(self): """Test that the error message from trying to get a - nonexistant registry record produces an error message which + nonexistent registry record produces an error message which lists suggested registry records. """ from plone.api.exc import InvalidParameterError diff --git a/src/plone/api/tests/test_user.py b/src/plone/api/tests/test_user.py index 742383ac..bfc770e3 100644 --- a/src/plone/api/tests/test_user.py +++ b/src/plone/api/tests/test_user.py @@ -168,7 +168,7 @@ def test_create_no_roles(self): ) def test_get_constraints(self): - """Test on raised exeption if no username is given when getting the user.""" + """Test on raised exception if no username is given when getting the user.""" from plone.api.exc import MissingParameterError with self.assertRaises(MissingParameterError): diff --git a/src/plone/api/user.py b/src/plone/api/user.py index 206cbe70..1ac97d16 100644 --- a/src/plone/api/user.py +++ b/src/plone/api/user.py @@ -34,7 +34,7 @@ def create( is not used as a username. :type username: string :param password: Password for the new user. If it's not set we generate - a random 8-char alpha-numeric one. + a random 8-char alphanumeric one. :type password: string :param properties: User properties to assign to the new user. The list of available properties is available in ``portal_memberdata`` through ZMI. diff --git a/src/plone/api/validation.py b/src/plone/api/validation.py index ff972b09..d8e52b71 100644 --- a/src/plone/api/validation.py +++ b/src/plone/api/validation.py @@ -10,7 +10,7 @@ def _get_arg_spec(func, validator_args): """Get the arguments specified in the function spec. - and check that the decorator doesn't refer to non-existant args. + and check that the decorator doesn't refer to non-existent args. """ signature_args = inspect.getfullargspec(func).args extra_args = set(validator_args) - set(signature_args) From 72ebd751b7eab42272346c5caeeb73338b56bae4 Mon Sep 17 00:00:00 2001 From: Gil Forcada Codinachs Date: Sun, 25 Jun 2023 13:13:16 +0200 Subject: [PATCH 09/12] fix: declare dependencies --- setup.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 5b78990b..076aac65 100644 --- a/setup.py +++ b/setup.py @@ -32,24 +32,36 @@ def read(*rnames): python_requires=">=3.8", install_requires=[ "Products.statusmessages", + "Products.PlonePAS", + "Products.CMFPlone", "decorator", "plone.app.uuid", + "plone.app.dexterity", + "plone.app.intid", + "plone.app.layout", "plone.app.linkintegrity", + "plone.dexterity", + "plone.i18n", + "plone.registry", "plone.uuid", "setuptools", "zope.globalrequest", + "Products.CMFCore", + "z3c.relationfield", + "zc.relation", + "Zope", + "zope.intid", ], extras_require={ "test": [ - "Products.CMFPlone", + "borg.localrole", "manuel>=1.11.2", - "plone.app.dexterity", - "plone.app.intid", + "plone.app.contenttypes", + "plone.app.textfield", "plone.app.testing", + "plone.testing", "plone.indexer", "plone.registry", - "z3c.relationfield", - "zope.testrunner", ], }, classifiers=[ From 76b76cce00edfbd34550f598782267e5f149edaf Mon Sep 17 00:00:00 2001 From: Gil Forcada Codinachs Date: Sun, 15 Oct 2023 00:50:15 +0200 Subject: [PATCH 10/12] chore: cleanup setup.py --- setup.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/setup.py b/setup.py index 076aac65..d89b87a4 100644 --- a/setup.py +++ b/setup.py @@ -1,24 +1,22 @@ +from pathlib import Path from setuptools import find_packages from setuptools import setup -import os - - -def read(*rnames): - return open(os.path.join(os.path.dirname(__file__), *rnames)).read() +version = "2.1.1.dev0" long_description = ( - read("README.md") + "\n\n" + read("CHANGES.rst") + "\n\n" + read("LICENSE") + f"{Path('README.md').read_text()}\n" + f"{Path('CHANGES.rst').read_text()}\n" + f"{Path('LICENSE').read_text()}" ) -version = "2.1.1.dev0" - setup( name="plone.api", version=version, description="A Plone API.", long_description=long_description, + long_description_content_type="text/x-rst", author="Plone Foundation", author_email="plone-developers@lists.sourceforge.net", license="GPL version 2", @@ -64,6 +62,8 @@ def read(*rnames): "plone.registry", ], }, + # Get more strings from + # https://pypi.org/classifiers/ classifiers=[ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", From b5edd6a3f14545fae2f7782078d152971c466eef Mon Sep 17 00:00:00 2001 From: Gil Forcada Codinachs Date: Sun, 15 Oct 2023 01:07:10 +0200 Subject: [PATCH 11/12] fix: use the Zope distribution --- src/plone/api/env.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plone/api/env.py b/src/plone/api/env.py index a57d79fc..5eb5506a 100644 --- a/src/plone/api/env.py +++ b/src/plone/api/env.py @@ -231,4 +231,4 @@ def zope_version(): :returns: string denoting what release of Zope2 this distribution contains :Example: :ref:`env-zope-version-example` """ - return get_distribution("Zope2").version + return get_distribution("Zope").version From d5c64be8b31c91edc46dfc186978bfdb92ce08fe Mon Sep 17 00:00:00 2001 From: Gil Forcada Codinachs Date: Sun, 28 Apr 2024 12:52:51 +0200 Subject: [PATCH 12/12] fix(tox): ensure coverage reports are generated --- setup.cfg | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index c11c22e5..ba616ebe 100644 --- a/setup.cfg +++ b/setup.cfg @@ -10,7 +10,6 @@ omit = [coverage:report] precision = 2 -include = src omit = *.rst */doctests/*