Skip to content

Commit 554f8e5

Browse files
authored
Add support for Python 3.13 (#67)
1 parent 19eaf22 commit 554f8e5

File tree

10 files changed

+114
-54
lines changed

10 files changed

+114
-54
lines changed

.github/workflows/pre-commit.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Generated from:
2+
# https://github.com/zopefoundation/meta/tree/master/config/zope-product
3+
name: pre-commit
4+
5+
on:
6+
pull_request:
7+
push:
8+
branches:
9+
- master
10+
# Allow to run this workflow manually from the Actions tab
11+
workflow_dispatch:
12+
13+
env:
14+
FORCE_COLOR: 1
15+
16+
jobs:
17+
pre-commit:
18+
name: linting
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
- uses: actions/setup-python@v5
23+
with:
24+
python-version: 3.x
25+
- uses: pre-commit/action@v3.0.1
26+
with:
27+
extra_args: --all-files --show-diff-on-failure
28+
env:
29+
PRE_COMMIT_COLOR: always
30+
- uses: pre-commit-ci/lite-action@v1.0.2
31+
if: always()
32+
with:
33+
msg: Apply pre-commit code formatting

.github/workflows/tests.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ jobs:
2020
- ["ubuntu", "ubuntu-latest"]
2121
config:
2222
# [Python version, tox env]
23-
- ["3.11", "release-check"]
24-
- ["3.11", "lint"]
25-
- ["3.8", "py38"]
26-
- ["3.9", "py39"]
27-
- ["3.10", "py310"]
28-
- ["3.11", "py311"]
29-
- ["3.12", "py312"]
30-
- ["3.11", "coverage"]
23+
- ["3.11", "release-check"]
24+
- ["3.8", "py38"]
25+
- ["3.9", "py39"]
26+
- ["3.10", "py310"]
27+
- ["3.11", "py311"]
28+
- ["3.12", "py312"]
29+
- ["3.13", "py313"]
30+
- ["3.11", "coverage"]
3131

3232
runs-on: ${{ matrix.os[1] }}
3333
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
@@ -38,6 +38,7 @@ jobs:
3838
uses: actions/setup-python@v5
3939
with:
4040
python-version: ${{ matrix.config[0] }}
41+
allow-prereleases: true
4142
- name: Pip cache
4243
uses: actions/cache@v4
4344
with:

.meta.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# https://github.com/zopefoundation/meta/tree/master/config/zope-product
33
[meta]
44
template = "zope-product"
5-
commit-id = "b1221c3c"
5+
commit-id = "93bf5454"
66

77
[python]
88
with-pypy = false

.pre-commit-config.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Generated from:
2+
# https://github.com/zopefoundation/meta/tree/master/config/zope-product
3+
minimum_pre_commit_version: '3.6'
4+
repos:
5+
- repo: https://github.com/pycqa/isort
6+
rev: "5.13.2"
7+
hooks:
8+
- id: isort
9+
- repo: https://github.com/hhatto/autopep8
10+
rev: "v2.3.1"
11+
hooks:
12+
- id: autopep8
13+
args: [--in-place, --aggressive, --aggressive]
14+
- repo: https://github.com/asottile/pyupgrade
15+
rev: v3.17.0
16+
hooks:
17+
- id: pyupgrade
18+
args: [--py38-plus]
19+
- repo: https://github.com/isidentical/teyit
20+
rev: 0.4.3
21+
hooks:
22+
- id: teyit
23+
- repo: https://github.com/PyCQA/flake8
24+
rev: "7.1.1"
25+
hooks:
26+
- id: flake8
27+
additional_dependencies:
28+
- flake8-debugger == 4.1.2

CHANGES.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Changelog
66

77
- Fix behavior when uploading no file in ``Zope >= 5.8.1``.
88

9-
- Add support for Python 3.12.
9+
- Add support for Python 3.12 and 3.13
1010

1111
- Drop support for Python 3.7.
1212

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ include *.rst
55
include *.txt
66
include buildout.cfg
77
include tox.ini
8+
include .pre-commit-config.yaml
89

910
recursive-include src *.py
1011
include src/Products/PythonScripts/www/default_content

pyproject.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#
2+
# Generated from:
3+
# https://github.com/zopefoundation/meta/tree/master/config/zope-product
4+
5+
[build-system]
6+
requires = ["setuptools < 74"]
7+
build-backend = "setuptools.build_meta"
8+
9+
[tool.coverage.run]
10+
branch = true
11+
source = ["Products.PythonScripts"]
12+
13+
[tool.coverage.report]
14+
fail_under = 83
15+
precision = 2
16+
ignore_errors = true
17+
show_missing = true
18+
exclude_lines = ["pragma: no cover", "pragma: nocover", "except ImportError:", "raise NotImplementedError", "if __name__ == '__main__':", "self.fail", "raise AssertionError", "raise unittest.Skip"]
19+
20+
[tool.coverage.html]
21+
directory = "parts/htmlcov"

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
'Programming Language :: Python :: 3.10',
5050
'Programming Language :: Python :: 3.11',
5151
'Programming Language :: Python :: 3.12',
52+
'Programming Language :: Python :: 3.13',
5253
'Programming Language :: Python :: Implementation :: CPython',
5354
],
5455
python_requires='>=3.8',

