Skip to content

Commit ada2f73

Browse files
committed
Configuring for pure-python
1 parent 12dfc4c commit ada2f73

File tree

9 files changed

+161
-74
lines changed

9 files changed

+161
-74
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: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,50 +12,51 @@ 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-
- ["pypy-3.7", "pypy3"]
30-
- ["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+
- ["pypy-3.10", "pypy3"]
33+
- ["3.11", "coverage"]
3134

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

.meta.toml

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

77
[python]
88
with-pypy = true
9-
with-legacy-python = true
109
with-sphinx-doctests = false
1110
with-windows = false
1211
with-future-python = false
1312
with-macos = false
13+
with-docs = false
1414

1515
[coverage]
1616
fail-under = 95
@@ -24,9 +24,6 @@ additional-config = [
2424
" src/grokcore/formlib/tests/__init__.py: F401 F403",
2525
]
2626

27-
[tox]
28-
use-flake8 = true
29-
3027
[manifest]
3128
additional-rules = [
3229
"recursive-include src *.pt",

.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.2.0"
25+
hooks:
26+
- id: flake8
27+
additional_dependencies:
28+
- flake8-debugger == 4.1.2

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 *.pt

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 = ["grokcore.formlib"]
14+
15+
[tool.coverage.report]
16+
fail_under = 95
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
@@ -20,7 +18,7 @@ ignore =
2018
force_single_line = True
2119
combine_as_imports = True
2220
sections = FUTURE,STDLIB,THIRDPARTY,ZOPE,FIRSTPARTY,LOCALFOLDER
23-
known_third_party = six, docutils, pkg_resources
21+
known_third_party = docutils, pkg_resources, pytz
2422
known_zope =
2523
known_first_party =
2624
default_section = ZOPE

tox.ini

Lines changed: 32 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,75 +3,69 @@
33
[tox]
44
minversion = 3.18
55
envlist =
6+
release-check
67
lint
7-
py37
8-
py38
98
py39
109
py310
1110
py311
11+
py312
12+
py313
1213
pypy3
1314
coverage
1415

1516
[testenv]
1617
usedevelop = true
18+
package = wheel
19+
wheel_build_env = .pkg
1720
deps =
21+
setuptools == 75.8.2
1822
commands =
1923
zope-testrunner --test-path=src {posargs:-vc}
2024
extras =
2125
test
2226

23-
[testenv:lint]
27+
[testenv:setuptools-latest]
28+
basepython = python3
29+
deps =
30+
git+https://github.com/pypa/setuptools.git\#egg=setuptools
31+
32+
[testenv:release-check]
33+
description = ensure that the distribution is ready to release
2434
basepython = python3
2535
skip_install = true
26-
commands =
27-
isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py
28-
flake8 src setup.py
29-
check-manifest
30-
check-python-versions
3136
deps =
37+
setuptools == 75.8.2
38+
wheel
39+
twine
40+
build
3241
check-manifest
33-
check-python-versions >= 0.19.1
42+
check-python-versions >= 0.20.0
3443
wheel
35-
flake8
36-
isort
44+
commands_pre =
45+
commands =
46+
check-manifest
47+
check-python-versions --only setup.py,tox.ini,.github/workflows/tests.yml
48+
python -m build --sdist --no-isolation
49+
twine check dist/*
3750

38-
[testenv:isort-apply]
51+
[testenv:lint]
52+
description = This env runs all linters configured in .pre-commit-config.yaml
3953
basepython = python3
4054
skip_install = true
41-
commands_pre =
4255
deps =
43-
isort
56+
pre-commit
57+
commands_pre =
4458
commands =
45-
isort {toxinidir}/src {toxinidir}/setup.py []
59+
pre-commit run --all-files --show-diff-on-failure
4660

4761
[testenv:coverage]
4862
basepython = python3
4963
allowlist_externals =
5064
mkdir
5165
deps =
52-
coverage
53-
coverage-python-version
66+
coverage[toml]
5467
commands =
5568
mkdir -p {toxinidir}/parts/htmlcov
5669
coverage run -m zope.testrunner --test-path=src {posargs:-vc}
57-
coverage html --ignore-errors
58-
coverage report --ignore-errors --show-missing --fail-under=95
59-
60-
[coverage:run]
61-
branch = True
62-
plugins = coverage_python_version
63-
source = grokcore.formlib
64-
65-
[coverage:report]
66-
precision = 2
67-
exclude_lines =
68-
pragma: no cover
69-
pragma: nocover
70-
except ImportError:
71-
raise NotImplementedError
72-
if __name__ == '__main__':
73-
self.fail
74-
raise AssertionError
75-
76-
[coverage:html]
77-
directory = parts/htmlcov
70+
coverage html
71+
coverage report

0 commit comments

Comments
 (0)