diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..b4158b8 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,39 @@ +# Generated from: +# https://github.com/plone/meta/tree/master/config/default +# +# 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 +# file types + +# top-most EditorConfig file: +# Will ignore other EditorConfig files in Home directory or upper tree level. +root = true + + +[*] # For All Files +# Unix-style newlines with a newline ending every file +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +# Set default charset +charset = utf-8 +# Indent style default +indent_style = space +# Max Line Length - a hard line wrap, should be disabled +max_line_length = off + +[*.{py,cfg,ini}] +# 4 space indentation +indent_size = 4 + +[*.{yml,zpt,pt,dtml,zcml}] +# 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 diff --git a/.meta.toml b/.meta.toml new file mode 100644 index 0000000..7316575 --- /dev/null +++ b/.meta.toml @@ -0,0 +1,5 @@ +# Generated from: +# https://github.com/plone/meta/tree/master/config/default +[meta] +template = "default" +commit-id = "93e1ab65" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..449e951 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,42 @@ +# Generated from: +# https://github.com/plone/meta/tree/master/config/default +ci: + autofix_prs: false + autoupdate_schedule: monthly + +repos: +- repo: https://github.com/asottile/pyupgrade + rev: v3.3.1 + hooks: + - id: pyupgrade + args: [--py38-plus] +- repo: https://github.com/pycqa/isort + rev: 5.12.0 + hooks: + - id: isort +- repo: https://github.com/psf/black + rev: 23.1.0 + hooks: + - id: black +- repo: https://github.com/collective/zpretty + rev: 3.0.3 + hooks: + - id: zpretty +- repo: https://github.com/PyCQA/flake8 + rev: 6.0.0 + hooks: + - id: flake8 +- repo: https://github.com/codespell-project/codespell + rev: v2.2.2 + hooks: + - id: codespell + additional_dependencies: + - tomli +- 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 diff --git a/news/93e1ab65.internal b/news/93e1ab65.internal new file mode 100644 index 0000000..c08f539 --- /dev/null +++ b/news/93e1ab65.internal @@ -0,0 +1,2 @@ +Update configuration files. +[plone devs] diff --git a/plone/stringinterp/__init__.py b/plone/stringinterp/__init__.py index 32d03e1..7287e54 100644 --- a/plone/stringinterp/__init__.py +++ b/plone/stringinterp/__init__.py @@ -1 +1 @@ -from .dollarReplace import Interpolator +from .dollarReplace import Interpolator # noqa: F401 diff --git a/plone/stringinterp/interfaces.py b/plone/stringinterp/interfaces.py index dfaad3e..1733a21 100644 --- a/plone/stringinterp/interfaces.py +++ b/plone/stringinterp/interfaces.py @@ -56,8 +56,8 @@ class IContextWrapper(Interface): Usage: - >>> wrapper = IContextWrapper(obj)(m1='A message', m2="Another one") - >>> notify(CustomEvent(wrapper)) + wrapper = IContextWrapper(obj)(m1='A message', m2="Another one") + notify(CustomEvent(wrapper)) """ def __call__(kwargs): diff --git a/plone/stringinterp/tests/moreSubstitutionTests.txt b/plone/stringinterp/tests/moreSubstitutionTests.txt index e24bd8b..7eb2cbc 100644 --- a/plone/stringinterp/tests/moreSubstitutionTests.txt +++ b/plone/stringinterp/tests/moreSubstitutionTests.txt @@ -168,11 +168,7 @@ Content type Let's try some non-ASCII:: - >>> import six - >>> if six.PY2: - ... apage.setTitle('Plone in Español'.decode('utf8')) - ... else: - ... apage.setTitle('Plone in Español') + >>> apage.setTitle('Plone in Español') >>> getAdapter(apage, IStringSubstitution, 'title')() 'Plone in Espa\xf1ol' diff --git a/plone/stringinterp/tests/substitutionTests.txt b/plone/stringinterp/tests/substitutionTests.txt index 9b95e58..6141fda 100644 --- a/plone/stringinterp/tests/substitutionTests.txt +++ b/plone/stringinterp/tests/substitutionTests.txt @@ -153,11 +153,7 @@ Content type Let's try some non-ASCII:: - >>> import six - >>> if six.PY2: - ... apage.setTitle('Plone in Español'.decode('utf8')) - ... else: - ... apage.setTitle('Plone in Español') + >>> apage.setTitle('Plone in Español') >>> getAdapter(apage, IStringSubstitution, 'title')() 'Plone in Espa\xf1ol' diff --git a/plone/stringinterp/tests/wrapperTests.txt b/plone/stringinterp/tests/wrapperTests.txt index 70b5986..06c5114 100644 --- a/plone/stringinterp/tests/wrapperTests.txt +++ b/plone/stringinterp/tests/wrapperTests.txt @@ -202,11 +202,7 @@ Content type Let's try some non-ASCII:: - >>> import six - >>> if six.PY2: - ... apage.setTitle('Plone in Español'.decode('utf8')) - ... else: - ... apage.setTitle('Plone in Español') + >>> apage.setTitle('Plone in Español') >>> getAdapter(apage, IStringSubstitution, 'title')() 'Plone in Espa\xf1ol' diff --git a/pyproject.toml b/pyproject.toml index 05b615d..9eb73f3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,5 @@ +# Generated from: +# https://github.com/plone/meta/tree/master/config/default [tool.towncrier] filename = "CHANGES.rst" directory = "news/" @@ -18,3 +20,43 @@ showcontent = true directory = "bugfix" name = "Bug fixes:" showcontent = true + +[[tool.towncrier.type]] +directory = "internal" +name = "Internal:" +showcontent = true + +[[tool.towncrier.type]] +directory = "documentation" +name = "Documentation:" +showcontent = true + +[[tool.towncrier.type]] +directory = "tests" +name = "Tests" +showcontent = true + +[tool.isort] +profile = "plone" + +[tool.black] +target-version = ["py38"] + +[tool.dependencychecker] +Zope = [ + # Zope own provided namespaces + 'App', 'OFS', 'Products.Five', 'Products.OFSP', 'Products.PageTemplates', + 'Products.SiteAccess', 'Shared', 'Testing', 'ZPublisher', 'ZTUtils', + 'Zope2', 'webdav', 'zmi', + # 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', +] +'plone.base' = [ + 'AccessControl', 'Products.BTreeFolder2', 'Products.CMFCore', + 'Products.CMFDynamicViewFTI', 'zope.deprecation', +] +python-dateutil = ['dateutil'] diff --git a/setup.cfg b/setup.cfg index 3293a61..0da8f8f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,23 @@ +# Generated from: +# https://github.com/plone/meta/tree/master/config/default [bdist_wheel] universal = 0 -[isort] -profile = plone \ No newline at end of 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, + +[check-manifest] +ignore = + .editorconfig + .meta.toml + .pre-commit-config.yaml + tox.ini diff --git a/setup.py b/setup.py index 1d17d3d..7248895 100644 --- a/setup.py +++ b/setup.py @@ -33,15 +33,17 @@ namespace_packages=["plone"], include_package_data=True, zip_safe=False, + python_requires=">=3.8", install_requires=[ "setuptools", "plone.base", "plone.memoize", "zope.i18n", + "Products.PlonePAS", ], extras_require={ "test": [ - "plone.app.contenttypes", + "plone.app.contenttypes[test]", "plone.app.testing", "plone.testing", ], diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..725213e --- /dev/null +++ b/tox.ini @@ -0,0 +1,54 @@ +# Generated from: +# https://github.com/plone/meta/tree/master/config/default +[tox] +# We need 4.4.0 for constrain_package_deps. +min_version = 4.4.0 +envlist = + format + lint + test + +[testenv] +allowlist_externals = + sh + +[testenv:format] +description = automatically reformat code +skip_install = true +deps = + pre-commit +commands = + pre-commit run -a pyupgrade + pre-commit run -a isort + pre-commit run -a black + pre-commit run -a zpretty + +[testenv:lint] +description = run linters that will help improve the code style +skip_install = true +deps = + pre-commit +commands = + pre-commit run -a + +[testenv:dependencies] +description = check if the package defines all its dependencies and generate a graph out of them +deps = + z3c.dependencychecker==2.11 + 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' + +[testenv:test] +usedevelop = true +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.stringinterp {posargs} +extras = + test