Skip to content

Commit a54d244

Browse files
authored
Update Python version support. (#14)
* Bumped version for feature release. * Drop support for Python 3.7, 3.8. * Add support for Python 3.12, 3.13.
1 parent bab72f6 commit a54d244

File tree

13 files changed

+173
-76
lines changed

13 files changed

+173
-76
lines changed

.github/workflows/pre-commit.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Generated from:
2+
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
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+
permissions:
19+
contents: read
20+
pull-requests: write
21+
name: linting
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: actions/setup-python@v5
26+
with:
27+
python-version: 3.x
28+
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd #v3.0.1
29+
with:
30+
extra_args: --all-files --show-diff-on-failure
31+
env:
32+
PRE_COMMIT_COLOR: always
33+
- uses: pre-commit-ci/lite-action@5d6cc0eb514c891a40562a58a8e71576c5c7fb43 #v1.1.0
34+
if: always()
35+
with:
36+
msg: Apply pre-commit code formatting

.github/workflows/tests.yml

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,49 +12,50 @@ on:
1212

1313
jobs:
1414
build:
15+
permissions:
16+
contents: read
17+
pull-requests: write
1518
strategy:
1619
# We want to see all failures:
1720
fail-fast: false
1821
matrix:
1922
os:
20-
- ["ubuntu", "ubuntu-20.04"]
23+
- ["ubuntu", "ubuntu-latest"]
2124
config:
2225
# [Python version, tox env]
23-
- ["3.9", "lint"]
24-
- ["3.7", "py37"]
25-
- ["3.8", "py38"]
26-
- ["3.9", "py39"]
27-
- ["3.10", "py310"]
28-
- ["3.11", "py311"]
29-
- ["3.9", "coverage"]
26+
- ["3.11", "release-check"]
27+
- ["3.9", "py39"]
28+
- ["3.10", "py310"]
29+
- ["3.11", "py311"]
30+
- ["3.12", "py312"]
31+
- ["3.13", "py313"]
32+
- ["3.11", "coverage"]
3033

3134
runs-on: ${{ matrix.os[1] }}
3235
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
3336
name: ${{ matrix.config[1] }}
3437
steps:
35-
- uses: actions/checkout@v3
36-
- name: Set up Python
37-
uses: actions/setup-python@v4
38+
- uses: actions/checkout@v4
3839
with:
39-
python-version: ${{ matrix.config[0] }}
40-
- name: Pip cache
41-
uses: actions/cache@v3
40+
persist-credentials: false
41+
- name: Install uv + caching
42+
uses: astral-sh/setup-uv@v5
4243
with:
43-
path: ~/.cache/pip
44-
key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('setup.*', 'tox.ini') }}
45-
restore-keys: |
46-
${{ runner.os }}-pip-${{ matrix.config[0] }}-
47-
${{ runner.os }}-pip-
48-
- name: Install dependencies
49-
run: |
50-
python -m pip install --upgrade pip
51-
pip install tox
44+
enable-cache: true
45+
cache-dependency-glob: |
46+
setup.*
47+
tox.ini
48+
python-version: ${{ matrix.matrix.config[0] }}
49+
github-token: ${{ secrets.GITHUB_TOKEN }}
5250
- name: Test
53-
run: tox -e ${{ matrix.config[1] }}
51+
if: ${{ !startsWith(runner.os, 'Mac') }}
52+
run: uvx --with tox-uv tox -e ${{ matrix.config[1] }}
53+
- name: Test (macOS)
54+
if: ${{ startsWith(runner.os, 'Mac') }}
55+
run: uvx --with tox-uv tox -e ${{ matrix.config[1] }}-universal2
5456
- name: Coverage
5557
if: matrix.config[1] == 'coverage'
5658
run: |
57-
pip install coveralls
58-
coveralls --service=github
59+
uvx coveralls --service=github
5960
env:
6061
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.meta.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
33
[meta]
44
template = "pure-python"
5-
commit-id = "20a50c67"
5+
commit-id = "e1995c20"
66

77
[python]
88
with-pypy = false
99
with-sphinx-doctests = false
1010
with-windows = false
1111
with-future-python = false
1212
with-macos = false
13+
with-docs = false
1314

1415
[coverage]
1516
fail-under = 77

