From 0150ed3e5a3eceb4ed1bd91b847902731818f7b2 Mon Sep 17 00:00:00 2001 From: Mauro Amico Date: Fri, 24 May 2024 01:28:12 +0200 Subject: [PATCH] Configuring with plone/meta (#57) * Configuring with plone/meta * black * gocept.pytestlayer deprecated * dpes --- .editorconfig | 10 ++++++---- .flake8 | 2 +- .github/workflows/meta.yml | 9 ++++++++- .gitignore | 8 +++++++- .meta.toml | 4 ++-- .pre-commit-config.yaml | 12 ++++++------ dependabot.yml | 11 +++++++++++ news/+meta.internal | 1 + pyproject.toml | 15 +++++++++++---- setup.py | 9 ++++++++- tox.ini | 20 +++++++++++++++----- 11 files changed, 76 insertions(+), 25 deletions(-) create mode 100644 dependabot.yml create mode 100644 news/+meta.internal diff --git a/.editorconfig b/.editorconfig index 8ae05aa..5b3c112 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,5 +1,5 @@ # Generated from: -# https://github.com/plone/meta/tree/master/config/default +# 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: @@ -13,7 +13,8 @@ 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 @@ -29,11 +30,12 @@ max_line_length = off # 4 space indentation indent_size = 4 -[*.{yml,zpt,pt,dtml,zcml}] +[*.{yml,zpt,pt,dtml,zcml,html,xml}] # 2 space indentation indent_size = 2 -[*.{json,jsonl,js,jsx,ts,tsx,css,less,scss,html}] # Frontend development +[*.{json,jsonl,js,jsx,ts,tsx,css,less,scss}] +# Frontend development # 2 space indentation indent_size = 2 max_line_length = 80 diff --git a/.flake8 b/.flake8 index 7ef4f64..38918f4 100644 --- a/.flake8 +++ b/.flake8 @@ -1,5 +1,5 @@ # Generated from: -# https://github.com/plone/meta/tree/master/config/default +# https://github.com/plone/meta/tree/main/config/default # See the inline comments on how to expand/tweak this configuration file [flake8] doctests = 1 diff --git a/.github/workflows/meta.yml b/.github/workflows/meta.yml index c9db54b..a6d69e4 100644 --- a/.github/workflows/meta.yml +++ b/.github/workflows/meta.yml @@ -1,5 +1,5 @@ # Generated from: -# https://github.com/plone/meta/tree/master/config/default +# https://github.com/plone/meta/tree/main/config/default # See the inline comments on how to expand/tweak this configuration file name: Meta on: @@ -55,6 +55,13 @@ 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/.gitignore b/.gitignore index c16e8e1..cbb3669 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # Generated from: -# https://github.com/plone/meta/tree/master/config/default +# 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 @@ -35,6 +35,7 @@ lib64 parts/ pyvenv.cfg var/ +local.cfg # mxdev /instance/ @@ -47,6 +48,11 @@ var/ requirements-mxdev.txt +/.python-version +/dependencies.svg +/forest.* + + ## # Add extra configuration options in .meta.toml: # [gitignore] diff --git a/.meta.toml b/.meta.toml index e52317c..3500e6c 100644 --- a/.meta.toml +++ b/.meta.toml @@ -1,9 +1,9 @@ # Generated from: -# https://github.com/plone/meta/tree/master/config/default +# 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 = "8c30aa23" +commit-id = "721299ce" [pyproject] codespell_skip = "*.min.js,*.pot,*.po,*.yaml,*.json" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 907d758..3bb55da 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,5 @@ # Generated from: -# https://github.com/plone/meta/tree/master/config/default +# 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 @@ -7,16 +7,16 @@ ci: repos: - repo: https://github.com/asottile/pyupgrade - rev: v3.15.0 + rev: v3.15.2 hooks: - id: pyupgrade args: [--py38-plus] - repo: https://github.com/pycqa/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort - repo: https://github.com/psf/black - rev: 23.10.1 + rev: 24.4.2 hooks: - id: black - repo: https://github.com/collective/zpretty @@ -32,7 +32,7 @@ repos: # """ ## - repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 + rev: 7.0.0 hooks: - id: flake8 @@ -71,7 +71,7 @@ repos: - id: check-python-versions args: ['--only', 'setup.py,pyproject.toml'] - repo: https://github.com/collective/i18ndude - rev: "6.1.0" + rev: "6.2.0" hooks: - id: i18ndude diff --git a/dependabot.yml b/dependabot.yml new file mode 100644 index 0000000..bbd3ab0 --- /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/+meta.internal b/news/+meta.internal new file mode 100644 index 0000000..1526bc2 --- /dev/null +++ b/news/+meta.internal @@ -0,0 +1 @@ +Update configuration files @plone \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 851cf49..2d8fd56 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ # Generated from: -# https://github.com/plone/meta/tree/master/config/default +# 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"] @@ -122,7 +122,7 @@ Zope = [ 'Products.CMFCore', 'Products.CMFDynamicViewFTI', ] python-dateutil = ['dateutil'] -ignore-packages = ['plone.restapi', 'plone.volto', 'zestreleaser.towncrier', 'zest.releaser', 'pytest', 'pytest-cov', 'pytest-plone', 'pytest-docker', 'pytest-vcr', 'pytest-mock', 'gocept.pytestlayer', 'requests-mock', 'vcrpy'] +ignore-packages = ['plone.restapi', 'plone.volto', 'zestreleaser.towncrier', 'zest.releaser', 'pytest', 'pytest-cov', 'pytest-plone', 'pytest-docker', 'pytest-vcr', 'pytest-mock', 'zope.pytestlayer', 'requests-mock', 'vcrpy'] Plone = ['Products.CMFPlone', 'Products.CMFCore', 'Products.GenericSetup', 'Products.PluggableAuthService', 'Products.PlonePAS'] ## @@ -138,16 +138,18 @@ Plone = ['Products.CMFPlone', 'Products.CMFCore', 'Products.GenericSetup', 'Prod [tool.check-manifest] ignore = [ ".editorconfig", + ".flake8", ".meta.toml", ".pre-commit-config.yaml", - "tox.ini", - ".flake8", + "dependabot.yml", "mx.ini", + "tox.ini", "news/*", "constraints-mxdev.txt", "requirements-mxdev.txt", ] + ## # Add extra configuration options in .meta.toml: # [pyproject] @@ -155,6 +157,11 @@ ignore = [ # "*.map.js", # "*.pyc", # """ +# check_manifest_extra_lines = """ +# ignore-bad-ideas = [ +# "some/test/file/PKG-INFO", +# ] +# """ ## [tool.coverage.run] diff --git a/setup.py b/setup.py index c601816..e0b252a 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,5 @@ """Installer for the pas.plugins.oidc package.""" + from pathlib import Path from setuptools import find_packages from setuptools import setup @@ -52,15 +53,21 @@ install_requires=[ "setuptools", "Plone", + "Zope", + "Products.CMFCore", "plone.api", + "plone.base", + "plone.protect", "plone.restapi>=8.34.0", "oic", ], extras_require={ "test": [ - "gocept.pytestlayer", + "zope.pytestlayer", + "plone.app.contenttypes", "plone.app.testing", "plone.restapi[test]", + "plone.testing", "pytest-cov", "pytest-plone>=0.2.0", "pytest-docker", diff --git a/tox.ini b/tox.ini index 3724172..f3f1cca 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ # Generated from: -# https://github.com/plone/meta/tree/master/config/default +# 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. @@ -74,7 +74,7 @@ description = check if the package defines all its dependencies skip_install = true deps = build - z3c.dependencychecker==2.11 + z3c.dependencychecker==2.14.3 commands = python -m build --sdist dependencychecker @@ -150,13 +150,20 @@ set_env = # Set constrain_package_deps .meta.toml: # [tox] # constrain_package_deps = "false" +# +# Explicitly set the package name .meta.toml: +# (For cases where the repository name is not the same of +# the package name) +# [tox] +# package_name = "pytest_plone" +# ## deps = pytest-plone pytest coverage -c constraints-mxdev.txt - + commands = coverage run --source pas.plugins.oidc -m pytest {posargs} --disable-warnings {toxinidir}/tests coverage report -m --format markdown @@ -173,7 +180,7 @@ deps = build towncrier -c constraints-mxdev.txt - + commands = # fake version to not have to install the package # we build the change log as news entries might break @@ -186,6 +193,9 @@ commands = 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 = ## @@ -201,7 +211,7 @@ deps = pipdeptree pipforester -c constraints-mxdev.txt - + commands = # Generate the full dependency tree sh -c 'pipdeptree -j > forest.json'