Skip to content

Commit

Permalink
Update Python version support. (#15)
Browse files Browse the repository at this point in the history
* Add support for Python 3.13.
  • Loading branch information
icemac authored Dec 5, 2024
1 parent e1c8ef7 commit 451f245
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 47 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/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
17 changes: 9 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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", "coverage"]
- ["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
Expand All @@ -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:
Expand Down
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/pure-python
[meta]
template = "pure-python"
commit-id = "2247fc22"
commit-id = "c4179d8f"

[python]
with-pypy = true
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.19.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
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
2.0 (unreleased)
================

- Add support for Python 3.13.

- Drop support for Python 2.7, 3.5, 3.6, 3.7.

- Add support for Python 3.9, 3.10, 3.11, 3.12.
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 *.pt
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 = ["zope.file"]

[tool.coverage.report]
fail_under = 95
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"
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def read(*rnames):
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Natural Language :: English',
Expand Down
53 changes: 15 additions & 38 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ envlist =
py310
py311
py312
py313
pypy3
coverage
minimal
Expand All @@ -19,10 +20,7 @@ usedevelop = true
package = wheel
wheel_build_env = .pkg
deps =
setuptools < 69
setenv =
py312: VIRTUALENV_PIP=23.1.2
py312: PIP_REQUIRE_VIRTUALENV=0
setuptools < 74
commands =
zope-testrunner --test-path=src {posargs:-vc}
extras =
Expand All @@ -33,11 +31,18 @@ extras =
deps =
zope.testrunner
zope.testing

[testenv:setuptools-latest]
basepython = python3
deps =
git+https://github.com/pypa/setuptools.git\#egg=setuptools

[testenv:release-check]
description = ensure that the distribution is ready to release
basepython = python3
skip_install = true
deps =
setuptools < 74
twine
build
check-manifest
Expand All @@ -51,51 +56,23 @@ commands =
twine check dist/*

[testenv:lint]
description = This env runs all linters configured in .pre-commit-config.yaml
basepython = python3
skip_install = true
deps =
isort
flake8
commands =
isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py
flake8 src setup.py

[testenv:isort-apply]
basepython = python3
skip_install = true
pre-commit
commands_pre =
deps =
isort
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]
commands =
mkdir -p {toxinidir}/parts/htmlcov
coverage run -m zope.testrunner --test-path=src {posargs:-vc}
coverage html --ignore-errors
coverage report --show-missing --fail-under=95

[coverage:run]
branch = True
source = zope.file

[coverage:report]
precision = 2
ignore_errors = True
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 451f245

Please sign in to comment.