.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/pure-python
3+
minimum_pre_commit_version: '3.6'
4+
repos:
5+
- repo: https://github.com/pycqa/isort
6+
rev: "6.0.1"
7+
hooks:
8+
- id: isort
9+
- repo: https://github.com/hhatto/autopep8
10+
rev: "v2.3.2"
11+
hooks:
12+
- id: autopep8
13+
args: [--in-place, --aggressive, --aggressive]
14+
- repo: https://github.com/asottile/pyupgrade
15+
rev: v3.19.1
16+
hooks:
17+
- id: pyupgrade
18+
args: [--py39-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.2"
25+
hooks:
26+
- id: flake8
27+
additional_dependencies:
28+
- flake8-debugger == 4.1.2

CHANGES.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
Changelog
22
=========
33

4-
2.0.1 (unreleased)
5-
------------------
4+
2.1 (unreleased)
5+
----------------
6+
7+
- Add support for Python 3.12, 3.13.
8+
9+
- Drop support for Python 3.7, 3.8.
610

711
Breaking changes:
812

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!--
22
Generated from:
33
https://github.com/zopefoundation/meta/tree/master/config/pure-python
4-
-->
4+
-->
55
# Contributing to zopefoundation projects
66

77
The projects under the zopefoundation GitHub organization are open source and

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
recursive-include src *.po

pyproject.toml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Generated from:
2+
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
3+
4+
[build-system]
5+
requires = [
6+
"setuptools == 75.8.2",
7+
"wheel",
8+
]
9+
build-backend = "setuptools.build_meta"
10+
11+
[tool.coverage.run]
12+
branch = true
13+
source = ["z3c.formwidget.query"]
14+
15+
[tool.coverage.report]
16+
fail_under = 77
17+
precision = 2
18+
ignore_errors = true
19+
show_missing = true
20+
exclude_lines = [
21+
"pragma: no cover",
22+
"pragma: nocover",
23+
"except ImportError:",
24+
"raise NotImplementedError",
25+
"if __name__ == '__main__':",
26+
"self.fail",
27+
"raise AssertionError",
28+
"raise unittest.Skip",
29+
]
30+
31+
[tool.coverage.html]
32+
directory = "parts/htmlcov"

setup.cfg

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Generated from:
22
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
3-
[bdist_wheel]
4-
universal = 0
53

64
[flake8]
75
doctests = 1
@@ -15,7 +13,7 @@ ignore =
1513
force_single_line = True
1614
combine_as_imports = True
1715
sections = FUTURE,STDLIB,THIRDPARTY,ZOPE,FIRSTPARTY,LOCALFOLDER
18-
known_third_party = six, docutils, pkg_resources, pytz
16+
known_third_party = docutils, pkg_resources, pytz
1917
known_zope =
2018
known_first_party =
2119
default_section = ZOPE

setup.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@
55

66
setup(
77
name='z3c.formwidget.query',
8-
version='2.0.1.dev0',
8+
version='2.1.dev0',
99
author="Zope Community",
1010
author_email="zope-dev@zope.dev",
1111
description="A source query widget for z3c.form.",
1212
long_description=(
1313
open('README.rst').read() + '\n\n' +
1414
open('CHANGES.rst').read()
1515
),
16-
license="ZPL 2.1",
16+
license="ZPL-2.1",
1717
keywords="zope zope3 z3c.form",
1818
url='https://github.com/zopefoundation/z3c.formwidget.query',
1919
zip_safe=False,
2020
packages=find_packages('src'),
2121
include_package_data=True,
2222
package_dir={'': 'src'},
2323
namespace_packages=['z3c', 'z3c.formwidget'],
24-
python_requires='>=3.7',
24+
python_requires='>=3.9',
2525
extras_require=dict(
2626
test=[
2727
'lxml',
@@ -47,11 +47,11 @@
4747
' License (LGPL)',
4848
'Programming Language :: Python',
4949
'Programming Language :: Python :: 3',
50-
'Programming Language :: Python :: 3.7',
51-
'Programming Language :: Python :: 3.8',
5250
'Programming Language :: Python :: 3.9',
5351
'Programming Language :: Python :: 3.10',
5452
'Programming Language :: Python :: 3.11',
53+
'Programming Language :: Python :: 3.12',
54+
'Programming Language :: Python :: 3.13',
5555
'Topic :: Software Development :: Libraries :: Python Modules',
5656
],
5757
entry_points='''

src/z3c/formwidget/query/README.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ Let's define a permission aware object
347347
>>> HAS_AC = True
348348
>>> try:
349349
... from AccessControl.interfaces import IRoleManager
350-
... except ImportError:
350+
... except ModuleNotFoundError:
351351
... HAS_AC = False
352352

353353
>>> if HAS_AC:

src/z3c/formwidget/query/widget.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
HAS_AC = True
2424
try:
2525
from AccessControl.interfaces import IRoleManager
26-
except ImportError:
26+
except ModuleNotFoundError:
2727
HAS_AC = False
2828

2929

0 commit comments

Comments
 (0)