From 43b1ddd2ac7a991440ccec3dce4dae2abec57e82 Mon Sep 17 00:00:00 2001 From: Gil Forcada Codinachs Date: Sun, 18 Jun 2023 23:54:02 +0200 Subject: [PATCH 1/2] Configuring with plone/meta --- .editorconfig | 14 +++++ .flake8 | 22 +++++++ .github/workflows/meta.yml | 28 +++++++++ .gitignore | 55 +++++++++++++---- .meta.toml | 10 ++-- .pre-commit-config.yaml | 34 +++++++++++ news/7723aeaf.internal | 2 + pyproject.toml | 86 ++++++++++++++++++++++++--- tox.ini | 117 ++++++++++++++++++++++++++++++++++--- 9 files changed, 336 insertions(+), 32 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 9f0e0cb..81594fd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,51 @@ +# 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 *.pyo -build -dist -bin/ -lib/ -include/ -parts/ -.installed.cfg + +# tools related +build/ +.coverage +coverage.xml +dist/ +docs/_build +__pycache__/ .tox -dependencies.svg +.vscode/ +node_modules/ + +# venv / buildout related +bin/ develop-eggs/ eggs/ -local/ -pip-selfcheck.json +.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 6d9d74f..1bb79ef 100644 --- a/.meta.toml +++ b/.meta.toml @@ -1,13 +1,11 @@ # 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 = "993150bc" +commit-id = "7723aeaf" -[codespell] -additional-ignores = "discreet" - -[dependencies] -mappings = [ +[pyproject] +dependencies_mappings = [ "beautifulsoup4 = ['bs4']", ] 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 c3b09fa..b2d4492 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 = ["-", ""] @@ -43,7 +44,14 @@ profile = "plone" target-version = ["py38"] [tool.codespell] -ignore-words-list = "discreet" +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 = [ @@ -51,16 +59,76 @@ Zope = [ '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'] beautifulsoup4 = ['bs4'] + +## +# 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", + +] +## +# 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 62e2436..1328c5b 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,22 +52,105 @@ 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 +commands = + zope-testrunner --all --test-path={toxinidir} -s plone.outputfilters {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 = - zope-testrunner --test-path={toxinidir} -s plone.outputfilters {posargs} + coverage run --branch --source plone.outputfilters {envbindir}/zope-testrunner --quiet --all --test-path={toxinidir} -s plone.outputfilters {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 de063bd5aefec3d72973c7a10db57b8ce9dd5291 Mon Sep 17 00:00:00 2001 From: Gil Forcada Codinachs Date: Sun, 18 Jun 2023 23:54:09 +0200 Subject: [PATCH 2/2] cleanup: remove unused file --- setup.cfg | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 setup.cfg diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 0da8f8f..0000000 --- a/setup.cfg +++ /dev/null @@ -1,23 +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