Skip to content

Commit 138ec56

Browse files
committed
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).
1 parent a25621c commit 138ec56

File tree

4 files changed

+96
-97
lines changed

4 files changed

+96
-97
lines changed

.pre-commit-config.yaml

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ repos:
55
- id: black
66
args: ["wagtailflags", "setup.py", "--line-length=79"]
77
exclude: migrations
8-
- repo: https://gitlab.com/pycqa/flake8
9-
rev: 4.0.1
8+
- repo: https://github.com/charliermarsh/ruff-pre-commit
9+
rev: v0.0.188
1010
hooks:
11-
- id: flake8
12-
additional_dependencies: [flake8-bugbear==22.1.11]
11+
- id: ruff
1312
- repo: https://github.com/pycqa/isort
1413
rev: 5.10.1
1514
hooks:

pyproject.toml

+84-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,54 @@
1+
[project]
2+
name = "wagtail-flags"
3+
version = "5.3.0"
4+
description = "Feature flags for Wagtail sites"
5+
readme = "README.md"
6+
requires-python = ">=3.8"
7+
license = {text = "CC0"}
8+
authors = [
9+
{name = "CFPB", email = "[email protected]" }
10+
]
11+
dependencies = [
12+
"wagtail>2.15,<4",
13+
"django-flags>4.2,<5.1"
14+
]
15+
classifiers = [
16+
"Framework :: Django",
17+
"Framework :: Django :: 3.2",
18+
"Framework :: Django :: 4",
19+
"Framework :: Wagtail",
20+
"Framework :: Wagtail :: 3",
21+
"License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication",
22+
"License :: Public Domain",
23+
"Programming Language :: Python",
24+
"Programming Language :: Python :: 3",
25+
]
26+
27+
[project.optional-dependencies]
28+
testing = [
29+
"coverage[toml]",
30+
]
31+
32+
[project.urls]
33+
"Homepage" = "https://github.com/cfpb/wagtail-flags"
34+
"Bug Reports" = "https://github.com/cfpb/wagtail-flags/issues"
35+
"Source" = "https://github.com/cfpb/wagtail-flags"
36+
37+
[build-system]
38+
requires = ["setuptools>=43.0.0", "wheel"]
39+
build-backend = "setuptools.build_meta"
40+
41+
[tool.setuptools.package-data]
42+
treemodeladmin = [
43+
"templates/wagtailflags/*",
44+
"templates/wagtailflags/flags/*",
45+
"templates/wagtailflags/includes/*",
46+
"static/wagtailflags/css/*",
47+
]
48+
149
[tool.black]
250
line-length = 79
3-
target-version = ['py36', 'py38']
51+
target-version = ["py38"]
452
include = '\.pyi?$'
553
exclude = '''
654
(
@@ -14,15 +62,43 @@ exclude = '''
1462
| dist
1563
| migrations
1664
| site
17-
| \*.json
18-
| \*.csv
1965
)/
2066
)
2167
'''
2268

23-
[build-system]
24-
requires = [
25-
"setuptools>=42",
26-
"wheel"
69+
[tool.isort]
70+
profile = "black"
71+
line_length = 79
72+
lines_after_imports = 2
73+
skip = [".tox", "migrations", ".venv", "venv"]
74+
known_django = ["django"]
75+
known_wagtail = ["wagtail"]
76+
default_section = "THIRDPARTY"
77+
sections = [
78+
"STDLIB",
79+
"DJANGO",
80+
"WAGTAIL",
81+
"THIRDPARTY",
82+
"FIRSTPARTY",
83+
"LOCALFOLDER"
84+
]
85+
86+
[tool.ruff]
87+
exclude = [
88+
".git",
89+
".tox",
90+
"__pycache__",
91+
"*/migrations/*.py",
92+
"*/tests/treemodeladmintest/migrations/*",
93+
]
94+
ignore = []
95+
select = [
96+
"E",
97+
"F",
98+
"W",
99+
]
100+
101+
[tool.coverage.run]
102+
omit = [
103+
"treemodeladmin/tests/*",
27104
]
28-
build-backend = "setuptools.build_meta"

setup.cfg

-76
This file was deleted.

tox.ini

+9-9
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
skipsdist=True
33
envlist=
44
lint,
5-
py{39,310}-dj{32}-wag{215},
6-
py{39,310}-dj{32,40}-wag{30,latest},
5+
py{38,311}-dj{32}-wag{215},
6+
py{38,311}-dj{32,40}-wag{30,latest},
77
coverage
88

99
[testenv]
@@ -14,29 +14,29 @@ setenv=
1414
DJANGO_SETTINGS_MODULE=wagtailflags.tests.settings
1515

1616
basepython=
17-
py39: python3.9
18-
py310: python3.10
17+
py38: python3.8
18+
py311: python3.11
1919

2020
deps=
2121
dj32: Django>=3.2,<3.3
2222
dj40: Django>=4.0,<4.1
23-
wag215: wagtail>=2.15,<2.16
23+
wag215: wagtail>=2.15,<4
2424
wag30: wagtail>=3.0,<3.1
2525
waglatest: wagtail<4
2626

2727
[testenv:lint]
28-
basepython=python3.10
28+
basepython=python3.8
2929
deps=
3030
black
31-
flake8
31+
ruff
3232
isort
3333
commands=
3434
black --check wagtailflags
35-
flake8 wagtailflags
35+
ruff wagtailflags
3636
isort --check-only --diff wagtailflags
3737

3838
[testenv:coverage]
39-
basepython=python3.10
39+
basepython=python3.8
4040
deps=
4141
coverage
4242
diff_cover

0 commit comments

Comments
 (0)