From 3655e280e5f934acabe66a15e3bbe88ac2a8939c Mon Sep 17 00:00:00 2001 From: Gil Forcada Codinachs Date: Sun, 18 Jun 2023 10:10:33 +0200 Subject: [PATCH 1/2] Configuring with plone/meta --- .editorconfig | 14 +++++ .flake8 | 22 +++++++ .github/workflows/meta.yml | 28 +++++++++ .gitignore | 72 +++++++++++++++-------- .meta.toml | 14 ++--- .pre-commit-config.yaml | 34 +++++++++++ news/7723aeaf.internal | 2 + pyproject.toml | 89 +++++++++++++++++++++++++--- tox.ini | 115 +++++++++++++++++++++++++++++++++++-- 9 files changed, 346 insertions(+), 44 deletions(-) create mode 100644 .flake8 create mode 100644 .github/workflows/meta.yml create mode 100644 news/7723aeaf.internal diff --git a/.editorconfig b/.editorconfig index b4158b8..919b411 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,5 +1,6 @@ # Generated from: # https://github.com/plone/meta/tree/master/config/default +# See the inline comments on how to expand/tweak this configuration file # # EditorConfig Configuration file, for more details see: # http://EditorConfig.org @@ -32,8 +33,21 @@ indent_size = 4 # 2 space indentation indent_size = 2 +[*.{json,jsonl,js,jsx,ts,tsx,css,less,scss,html}] # Frontend development +# 2 space indentation +indent_size = 2 + [{Makefile,.gitmodules}] # Tab indentation (no size specified, but view as 4 spaces) indent_style = tab indent_size = unset tab_width = unset + + +## +# 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 0000000..7ef4f64 --- /dev/null +++ b/.flake8 @@ -0,0 +1,22 @@ +# Generated from: +# https://github.com/plone/meta/tree/master/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 0000000..4748f0f --- /dev/null +++ b/.github/workflows/meta.yml @@ -0,0 +1,28 @@ +# Generated from: +# https://github.com/plone/meta/tree/master/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: + +jobs: + qa: + uses: plone/meta/.github/workflows/qa.yml@master + test: + uses: plone/meta/.github/workflows/test.yml@master + coverage: + uses: plone/meta/.github/workflows/coverage.yml@master + dependencies: + uses: plone/meta/.github/workflows/dependencies.yml@master + release-ready: + uses: plone/meta/.github/workflows/release_ready.yml@master + circular: + uses: plone/meta/.github/workflows/circular.yml@master diff --git a/.gitignore b/.gitignore index 66edeab..81594fd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,25 +1,51 @@ -/develop-eggs -/eggs -/fake-eggs -/bin -/parts -/downloads -/var -/build -/dist -/local.cfg -/*.egg-info -/.installed.cfg -/.mr.developer.cfg +# Generated from: +# https://github.com/plone/meta/tree/master/config/default +# See the inline comments on how to expand/tweak this configuration file +# python related +*.egg-info *.pyc -/.Python -/include -/lib -/.project -/.pydevproject -/src/* -*.mo -/.coverage +*.pyo + +# tools related +build/ +.coverage coverage.xml -zptlint.log -/venv \ No newline at end of file +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/ + +# 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 index e5ff8a0..62b584f 100644 --- a/.meta.toml +++ b/.meta.toml @@ -1,15 +1,15 @@ # Generated from: # https://github.com/plone/meta/tree/master/config/default +# See the inline comments on how to expand/tweak this configuration file [meta] template = "default" -commit-id = "c79ab88f" +commit-id = "7723aeaf" -[check-manifest] -additional-ignores = [ +[pyproject] +check_manifest_ignores = """ "*.cfg", - ] - -[dependencies] -mappings = [ +""" +dependencies_ignores = "['plone.app.vocabularies']" +dependencies_mappings = [ "ExtensionClass = ['ComputedAttribute']", ] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ea50e47..5ef2b81 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,6 @@ # Generated from: # https://github.com/plone/meta/tree/master/config/default +# See the inline comments on how to expand/tweak this configuration file ci: autofix_prs: false autoupdate_schedule: monthly @@ -22,6 +23,14 @@ repos: rev: 3.1.0a2 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: 6.0.0 hooks: @@ -32,6 +41,14 @@ repos: - id: codespell additional_dependencies: - tomli + +## +# 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: @@ -40,3 +57,20 @@ repos: rev: "4.2" hooks: - id: pyroma +- repo: https://github.com/mgedmin/check-python-versions + rev: "0.21.2" + hooks: + - id: check-python-versions + args: ['--only', 'setup.py,pyproject.toml'] +- repo: https://github.com/collective/i18ndude + rev: "6.0.0" + hooks: + - id: i18ndude + +## +# Add extra configuration options in .meta.toml: +# [pre_commit] +# extra_lines = """ +# _your own configuration lines_ +# """ +## diff --git a/news/7723aeaf.internal b/news/7723aeaf.internal new file mode 100644 index 0000000..c08f539 --- /dev/null +++ b/news/7723aeaf.internal @@ -0,0 +1,2 @@ +Update configuration files. +[plone devs] diff --git a/pyproject.toml b/pyproject.toml index 75ac6eb..5378200 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,9 @@ # Generated from: # https://github.com/plone/meta/tree/master/config/default +# See the inline comments on how to expand/tweak this configuration file [tool.towncrier] -filename = "CHANGES.rst" directory = "news/" +filename = "CHANGES.rst" title_format = "{version} ({project_date})" underlines = ["-", ""] @@ -42,22 +43,94 @@ profile = "plone" [tool.black] target-version = ["py38"] +[tool.codespell] +ignore-words-list = "discreet," +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 - 'Acquisition', 'DateTime', 'transaction', 'zExceptions', 'ZODB', 'zope.component', - 'zope.configuration', 'zope.container', 'zope.deferredimport', 'zope.event', - 'zope.exceptions', 'zope.globalrequest', 'zope.i18n', 'zope.i18nmessageid', - 'zope.interface', 'zope.lifecycleevent', 'zope.location', 'zope.publisher', - 'zope.schema', 'zope.security', 'zope.site', 'zope.traversing', 'AccessControl', + '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' = [ - 'AccessControl', 'Products.BTreeFolder2', 'Products.CMFCore', - 'Products.CMFDynamicViewFTI', 'zope.deprecation', + 'plone.batching', 'plone.registry', 'plone.schema','plone.z3cform', + 'Products.CMFCore', 'Products.CMFDynamicViewFTI', ] python-dateutil = ['dateutil'] +ignore-packages = ['plone.app.vocabularies'] ExtensionClass = ['ComputedAttribute'] + +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# dependencies_ignores = "['zestreleaser.towncrier']" +# dependencies_mappings = [ +# "gitpython = ['git']", +# "pygithub = ['github']", +# ] +# """ +## + +[tool.check-manifest] +ignore = [ + ".editorconfig", + ".meta.toml", + ".pre-commit-config.yaml", + "tox.ini", + ".flake8", + "mx.ini", + "*.cfg", + +] +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# check_manifest_ignores = """ +# "*.map.js", +# "*.pyc", +# """ +## + + +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# extra_lines = """ +# _your own configuration lines_ +# """ +## diff --git a/tox.ini b/tox.ini index 21286ef..4789803 100644 --- a/tox.ini +++ b/tox.ini @@ -1,16 +1,36 @@ # Generated from: # https://github.com/plone/meta/tree/master/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 = - format lint test + dependencies + + +## +# 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 allowlist_externals = - sh + 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 [testenv:format] description = automatically reformat code @@ -32,18 +52,32 @@ commands = pre-commit run -a [testenv:dependencies] -description = check if the package defines all its dependencies and generate a graph out of them +description = check if the package defines all its dependencies +skip_install = true deps = + build z3c.dependencychecker==2.11 +commands = + python -m build --sdist --no-isolation + dependencychecker + +[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 = - dependencychecker - sh -c 'pipdeptree --exclude setuptools,wheel,pipdeptree,z3c.dependencychecker,zope.interface,zope.component --graph-output svg > dependencies.svg' + sh -c 'pipdeptree --exclude setuptools,wheel,pipdeptree,zope.interface,zope.component --graph-output svg > dependencies.svg' [testenv:test] -usedevelop = true +description = run the distribution tests +use_develop = true +skip_install = false constrain_package_deps = true +set_env = ROBOT_BROWSER=headlesschrome deps = zope.testrunner -c https://dist.plone.org/release/6.0-dev/constraints.txt @@ -51,3 +85,72 @@ commands = zope-testrunner --all --test-path={toxinidir} -s plone.portlet.collection {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 +deps = + coverage + zope.testrunner + -c https://dist.plone.org/release/6.0-dev/constraints.txt +commands = + coverage run --branch --source plone.portlet.collection {envbindir}/zope-testrunner --quiet --all --test-path={toxinidir} -s plone.portlet.collection {posargs} + coverage report -m --format markdown +extras = + test + + +[testenv:release-check] +description = ensure that the distribution is ready to release +skip_install = true +deps = + twine + build + towncrier + -c https://dist.plone.org/release/6.0-dev/constraints.txt +commands = + # 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 --no-isolation + twine check dist/* + +[testenv:circular] +description = ensure there are no cyclic dependencies +use_develop = true +skip_install = false +allowlist_externals = + sh +deps = + pipdeptree + pipforester + -c https://dist.plone.org/release/6.0-dev/constraints.txt +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 + + +## +# Add extra configuration options in .meta.toml: +# [tox] +# extra_lines = """ +# my_other_environment +# """ +## From 19df2052289e577ede3243ceba2a3297466a12e1 Mon Sep 17 00:00:00 2001 From: Gil Forcada Codinachs Date: Sun, 18 Jun 2023 10:10:49 +0200 Subject: [PATCH 2/2] cleanup: remove unused file --- setup.cfg | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 setup.cfg diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index a9fb345..0000000 --- a/setup.cfg +++ /dev/null @@ -1,24 +0,0 @@ -# Generated from: -# https://github.com/plone/meta/tree/master/config/default -[bdist_wheel] -universal = 0 - -[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, - -[check-manifest] -ignore = - .editorconfig - .meta.toml - .pre-commit-config.yaml - tox.ini - *.cfg