From e70eb5a4ccef04407ae9c569cb03b354b610e6d4 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Mon, 30 Sep 2024 08:54:00 +0200 Subject: [PATCH] - Add support for Python 3.12. - Drop support for Python 3.7. (#9) * Update to current meta/config to fix GHA * Drop support for Python 3.7. * Add support for Python 3.12, 3.13. --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> --- .coveragerc | 27 ------ .github/workflows/pre-commit.yml | 33 +++++++ .github/workflows/tests.yml | 32 ++++--- .meta.toml | 4 +- .pre-commit-config.yaml | 28 ++++++ CHANGES.rst | 4 +- MANIFEST.in | 2 +- docs/conf.py | 150 ++++++++++++++++--------------- docs/index.rst | 2 +- pyproject.toml | 26 ++++++ setup.cfg | 2 - setup.py | 88 +++++++++--------- src/z3c/recipe/mkdir/__init__.py | 11 +-- src/z3c/recipe/mkdir/tests.py | 4 +- tox.ini | 47 ++++++---- 15 files changed, 275 insertions(+), 185 deletions(-) delete mode 100644 .coveragerc create mode 100644 .github/workflows/pre-commit.yml create mode 100644 .pre-commit-config.yaml create mode 100644 pyproject.toml diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index 1f684af..0000000 --- a/.coveragerc +++ /dev/null @@ -1,27 +0,0 @@ -# Generated from: -# https://github.com/zopefoundation/meta/tree/master/config/buildout-recipe -[run] -source = z3c.recipe.mkdir -branch = true -parallel = true - -[paths] -source = - src/ - .tox/*/lib/python*/site-packages/ - .tox/pypy*/site-packages/ - -[report] -precision = 2 -exclude_lines = - except ImportError: - if __name__ == '__main__': - pragma: no cover - pragma: nocover - raise AssertionError - raise NotImplementedError - raise unittest.Skip - self.fail\( - -[html] -directory = parts/htmlcov diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..9028d88 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,33 @@ +# Generated from: +# https://github.com/zopefoundation/meta/tree/master/config/buildout-recipe +name: pre-commit + +on: + pull_request: + push: + branches: + - master + # Allow to run this workflow manually from the Actions tab + workflow_dispatch: + +env: + FORCE_COLOR: 1 + +jobs: + pre-commit: + name: linting + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - uses: pre-commit/action@v3.0.1 + with: + extra_args: --all-files --show-diff-on-failure + env: + PRE_COMMIT_COLOR: always + - uses: pre-commit-ci/lite-action@v1.0.2 + if: always() + with: + msg: Apply pre-commit code formatting diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 977d152..c3b7a01 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,30 +17,32 @@ jobs: fail-fast: false matrix: os: - - ["ubuntu", "ubuntu-20.04"] + - ["ubuntu", "ubuntu-latest"] config: # [Python version, tox env] - - ["3.9", "lint"] - - ["3.7", "py37"] - - ["3.8", "py38"] - - ["3.9", "py39"] - - ["3.10", "py310"] - - ["3.11", "py311"] - - ["pypy-3.9", "pypy3"] - - ["3.9", "docs"] - - ["3.9", "coverage"] + - ["3.11", "release-check"] + - ["3.8", "py38"] + - ["3.9", "py39"] + - ["3.10", "py310"] + - ["3.11", "py311"] + - ["3.12", "py312"] + - ["3.13", "py313"] + - ["pypy-3.10", "pypy3"] + - ["3.11", "docs"] + - ["3.11", "coverage"] runs-on: ${{ matrix.os[1] }} if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name name: ${{ matrix.config[1] }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.config[0] }} + allow-prereleases: true - name: Pip cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('setup.*', 'tox.ini') }} @@ -52,7 +54,11 @@ jobs: python -m pip install --upgrade pip pip install tox - name: Test + if: ${{ !startsWith(runner.os, 'Mac') }} run: tox -e ${{ matrix.config[1] }} + - name: Test (macOS) + if: ${{ startsWith(runner.os, 'Mac') }} + run: tox -e ${{ matrix.config[1] }}-universal2 - name: Coverage if: matrix.config[1] == 'coverage' run: | diff --git a/.meta.toml b/.meta.toml index e4d32af..6888173 100644 --- a/.meta.toml +++ b/.meta.toml @@ -2,7 +2,7 @@ # https://github.com/zopefoundation/meta/tree/master/config/buildout-recipe [meta] template = "buildout-recipe" -commit-id = "b21fbbf2" +commit-id = "85622de1" [python] with-pypy = true @@ -13,7 +13,7 @@ with-future-python = false with-macos = false [coverage] -fail-under = 91 +fail-under = 89 [check-manifest] additional-ignores = [ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..08c81ef --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,28 @@ +# Generated from: +# https://github.com/zopefoundation/meta/tree/master/config/buildout-recipe +minimum_pre_commit_version: '3.6' +repos: + - repo: https://github.com/pycqa/isort + rev: "5.13.2" + hooks: + - id: isort + - repo: https://github.com/hhatto/autopep8 + rev: "v2.3.1" + hooks: + - id: autopep8 + args: [--in-place, --aggressive, --aggressive] + - repo: https://github.com/asottile/pyupgrade + rev: v3.17.0 + hooks: + - id: pyupgrade + args: [--py38-plus] + - repo: https://github.com/isidentical/teyit + rev: 0.4.3 + hooks: + - id: teyit + - repo: https://github.com/PyCQA/flake8 + rev: "7.1.1" + hooks: + - id: flake8 + additional_dependencies: + - flake8-debugger == 4.1.2 diff --git a/CHANGES.rst b/CHANGES.rst index f0c4151..6a8d68b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,9 @@ Changes 1.1 (unreleased) ================ -- Nothing changed yet. +- Add support for Python 3.12, 3.13. + +- Drop support for Python 3.7. 1.0 (2023-01-06) diff --git a/MANIFEST.in b/MANIFEST.in index 7116a85..f27184a 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -5,7 +5,7 @@ include *.rst include *.txt include buildout.cfg include tox.ini -include .coveragerc +include .pre-commit-config.yaml recursive-include docs *.py recursive-include docs *.rst diff --git a/docs/conf.py b/docs/conf.py index 7e8ad31..e3ae39b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,9 +1,9 @@ -# -*- coding: utf-8 -*- # # z3c.recipe.mkdir documentation build configuration file, created by # sphinx-quickstart on Tue May 21 16:41:32 2013. # -# This file is execfile()d with the current directory set to its containing dir. +# This file is execfile()d with the current directory set to its containing +# dir. # # Note that not all possible configuration values are present in this # autogenerated file. @@ -11,21 +11,23 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys, os - # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) +# sys.path.insert(0, os.path.abspath('.')) -# -- General configuration ----------------------------------------------------- +# -- General configuration ----------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' +# needs_sphinx = '1.0' -# Add any Sphinx extension module names here, as strings. They can be extensions -# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.viewcode'] +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.doctest', + 'sphinx.ext.intersphinx', + 'sphinx.ext.viewcode'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -34,14 +36,14 @@ source_suffix = '.rst' # The encoding of source files. -#source_encoding = 'utf-8-sig' +# source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. -project = u'z3c.recipe.mkdir' -copyright = u'2013, Zope Foundation Contributors' +project = 'z3c.recipe.mkdir' +copyright = '2013, Zope Foundation Contributors' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -54,43 +56,44 @@ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -#language = None +# language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -#today = '' +# today = '' # Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' +# today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build'] -# The reST default role (used for this markup: `text`) to use for all documents. -#default_role = None +# The reST default role (used for this markup: `text`) to use for all +# documents. +# default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True +# add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -#add_module_names = True +# add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -#show_authors = False +# show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] +# modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. -#keep_warnings = False +# keep_warnings = False -# -- Options for HTML output --------------------------------------------------- +# -- Options for HTML output --------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. @@ -99,26 +102,26 @@ # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -#html_theme_options = {} +# html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] +# html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -#html_title = None +# html_title = None # A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None +# html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. -#html_logo = None +# html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -#html_favicon = None +# html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, @@ -127,126 +130,131 @@ # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' +# html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. -#html_use_smartypants = True +# html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. -#html_additional_pages = {} +# html_additional_pages = {} # If false, no module index is generated. -#html_domain_indices = True +# html_domain_indices = True # If false, no index is generated. -#html_use_index = True +# html_use_index = True # If true, the index is split into individual pages for each letter. -#html_split_index = False +# html_split_index = False # If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True +# html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True +# html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True +# html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -#html_use_opensearch = '' +# html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None +# html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'z3crecipemkdirdoc' -# -- Options for LaTeX output -------------------------------------------------- +# -- Options for LaTeX output -------------------------------------------- latex_elements = { -# The paper size ('letterpaper' or 'a4paper'). -#'papersize': 'letterpaper', + # The paper size ('letterpaper' or 'a4paper'). + # 'papersize': 'letterpaper', -# The font size ('10pt', '11pt' or '12pt'). -#'pointsize': '10pt', + # The font size ('10pt', '11pt' or '12pt'). + # 'pointsize': '10pt', -# Additional stuff for the LaTeX preamble. -#'preamble': '', + # Additional stuff for the LaTeX preamble. + # 'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, author, documentclass [howto/manual]). +# (source start file, target name, title, author, documentclass +# [howto/manual]). latex_documents = [ - ('index', 'z3crecipemkdir.tex', u'z3c.recipe.mkdir Documentation', - u'Zope Foundation Contributors', 'manual'), + ('index', 'z3crecipemkdir.tex', 'z3c.recipe.mkdir Documentation', + 'Zope Foundation Contributors', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. -#latex_logo = None +# latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. -#latex_use_parts = False +# latex_use_parts = False # If true, show page references after internal links. -#latex_show_pagerefs = False +# latex_show_pagerefs = False # If true, show URL addresses after external links. -#latex_show_urls = False +# latex_show_urls = False # Documents to append as an appendix to all manuals. -#latex_appendices = [] +# latex_appendices = [] # If false, no module index is generated. -#latex_domain_indices = True +# latex_domain_indices = True -# -- Options for manual page output -------------------------------------------- +# -- Options for manual page output -------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - ('index', 'z3crecipemkdir', u'z3c.recipe.mkdir Documentation', - [u'Zope Foundation Contributors'], 1) + ('index', 'z3crecipemkdir', 'z3c.recipe.mkdir Documentation', + ['Zope Foundation Contributors'], 1) ] # If true, show URL addresses after external links. -#man_show_urls = False +# man_show_urls = False -# -- Options for Texinfo output ------------------------------------------------ +# -- Options for Texinfo output ------------------------------------------ # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ('index', 'z3crecipemkdir', u'z3c.recipe.mkdir Documentation', - u'Zope Foundation Contributors', 'z3crecipemkdir', 'One line description of project.', - 'Miscellaneous'), + ('index', + 'z3crecipemkdir', + 'z3c.recipe.mkdir Documentation', + 'Zope Foundation Contributors', + 'z3crecipemkdir', + 'One line description of project.', + 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. -#texinfo_appendices = [] +# texinfo_appendices = [] # If false, no module index is generated. -#texinfo_domain_indices = True +# texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. -#texinfo_show_urls = 'footnote' +# texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. -#texinfo_no_detailmenu = False +# texinfo_no_detailmenu = False # Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = {'http://docs.python.org/': None} +intersphinx_mapping = {'python': ('http://docs.python.org/', None)} diff --git a/docs/index.rst b/docs/index.rst index db9dcbd..e8b9f6a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -53,4 +53,4 @@ mode, if your system supports that: will create any non-existing directory ``foo/`` and ``foo/bar/`` with permissions set as told. -.. include:: ../z3c/recipe/mkdir/README.rst +.. include:: ../src/z3c/recipe/mkdir/README.rst diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..72466a8 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,26 @@ +# +# Generated from: +# https://github.com/zopefoundation/meta/tree/master/config/buildout-recipe + +[build-system] +requires = ["setuptools<74"] +build-backend = "setuptools.build_meta" + +[tool.coverage] +[tool.coverage.run] +branch = true +source = ["z3c.recipe.mkdir"] +parallel = true + +[tool.coverage.report] +fail_under = 89 +precision = 2 +ignore_errors = true +show_missing = true +exclude_lines = ["pragma: no cover", "pragma: nocover", "except ImportError:", "raise NotImplementedError", "if __name__ == '__main__':", "self.fail", "raise AssertionError", "raise unittest.Skip"] + +[tool.coverage.html] +directory = "parts/htmlcov" + +[tool.coverage.paths] +source = ["src/", ".tox/*/lib/python*/site-packages/", ".tox/pypy*/site-packages/"] diff --git a/setup.cfg b/setup.cfg index 3c0c155..7c04b70 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,5 @@ # Generated from: # https://github.com/zopefoundation/meta/tree/master/config/buildout-recipe -[bdist_wheel] -universal = 0 [flake8] doctests = 1 diff --git a/setup.py b/setup.py index 4c0a82d..6347d90 100644 --- a/setup.py +++ b/setup.py @@ -21,49 +21,51 @@ ] DOCS_REQUIRE = ['Sphinx'] -setup(name='z3c.recipe.mkdir', - version=version, - description="Buildout recipe to create directories.", - long_description=README + "\n\n" + CHANGES, - classifiers=[ - "Development Status :: 3 - Alpha", - "Framework :: Buildout", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: Implementation :: PyPy", - "Topic :: Software Development :: Libraries :: Python Modules", - "License :: OSI Approved :: Zope Public License", - ], - keywords='buildout directory folder mkdir', - author='Uli Fouquet', - author_email='grok-dev@zope.org', - url='https://github.com/zopefoundation/z3c.recipe.mkdir', - license='ZPL 2.1', - packages=find_packages('src'), - package_dir={'': 'src'}, - namespace_packages=['z3c', 'z3c.recipe'], - include_package_data=True, - zip_safe=False, - python_requires='>=3.7', - install_requires=[ - 'setuptools', - 'zc.buildout >= 1.5', - ], - test_suite='z3c.recipe.mkdir.tests.test_suite', - tests_require='zope.testing', - extras_require={ - 'test': TESTS_REQUIRE, - 'testing': TESTS_REQUIRE, - 'docs': DOCS_REQUIRE, - }, - entry_points=""" +setup( + name='z3c.recipe.mkdir', + version=version, + description="Buildout recipe to create directories.", + long_description=README + "\n\n" + CHANGES, + classifiers=[ + "Development Status :: 3 - Alpha", + "Framework :: Buildout", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Software Development :: Libraries :: Python Modules", + "License :: OSI Approved :: Zope Public License", + ], + keywords='buildout directory folder mkdir', + author='Uli Fouquet', + author_email='grok-dev@zope.org', + url='https://github.com/zopefoundation/z3c.recipe.mkdir', + license='ZPL 2.1', + packages=find_packages('src'), + package_dir={'': 'src'}, + namespace_packages=['z3c', 'z3c.recipe'], + include_package_data=True, + zip_safe=False, + python_requires='>=3.8', + install_requires=[ + 'setuptools', + 'zc.buildout >= 1.5', + ], + test_suite='z3c.recipe.mkdir.tests.test_suite', + tests_require='zope.testing', + extras_require={ + 'test': TESTS_REQUIRE, + 'testing': TESTS_REQUIRE, + 'docs': DOCS_REQUIRE, + }, + entry_points=""" [zc.buildout] default = z3c.recipe.mkdir:Recipe """, - ) +) diff --git a/src/z3c/recipe/mkdir/__init__.py b/src/z3c/recipe/mkdir/__init__.py index 062433e..4a54c87 100644 --- a/src/z3c/recipe/mkdir/__init__.py +++ b/src/z3c/recipe/mkdir/__init__.py @@ -5,6 +5,7 @@ class Recipe: + def __init__(self, buildout, name, options): self.buildout = buildout self.name = name @@ -15,9 +16,9 @@ def __init__(self, buildout, name, options): self.create_intermediate = string_to_bool( options.get('create-intermediate', 'yes')) - paths = options.get('paths', - os.path.join( - buildout['buildout']['parts-directory'], name)) + paths = options.get( + 'paths', os.path.join(buildout['buildout']['parts-directory'], + name)) self.paths = [] for path in paths.split('\n'): path = path.strip() @@ -42,7 +43,7 @@ def __init__(self, buildout, name, options): try: import pwd self.uid = pwd.getpwnam(options['user'])[2] - except ImportError: + except ModuleNotFoundError: self.logger.warn( "System does not support `pwd`. Using default user") @@ -53,7 +54,7 @@ def __init__(self, buildout, name, options): try: import grp self.gid = grp.getgrnam(options['group'])[2] - except ImportError: + except ModuleNotFoundError: self.logger.warn( "System does not support `grp`. Using default group") diff --git a/src/z3c/recipe/mkdir/tests.py b/src/z3c/recipe/mkdir/tests.py index 919bc58..0879264 100644 --- a/src/z3c/recipe/mkdir/tests.py +++ b/src/z3c/recipe/mkdir/tests.py @@ -41,7 +41,7 @@ def perm(mode): st = os.stat(path) type_flag = stat.S_ISDIR(st.st_mode) and 'd' or '-' permissions = type_flag + perm(st.st_mode) - return '{} {} {} {}'.format(permissions, user, group, path) + return f'{permissions} {user} {group} {path}' def ls_parts(dir='parts', *subs): @@ -99,7 +99,7 @@ def setUp(test): ), (re.compile("user '%s'" % user), "user 'USER'"), (re.compile("group '%s'" % group), "group 'GROUP'"), - (re.compile("{} {}".format(user, group)), "USER GROUP"), + (re.compile(f"{user} {group}"), "USER GROUP"), (re.compile(user), "USER"), ]) diff --git a/tox.ini b/tox.ini index aeaf059..af4e507 100644 --- a/tox.ini +++ b/tox.ini @@ -3,12 +3,14 @@ [tox] minversion = 3.18 envlist = + release-check lint - py37 py38 py39 py310 py311 + py312 + py313 pypy3 docs coverage @@ -16,34 +18,45 @@ envlist = [testenv] usedevelop = true deps = + setuptools <74 +setenv = commands = zope-testrunner --test-path=src {posargs:-vc} extras = test -[testenv:lint] +[testenv:setuptools-latest] +basepython = python3 +deps = + git+https://github.com/pypa/setuptools.git\#egg=setuptools + +[testenv:release-check] +description = ensure that the distribution is ready to release basepython = python3 skip_install = true -commands = - isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py - flake8 src setup.py - check-manifest - check-python-versions deps = + setuptools <74 + twine + build check-manifest - check-python-versions >= 0.19.1 + check-python-versions >= 0.20.0 wheel - flake8 - isort +commands_pre = +commands = + check-manifest + check-python-versions --only setup.py,tox.ini,.github/workflows/tests.yml + python -m build --sdist --no-isolation + twine check dist/* -[testenv:isort-apply] +[testenv:lint] +description = This env runs all linters configured in .pre-commit-config.yaml basepython = python3 skip_install = true -commands_pre = deps = - isort + pre-commit +commands_pre = commands = - isort {toxinidir}/src {toxinidir}/setup.py [] + pre-commit run --all-files --show-diff-on-failure [testenv:docs] basepython = python3 @@ -59,13 +72,13 @@ basepython = python3 allowlist_externals = mkdir setenv = - COVERAGE_PROCESS_START={toxinidir}/.coveragerc + COVERAGE_PROCESS_START={toxinidir}/pyproject.toml deps = - coverage + coverage[toml] commands = mkdir -p {toxinidir}/parts/htmlcov coverage erase coverage run -m zope.testrunner --test-path=src {posargs:-vc} coverage combine coverage html - coverage report -m --fail-under=91 + coverage report