diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..ac491f6 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,33 @@ +# Generated from: +# https://github.com/zopefoundation/meta/tree/master/config/toolkit +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 e57f40a..8a12398 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,15 +20,15 @@ jobs: - ["ubuntu", "ubuntu-latest"] config: # [Python version, tox env] - - ["3.11", "release-check"] - - ["3.11", "lint"] - - ["3.8", "py38"] - - ["3.9", "py39"] - - ["3.10", "py310"] - - ["3.11", "py311"] - - ["3.12", "py312"] + - ["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", "docs"] 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 @@ -39,6 +39,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.config[0] }} + allow-prereleases: true - name: Pip cache uses: actions/cache@v4 with: diff --git a/.meta.toml b/.meta.toml index e5304f3..1b9dac2 100644 --- a/.meta.toml +++ b/.meta.toml @@ -2,7 +2,7 @@ # https://github.com/zopefoundation/meta/tree/master/config/toolkit [meta] template = "toolkit" -commit-id = "2247fc22" +commit-id = "f317618e" [python] with-sphinx-doctests = false diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..8c13e1a --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,28 @@ +# Generated from: +# https://github.com/zopefoundation/meta/tree/master/config/toolkit +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/dependabot/requirements.txt b/dependabot/requirements.txt index e3bd8e8..f89f4dc 100644 --- a/dependabot/requirements.txt +++ b/dependabot/requirements.txt @@ -37,6 +37,8 @@ collective.recipe.template==2.2 decorator==5.1.1 gnureadline==8.2.13 ipython-genutils==0.2.0 +legacy-cgi==2.6.1 +mock==5.1.0 Paste==3.10.1 pexpect==4.9.0 pickleshare==0.7.5 diff --git a/docs/changes.rst b/docs/changes.rst index 42ed470..8c9b394 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -4,9 +4,15 @@ 5.2 (unreleased) ---------------- +- Add support for Python 3.13. + - Drop version pins for ``twine`` and ``pkginfo`` as they are not used and we pinned incompatible versions resulting in an error downstream. +- Update zopetoolkit to version 3.1. + +- Add ``zope.testbrowser`` to the list of tested packages. + 5.1 (2024-08-22) ---------------- diff --git a/docs/conf.py b/docs/conf.py index 85259f3..77eff3c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Grok Reference documentation build configuration file, created by # sphinx-quickstart.py on Wed Feb 20 02:11:17 2008. @@ -45,7 +44,7 @@ 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.viewcode', - ] +] # Order autodoc generated docs in source code order. autodoc_member_order = 'alphabetical' @@ -175,7 +174,7 @@ 'manual'), (path.join('reference', 'index'), 'reference.tex', 'Grok Reference', 'The Grok Team', 'manual'), - ] +] # Additional stuff for the LaTeX preamble. latex_preamble = r''' @@ -195,8 +194,8 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - ('index', 'grok', u'grok Documentation', - [u'The Grok developers and community'], 1) + ('index', 'grok', 'grok Documentation', + ['The Grok developers and community'], 1) ] diff --git a/docs/design/menu.py b/docs/design/menu.py index 948ab7c..cfcdf86 100644 --- a/docs/design/menu.py +++ b/docs/design/menu.py @@ -157,21 +157,21 @@ class IMenuItem(Interface): # ########### Implementation sketches -class ViewMenuItem(object): +class ViewMenuItem: def __init__(self, view): # View must be a view pass -class Action(object): +class Action: def __init__(self, title, target): self.title = title self.target = target # TALES expression -class BaseMenuItem(object): +class BaseMenuItem: def __init__(self, condition): self.condition = condition @@ -183,7 +183,7 @@ def checkCondition(context, request): pass -class Menu(object): +class Menu: def __init__(self, menu_items): # XXX assert: All items must be menu items diff --git a/docs/design/utility.py b/docs/design/utility.py index fe50e0f..d1e2935 100644 --- a/docs/design/utility.py +++ b/docs/design/utility.py @@ -12,7 +12,7 @@ class Calculator(grok.GlobalUtility): grok.provides(ICalculator) # this is actually the default -grok.global_utility(Calculator, provides=ICalculator, name=u'') +grok.global_utility(Calculator, provides=ICalculator, name='') class LocalCalculator(grok.LocalUtility): @@ -23,7 +23,7 @@ class Anything(grok.Model): pass -class NonPersistent(object): +class NonPersistent: pass diff --git a/docs/design/views.py b/docs/design/views.py index fa2016a..f7d3bae 100644 --- a/docs/design/views.py +++ b/docs/design/views.py @@ -52,7 +52,7 @@ class Index(grok.Form): """ class fields: - operand = schema.Int(title=u'Operand') + operand = schema.Int(title='Operand') operator = schema.Choice(...) operand2 = schema.Int(...) diff --git a/docs/groktut/the_rules_of_persistence/src/sample/app.py b/docs/groktut/the_rules_of_persistence/src/sample/app.py index 74cb339..582e7e9 100644 --- a/docs/groktut/the_rules_of_persistence/src/sample/app.py +++ b/docs/groktut/the_rules_of_persistence/src/sample/app.py @@ -3,7 +3,7 @@ class Sample(grok.Application, grok.Container): def __init__(self): - super(Sample, self).__init__() + super().__init__() self.list = [] diff --git a/docs/groktut/the_rules_of_persistence2/src/sample/app.py b/docs/groktut/the_rules_of_persistence2/src/sample/app.py index 230bca0..c94791b 100644 --- a/docs/groktut/the_rules_of_persistence2/src/sample/app.py +++ b/docs/groktut/the_rules_of_persistence2/src/sample/app.py @@ -3,7 +3,7 @@ class Sample(grok.Application, grok.Container): def __init__(self): - super(Sample, self).__init__() + super().__init__() self.list = [] diff --git a/docs/groktut/the_rules_of_persistence3/src/sample/app.py b/docs/groktut/the_rules_of_persistence3/src/sample/app.py index 81d320c..8551d9a 100644 --- a/docs/groktut/the_rules_of_persistence3/src/sample/app.py +++ b/docs/groktut/the_rules_of_persistence3/src/sample/app.py @@ -3,7 +3,7 @@ class Sample(grok.Application, grok.Container): def __init__(self): - super(Sample, self).__init__() + super().__init__() self.list = [] def addText(self, text): diff --git a/docs/reference/conf.py b/docs/reference/conf.py index a3a90b1..7145730 100644 --- a/docs/reference/conf.py +++ b/docs/reference/conf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Grok Reference documentation build configuration file, created by # sphinx-quickstart.py on Wed Feb 20 02:11:17 2008. @@ -22,7 +21,7 @@ setupfilepath = path.join(path.dirname( path.dirname(path.abspath(curdir))), 'setup.py') reg = re.compile(r"^\s*version=.(.+).,.*") -for line in open(setupfilepath, 'r').read().split(): +for line in open(setupfilepath).read().split(): m = reg.match(line) if m: version = m.groups()[0] @@ -129,7 +128,7 @@ # latex_documents = [] latex_documents = [ ('reference.tex', 'Grok Reference', 'The Grok Team', 'manual') - ] +] # Additional stuff for the LaTeX preamble. # latex_preamble = ' diff --git a/docs/scripts/update-releaseinfo.py b/docs/scripts/update-releaseinfo.py index 96a4dcc..7315256 100644 --- a/docs/scripts/update-releaseinfo.py +++ b/docs/scripts/update-releaseinfo.py @@ -60,7 +60,7 @@ def package_list( doap.parse(doap_xml) description = ' '.join( doap.find('//{%s}shortdesc' % DOAP_NS).text.splitlines()) - homepage = 'http://pypi.python.org/pypi/%s/%s' % (package, version) + homepage = f'http://pypi.python.org/pypi/{package}/{version}' print(line % dict( name=package, homepage=homepage, description=description, version=version), file=out) @@ -85,7 +85,7 @@ def write_package_list(path, version, use_trunk=False): config = ConfigParser.RawConfigParser() config.optionxform = str - fp = StringIO.StringIO((location/'grok.cfg').read()) + fp = StringIO.StringIO((location / 'grok.cfg').read()) config.readfp(fp) output = open(path, 'w') @@ -102,12 +102,12 @@ def write_package_list(path, version, use_trunk=False): print('Zope Toolkit %s' % ztk_version, file=output) print('------------------------------', file=output) print(""" -This Grok released is based on Zope Toolkit %s. +This Grok released is based on Zope Toolkit {}. -`Overview `_ of +`Overview `_ of the ZTK. List of the ZTK `packages -`_ -""" % (ztk_version, ztk_version, ztk_version), file=output) +`_ +""".format(ztk_version, ztk_version, ztk_version), file=output) print('Packages', file=output) print('--------', file=output) diff --git a/grok-versions.cfg b/grok-versions.cfg index 612364d..74f3108 100644 --- a/grok-versions.cfg +++ b/grok-versions.cfg @@ -41,6 +41,8 @@ collective.recipe.template = 2.2 decorator = 5.1.1 gnureadline = 8.2.13 ipython-genutils = 0.2.0 +legacy-cgi = 2.6.1 +mock = 5.1.0 Paste = 3.10.1 pexpect = 4.9.0 pickleshare = 0.7.5 diff --git a/grok.cfg b/grok.cfg index 40a98be..ed45d1f 100644 --- a/grok.cfg +++ b/grok.cfg @@ -32,6 +32,7 @@ included = z3c.flashmessage zc.catalog zope.errorview + zope.testbrowser # These packages will be removed in the next version deprecating = diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..4d9b523 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,21 @@ +# +# Generated from: +# https://github.com/zopefoundation/meta/tree/master/config/toolkit + +[build-system] +requires = ["setuptools < 74"] +build-backend = "setuptools.build_meta" + +[tool.coverage.run] +branch = true +source = ["groktoolkit"] + +[tool.coverage.report] +fail_under = "not applicable" +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" diff --git a/setup.py b/setup.py index 6615089..07eff1e 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,6 @@ from setuptools import setup + version = '6.0.dev0' with open('README.rst') as f: @@ -22,6 +23,7 @@ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Programming Language :: Python :: Implementation :: PyPy", "Programming Language :: Python :: Implementation :: CPython", ], diff --git a/tox.ini b/tox.ini index f57470d..cc5f8fa 100644 --- a/tox.ini +++ b/tox.ini @@ -10,19 +10,18 @@ envlist = py310 py311 py312 + py313 pypy3 docs [testenv] skip_install = true deps = - setuptools < 69 - zc.buildout >= 3.0.1 + setuptools < 74 + zc.buildout >= 3.1 wheel > 0.37 setenv = zope_i18n_compile_mo_files=True - py312: VIRTUALENV_PIP=23.1.2 - py312: PIP_REQUIRE_VIRTUALENV=0 commands_pre = {envbindir}/buildout -nc {toxinidir}/buildout.cfg buildout:directory={envdir} commands = @@ -34,23 +33,19 @@ commands_pre = commands = {envdir}/bin/checkversions grok-versions.cfg [] -[testenv:lint] +[testenv:setuptools-latest] basepython = python3 -commands_pre = - mkdir -p {toxinidir}/parts/flake8 -allowlist_externals = - mkdir -commands = - isort --check-only --diff {toxinidir}/docs - flake8 {toxinidir}/docs deps = - flake8 - isort + git+https://github.com/pypa/setuptools.git\#egg=setuptools + zc.buildout >= 3.1 + wheel > 0.37 + [testenv:release-check] description = ensure that the distribution is ready to release basepython = python3 skip_install = true deps = + setuptools < 74 twine build check-manifest @@ -63,14 +58,15 @@ commands = 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}/docs [] + pre-commit run --all-files --show-diff-on-failure [testenv:docs] basepython = python3