src/Products/PythonScripts/PythonScript.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,7 @@ def document_src(self, REQUEST=None, RESPONSE=None):
556556

557557
class PythonScriptTracebackSupplement:
558558
"""Implementation of ITracebackSupplement"""
559+
559560
def __init__(self, script, line=0):
560561
self.object = script
561562
# If line is set to -1, it means to use tb_lineno.

tox.ini

Lines changed: 18 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,35 @@ envlist =
1010
py310
1111
py311
1212
py312
13+
py313
1314
coverage
1415

1516
[testenv]
1617
skip_install = true
1718
deps =
18-
setuptools < 69
19-
zc.buildout >= 3.0.1
19+
setuptools < 74
20+
zc.buildout >= 3.1
2021
wheel > 0.37
2122
setenv =
22-
py312: VIRTUALENV_PIP=23.1.2
23-
py312: PIP_REQUIRE_VIRTUALENV=0
2423
commands_pre =
2524
{envbindir}/buildout -nc {toxinidir}/buildout.cfg buildout:directory={envdir} buildout:develop={toxinidir} install test
2625
commands =
2726
{envbindir}/test {posargs:-cv}
2827

28+
[testenv:setuptools-latest]
29+
basepython = python3
30+
deps =
31+
git+https://github.com/pypa/setuptools.git\#egg=setuptools
32+
zc.buildout >= 3.1
33+
wheel > 0.37
34+
35+
2936
[testenv:release-check]
3037
description = ensure that the distribution is ready to release
3138
basepython = python3
3239
skip_install = true
3340
deps =
41+
setuptools < 74
3442
twine
3543
build
3644
check-manifest
@@ -44,29 +52,14 @@ commands =
4452
twine check dist/*
4553

4654
[testenv:lint]
55+
description = This env runs all linters configured in .pre-commit-config.yaml
4756
basepython = python3
48-
commands_pre =
49-
mkdir -p {toxinidir}/parts/flake8
50-
allowlist_externals =
51-
mkdir
52-
commands =
53-
isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py
54-
flake8 {toxinidir}/src {toxinidir}/setup.py
57+
skip_install = true
5558
deps =
56-
flake8
57-
isort
58-
# Useful flake8 plugins that are Python and Plone specific:
59-
flake8-coding
60-
flake8-debugger
61-
mccabe
62-
63-
[testenv:isort-apply]
64-
basepython = python3
59+
pre-commit
6560
commands_pre =
66-
deps =
67-
isort
6861
commands =
69-
isort {toxinidir}/src {toxinidir}/setup.py []
62+
pre-commit run --all-files --show-diff-on-failure
7063

7164
[testenv:coverage]
7265
basepython = python3
@@ -76,28 +69,9 @@ allowlist_externals =
7669
mkdir
7770
deps =
7871
{[testenv]deps}
79-
coverage
72+
coverage[toml]
8073
commands =
8174
mkdir -p {toxinidir}/parts/htmlcov
8275
coverage run {envbindir}/test {posargs:-cv}
8376
coverage html
84-
coverage report -m --fail-under=83
85-
86-
[coverage:run]
87-
branch = True
88-
source = Products.PythonScripts
89-
90-
[coverage:report]
91-
precision = 2
92-
ignore_errors = True
93-
exclude_lines =
94-
pragma: no cover
95-
pragma: nocover
96-
except ImportError:
97-
raise NotImplementedError
98-
if __name__ == '__main__':
99-
self.fail
100-
raise AssertionError
101-
102-
[coverage:html]
103-
directory = parts/htmlcov
77+
coverage report

0 commit comments

Comments
 (0)