Skip to content

Commit 792848d

Browse files
willbartonchosak
andcommitted
Switch to pyproject.toml
With [PEP 621 support added to setuptools](pypa/setuptools#2970) last year, and with pip supporting editable installs as of 21.3, we can move to `pyproject.toml` and deprecate `setup.py`. The file remains for legacy pip support. Because [flake8 does not want to support pyproject.tml yet](PyCQA/flake8#234), unlike all the other tools we use, I’m removing it in favor of [ruff](https://github.com/charliermarsh/ruff). This change also continues support for Wagtail 3. Co-authored-by: Andy Chosak <[email protected]>
1 parent 2a6cf5b commit 792848d

File tree

6 files changed

+132
-110
lines changed

6 files changed

+132
-110
lines changed

.flake8

-21
This file was deleted.

.github/workflows/test.yml

+41-12
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,14 @@ jobs:
3131

3232
strategy:
3333
matrix:
34-
python: ['3.8', '3.9', '3.10']
35-
django: ['3.2', '4.0', '4.1']
36-
wagtail: ['4.1','4.2']
34+
python: ['3.8', '3.11']
35+
django: ['3.2', '4.1']
36+
wagtail: ['4.1', '4.2']
3737
include:
38-
- python: '3.11'
39-
django: '4.1'
40-
wagtail: '4.1'
41-
- python: '3.11'
42-
django: '4.1'
43-
wagtail: '4.2'
38+
- python: '3.8'
39+
django: '3.2'
40+
wagtail: '3.0'
41+
4442
steps:
4543
- uses: actions/checkout@v3
4644

@@ -57,8 +55,39 @@ jobs:
5755
- name: Run tox
5856
run: |
5957
tox
60-
coveralls
6158
env:
6259
TOXENV: python${{ matrix.python }}-django${{ matrix.django }}-wagtail${{ matrix.wagtail }}
63-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64-
COVERALLS_SERVICE_NAME: github
60+
61+
- name: Store test coverage
62+
uses: actions/upload-artifact@v2
63+
with:
64+
name: coverage
65+
path: .coverage.*
66+
67+
coverage:
68+
name: coverage
69+
runs-on: ubuntu-latest
70+
needs:
71+
- test
72+
73+
steps:
74+
- uses: actions/checkout@v3
75+
with:
76+
fetch-depth: 0
77+
78+
- name: Set up Python
79+
uses: actions/setup-python@v4
80+
with:
81+
python-version: "3.8"
82+
83+
- name: Install dependencies
84+
run: |
85+
python -m pip install --upgrade pip
86+
pip install tox
87+
- name: Retrieve test coverage
88+
uses: actions/download-artifact@v2
89+
with:
90+
name: coverage
91+
92+
- name: Check coverage
93+
run: tox -e coverage

README.rst

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
.. image:: https://github.com/cfpb/wagtail-inventory/workflows/test/badge.svg
22
:alt: Build Status
33
:target: https://github.com/cfpb/wagtail-inventory/actions/workflows/test.yml
4-
.. image:: https://coveralls.io/repos/github/cfpb/wagtail-inventory/badge.svg?branch=main
5-
:alt: Coverage Status
6-
:target: https://coveralls.io/github/cfpb/wagtail-inventory?branch=main
74

85
wagtail-inventory
96
=================
@@ -52,8 +49,8 @@ Compatibility
5249
This code has been tested for compatibility with:
5350

5451
* Python 3.8+
55-
* Django 3.2 (LTS), 4.0, 4.1
56-
* Wagtail 4.1 (LTS), 4.2
52+
* Django 3.2 (LTS), 4.1
53+
* Wagtail 3.0, 4.1 (LTS), 4.2
5754

5855
It should be compatible with all intermediate versions, as well.
5956
If you find that it is not, please `file an issue <https://github.com/cfpb/wagtail-inventory/issues/new>`_.

pyproject.toml

+69-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,52 @@
1+
[project]
2+
name = "wagtail-inventory"
3+
version = "1.6.0"
4+
description = "Lookup Wagtail pages by block content"
5+
readme = "README.rst"
6+
requires-python = ">=3.8"
7+
license = {text = "CC0"}
8+
authors = [
9+
{name = "CFPB", email = "[email protected]" }
10+
]
11+
dependencies = [
12+
"tqdm>=4.15.0,<5",
13+
"wagtail>=3",
14+
]
15+
classifiers = [
16+
"Framework :: Django",
17+
"Framework :: Django :: 3.2",
18+
"Framework :: Django :: 4",
19+
"Framework :: Wagtail",
20+
"Framework :: Wagtail :: 3",
21+
"Framework :: Wagtail :: 4",
22+
"License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication",
23+
"License :: Public Domain",
24+
"Programming Language :: Python",
25+
"Programming Language :: Python :: 3",
26+
]
27+
28+
[project.optional-dependencies]
29+
testing = [
30+
"coverage[toml]",
31+
]
32+
33+
[project.urls]
34+
"Homepage" = "https://github.com/cfpb/wagtail-inventory"
35+
"Bug Reports" = "https://github.com/cfpb/wagtail-inventory/issues"
36+
"Source" = "https://github.com/cfpb/wagtail-inventory"
37+
38+
[build-system]
39+
requires = ["setuptools>=43.0.0", "wheel"]
40+
build-backend = "setuptools.build_meta"
41+
42+
[tool.setuptools.package-data]
43+
inventory = [
44+
"templates/wagtailinventory/*",
45+
]
46+
147
[tool.black]
248
line-length = 79
3-
target-version = ['py36', 'py38']
49+
target-version = ["py38"]
450
include = '\.pyi?$'
551
exclude = '''
652
(
@@ -13,9 +59,6 @@ exclude = '''
1359
| build
1460
| dist
1561
| migrations
16-
| site
17-
| \*.json
18-
| \*.csv
1962
)/
2063
)
2164
'''
@@ -37,5 +80,25 @@ sections = [
3780
"LOCALFOLDER"
3881
]
3982

40-
[build-system]
41-
requires = ["setuptools", "wheel"]
83+
[tool.ruff]
84+
exclude = [
85+
".git",
86+
".tox",
87+
"__pycache__",
88+
"*/migrations/*.py",
89+
"*/tests/testapp/migrations/*.py",
90+
"docs",
91+
".venv",
92+
"venv",
93+
]
94+
ignore = []
95+
select = [
96+
"E",
97+
"F",
98+
"W",
99+
]
100+
101+
[tool.coverage.run]
102+
omit = [
103+
"wagtailinventory/tests/*",
104+
]

setup.py

+2-43
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,4 @@
1-
from setuptools import find_packages, setup
1+
from setuptools import setup
22

33

4-
install_requires = [
5-
"tqdm>=4.15.0,<5",
6-
"wagtail>=4.1",
7-
]
8-
9-
10-
testing_extras = [
11-
"coverage>=3.7.0",
12-
"mock>=1.0.0",
13-
]
14-
15-
setup(
16-
name="wagtail-inventory",
17-
url="https://github.com/cfpb/wagtail-inventory",
18-
author="CFPB",
19-
author_email="[email protected]",
20-
description="Lookup Wagtail pages by block content",
21-
long_description=open("README.rst", "r", encoding="utf-8").read(),
22-
license="CCO",
23-
version="1.6",
24-
include_package_data=True,
25-
packages=find_packages(),
26-
python_requires=">=3.8",
27-
install_requires=install_requires,
28-
extras_require={"testing": testing_extras},
29-
classifiers=[
30-
"Framework :: Django",
31-
"Framework :: Django :: 3.2",
32-
"Framework :: Django :: 4.0",
33-
"Framework :: Django :: 4.1",
34-
"Framework :: Wagtail",
35-
"Framework :: Wagtail :: 4",
36-
"License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication",
37-
"License :: Public Domain",
38-
"Programming Language :: Python",
39-
"Programming Language :: Python :: 3",
40-
"Programming Language :: Python :: 3.8",
41-
"Programming Language :: Python :: 3.9",
42-
"Programming Language :: Python :: 3.10",
43-
"Programming Language :: Python :: 3.11",
44-
],
45-
)
4+
setup()

tox.ini

+18-23
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,48 @@
22
skipsdist=True
33
envlist=
44
lint,
5-
python{3.8,3.9,3.10}-django{3.2,4.0,4.1}-wagtail{4.1,4.2}
6-
python{3.11}-django{4.1}-wagtail{4.1,4.2}
5+
python{3.8}-django{3.2}-wagtail{3.0},
6+
python{3.8,3.11}-django{3.2,4.1}-wagtail{4.1,4.2},
7+
coverage
78

89
[testenv]
910
install_command=pip install -e ".[testing]" -U {opts} {packages}
1011
commands=
11-
coverage erase
12-
coverage run {toxinidir}/testmanage.py test {posargs}
13-
coverage report --show-missing --fail-under=100
12+
python -b -m coverage run --parallel-mode --source='wagtailinventory' {toxinidir}/testmanage.py test {posargs}
1413

1514
basepython=
1615
python3.8: python3.8
17-
python3.9: python3.9
18-
python3.10: python3.10
1916
python3.11: python3.11
2017

2118
deps=
22-
mock>=1.0.0
2319
django3.2: Django>=3.2,<3.3
24-
django4.0: Django>=4.0,<4.1
2520
django4.1: Django>=4.1,<4.2
21+
wagtail3.0: wagtail>=3.0,<4.0
2622
wagtail4.1: wagtail>=4.1,<4.2
2723
wagtail4.2: wagtail>=4.2,<5.0
2824

2925
[testenv:lint]
3026
basepython=python3.8
3127
deps=
3228
black
33-
flake8
29+
ruff
3430
isort
3531
commands=
3632
black --check wagtailinventory setup.py testmanage.py
37-
flake8 wagtailinventory setup.py testmanage.py
33+
ruff wagtailinventory testmanage.py
3834
isort --check-only --diff wagtailinventory testmanage.py
3935

36+
[testenv:coverage]
37+
basepython=python3.8
38+
deps=
39+
coverage[toml]
40+
diff_cover
41+
commands=
42+
coverage combine
43+
coverage report -m
44+
coverage xml
45+
diff-cover coverage.xml --compare-branch=origin/main --fail-under=100
46+
4047
[testenv:interactive]
4148
basepython=python3.8
4249

@@ -52,15 +59,3 @@ commands=
5259

5360
setenv=
5461
INTERACTIVE=1
55-
56-
[isort]
57-
combine_as_imports=1
58-
lines_after_imports=2
59-
include_trailing_comma=1
60-
multi_line_output=3
61-
skip=.tox,migrations
62-
use_parentheses=1
63-
known_django=django
64-
known_wagtail=wagtail
65-
default_section=THIRDPARTY
66-
sections=FUTURE,STDLIB,DJANGO,WAGTAIL,THIRDPARTY,FIRSTPARTY,LOCALFOLDER

0 commit comments

Comments
 (0)