Skip to content

Commit

Permalink
Update Python version support. (#4)
Browse files Browse the repository at this point in the history
* Drop support for Python 3.7.
* Add support for Python 3.12, 3.13.
  • Loading branch information
icemac authored Oct 16, 2024
1 parent dcd7d1b commit 50d7bc6
Show file tree
Hide file tree
Showing 10 changed files with 143 additions and 55 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
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/[email protected]
with:
extra_args: --all-files --show-diff-on-failure
env:
PRE_COMMIT_COLOR: always
- uses: pre-commit-ci/[email protected]
if: always()
with:
msg: Apply pre-commit code formatting
28 changes: 17 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,30 @@ 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"]
- ["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"]
- ["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') }}
Expand All @@ -50,7 +52,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: |
Expand Down
5 changes: 3 additions & 2 deletions .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[meta]
template = "pure-python"
commit-id = "f6bd0f55"
commit-id = "3349b8f4"

[python]
with-sphinx-doctests = false
with-future-python = false
with-pypy = false
with-macos = false
with-windows = false
with-docs = false

[tox]
use-flake8 = true
Expand All @@ -18,7 +19,7 @@ testenv-deps = [
]

[coverage]
fail-under = 94
fail-under = 93.5

[manifest]
additional-rules = [
Expand Down
28 changes: 28 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
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
4 changes: 3 additions & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Changes
2.1 (unreleased)
----------------

- Nothing changed yet.
* Add support for Python 3.12, 3.13.

* Drop support for Python 3.7.


2.0 (2023-02-10)
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ include *.rst
include *.txt
include buildout.cfg
include tox.ini
include .pre-commit-config.yaml

recursive-include src *.py
recursive-include src *.txt
Expand Down
21 changes: 21 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python

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

[tool.coverage.run]
branch = true
source = ["z3c.unconfigure"]

[tool.coverage.report]
fail_under = 93.5
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"
4 changes: 1 addition & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[bdist_wheel]
universal = 0

[flake8]
doctests = 1
Expand All @@ -15,7 +13,7 @@ ignore =
force_single_line = True
combine_as_imports = True
sections = FUTURE,STDLIB,THIRDPARTY,ZOPE,FIRSTPARTY,LOCALFOLDER
known_third_party = six, docutils, pkg_resources, pytz
known_third_party = docutils, pkg_resources, pytz
known_zope =
known_first_party =
default_section = ZOPE
Expand Down
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,20 @@ def read(*rnames):
'Intended Audience :: Developers',
'License :: OSI Approved :: Zope Public License',
'Programming Language :: Python',
'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 :: 3.12',
'Programming Language :: Python :: 3.13',
],

packages=find_packages('src'),
package_dir={'': 'src'},
namespace_packages=['z3c'],
include_package_data=True,
zip_safe=False,
python_requires='>=3.7',
python_requires='>=3.8',
install_requires=['setuptools',
'zope.configuration >= 3.8.0',
'zope.component', # technically [zcml]
Expand Down
67 changes: 32 additions & 35 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,74 +3,71 @@
[tox]
minversion = 3.18
envlist =
release-check
lint
py37
py38
py39
py310
py311
py312
py313
coverage

[testenv]
usedevelop = true
package = wheel
wheel_build_env = .pkg
deps =
setuptools < 74
zope.testrunner
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
zope.testrunner

[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:coverage]
basepython = python3
allowlist_externals =
mkdir
deps =
coverage
coverage[toml]
zope.testrunner
commands =
mkdir -p {toxinidir}/parts/htmlcov
coverage run -m zope.testrunner --test-path=src {posargs:-vc}
coverage html --ignore-errors
coverage report --ignore-errors --show-missing --fail-under=94

[coverage:run]
branch = True
source = z3c.unconfigure

[coverage:report]
precision = 2
exclude_lines =
pragma: no cover
pragma: nocover
except ImportError:
raise NotImplementedError
if __name__ == '__main__':
self.fail
raise AssertionError

[coverage:html]
directory = parts/htmlcov
coverage html
coverage report

0 comments on commit 50d7bc6

Please sign in to comment.