Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,22 @@ env:

jobs:
pre-commit:
permissions:
contents: read
pull-requests: write
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
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd #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
- uses: pre-commit-ci/lite-action@5d6cc0eb514c891a40562a58a8e71576c5c7fb43 #v1.1.0
if: always()
with:
msg: Apply pre-commit code formatting
35 changes: 15 additions & 20 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:

jobs:
build:
permissions:
contents: read
pull-requests: write
strategy:
# We want to see all failures:
fail-fast: false
Expand All @@ -21,7 +24,6 @@ jobs:
config:
# [Python version, tox env]
- ["3.11", "release-check"]
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["3.11", "py311"]
Expand All @@ -34,33 +36,26 @@ jobs:
name: ${{ matrix.config[1] }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.config[0] }}
allow-prereleases: true
- name: Pip cache
uses: actions/cache@v4
persist-credentials: false
- name: Install uv + caching
uses: astral-sh/setup-uv@v5
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('setup.*', 'tox.ini') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.config[0] }}-
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
enable-cache: true
cache-dependency-glob: |
setup.*
tox.ini
python-version: ${{ matrix.matrix.config[0] }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Test
if: ${{ !startsWith(runner.os, 'Mac') }}
run: tox -e ${{ matrix.config[1] }}
run: uvx --with tox-uv tox -e ${{ matrix.config[1] }}
- name: Test (macOS)
if: ${{ startsWith(runner.os, 'Mac') }}
run: tox -e ${{ matrix.config[1] }}-universal2
run: uvx --with tox-uv tox -e ${{ matrix.config[1] }}-universal2
- name: Coverage
if: matrix.config[1] == 'coverage'
run: |
pip install coveralls
coveralls --service=github
uvx coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# https://github.com/zopefoundation/meta/tree/master/config/zope-product
[meta]
template = "zope-product"
commit-id = "210c1a0c"
commit-id = "a0de4e93"

[python]
with-pypy = false
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
minimum_pre_commit_version: '3.6'
repos:
- repo: https://github.com/pycqa/isort
rev: "5.13.2"
rev: "6.0.1"
hooks:
- id: isort
- repo: https://github.com/hhatto/autopep8
rev: "v2.3.1"
rev: "v2.3.2"
hooks:
- id: autopep8
args: [--in-place, --aggressive, --aggressive]
- repo: https://github.com/asottile/pyupgrade
rev: v3.17.0
rev: v3.19.1
hooks:
- id: pyupgrade
args: [--py38-plus]
args: [--py39-plus]
- repo: https://github.com/isidentical/teyit
rev: 0.4.3
hooks:
- id: teyit
- repo: https://github.com/PyCQA/flake8
rev: "7.1.1"
rev: "7.1.2"
hooks:
- id: flake8
additional_dependencies:
Expand Down
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Changelog
5.0 (unreleased)
----------------

- Drop support for Python 3.8.

- Add support for Python 3.13.

- Drop support for Python 3.7.
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
Generated from:
https://github.com/zopefoundation/meta/tree/master/config/zope-product
-->
-->
# Contributing to zopefoundation projects

The projects under the zopefoundation GitHub organization are open source and
Expand Down
16 changes: 14 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
# https://github.com/zopefoundation/meta/tree/master/config/zope-product

[build-system]
requires = ["setuptools < 74"]
requires = [
"setuptools == 75.8.2",
"wheel",
]
build-backend = "setuptools.build_meta"

[tool.coverage.run]
Expand All @@ -15,7 +18,16 @@ fail_under = 74
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"]
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"
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
'DocumentTemplate/issues'),
'Sources': 'https://github.com/zopefoundation/DocumentTemplate',
},
license='ZPL 2.1',
license='ZPL-2.1',
description="Document Templating Markup Language (DTML)",
author='Zope Foundation and Contributors',
author_email='zope-dev@zope.org',
author_email='zope-dev@zope.dev',
long_description='\n\n'.join([README, CHANGES]),
long_description_content_type='text/x-rst',
packages=find_packages('src'),
Expand All @@ -52,7 +52,6 @@
"Operating System :: OS Independent",
"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",
Expand All @@ -62,7 +61,7 @@
"Topic :: Text Processing :: Markup",
],
keywords='DTML template zope HTML SQL web markup',
python_requires='>=3.8',
python_requires='>=3.9',
install_requires=[
'AccessControl >= 4.0a5',
'Acquisition',
Expand Down
2 changes: 1 addition & 1 deletion src/DocumentTemplate/DT_InSV.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
try:
import Missing
mv = Missing.Value
except ImportError:
except ModuleNotFoundError:
mv = None

TupleType = tuple
Expand Down
2 changes: 1 addition & 1 deletion src/DocumentTemplate/DT_String.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def _parseTag(self, match_ob, command=None, sargs='', tt=type(())):
d = {}
try:
exec(f'from {module} import {name}', d)
except ImportError:
except ModuleNotFoundError:
exec('from DocumentTemplate.{} import {}'.format(
module, name), d)
command = d[name]
Expand Down
4 changes: 2 additions & 2 deletions src/DocumentTemplate/DT_Var.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ def len_comma(v, name='(Unknown name)', md={}):
def restructured_text(v, name='(Unknown name)', md={}):
try:
from docutils.core import publish_string
except ImportError:
except ModuleNotFoundError:
logger.info('The docutils package is not available, therefore '
'the DT_Var.restructured_text function returns None.')
return None
Expand Down Expand Up @@ -497,7 +497,7 @@ def structured_text(v, name='(Unknown name)', md={}):
level = 3
try:
from App.config import getConfiguration
except ImportError:
except ModuleNotFoundError:
pass
else:
level = getConfiguration().structured_text_header_level
Expand Down
2 changes: 1 addition & 1 deletion src/DocumentTemplate/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def guarded_getitem(self, ob, index):
# it only deals with the C module being compiled or not.
try:
from AccessControl.cAccessControl import RestrictedDTMLMixin
except ImportError:
except ModuleNotFoundError:
RestrictedDTML = BaseRestrictedDTML
else:
class RestrictedDTML(RestrictedDTMLMixin, BaseRestrictedDTML):
Expand Down
2 changes: 1 addition & 1 deletion src/DocumentTemplate/tests/testDTML.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
try:
from docutils.core import publish_string # NOQA: F401 unused import
HAVE_DOCUTILS = True
except ImportError:
except ModuleNotFoundError:
HAVE_DOCUTILS = False


Expand Down
14 changes: 7 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ minversion = 3.18
envlist =
release-check
lint
py38
py39
py310
py311
Expand All @@ -16,9 +15,9 @@ envlist =
[testenv]
skip_install = true
deps =
setuptools < 74
zc.buildout >= 3.1
wheel > 0.37
setuptools == 75.8.2
zc.buildout
wheel
setenv =
commands_pre =
{envbindir}/buildout -nc {toxinidir}/buildout.cfg buildout:directory={envdir} buildout:develop={toxinidir} install test
Expand All @@ -29,16 +28,17 @@ commands =
basepython = python3
deps =
git+https://github.com/pypa/setuptools.git\#egg=setuptools
zc.buildout >= 3.1
wheel > 0.37
zc.buildout
wheel


[testenv:release-check]
description = ensure that the distribution is ready to release
basepython = python3
skip_install = true
deps =
setuptools < 74
setuptools == 75.8.2
wheel
twine
build
check-manifest
Expand Down