Skip to content

Commit

Permalink
Switch to pyproject.toml
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
willbarton committed Jan 11, 2023
1 parent a25621c commit 138ec56
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 97 deletions.
7 changes: 3 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ repos:
- id: black
args: ["wagtailflags", "setup.py", "--line-length=79"]
exclude: migrations
- repo: https://gitlab.com/pycqa/flake8
rev: 4.0.1
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.188
hooks:
- id: flake8
additional_dependencies: [flake8-bugbear==22.1.11]
- id: ruff
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
Expand Down
92 changes: 84 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,54 @@
[project]
name = "wagtail-flags"
version = "5.3.0"
description = "Feature flags for Wagtail sites"
readme = "README.md"
requires-python = ">=3.8"
license = {text = "CC0"}
authors = [
{name = "CFPB", email = "tech@cfpb.gov" }
]
dependencies = [
"wagtail>2.15,<4",
"django-flags>4.2,<5.1"
]
classifiers = [
"Framework :: Django",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4",
"Framework :: Wagtail",
"Framework :: Wagtail :: 3",
"License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication",
"License :: Public Domain",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
]

[project.optional-dependencies]
testing = [
"coverage[toml]",
]

[project.urls]
"Homepage" = "https://github.com/cfpb/wagtail-flags"
"Bug Reports" = "https://github.com/cfpb/wagtail-flags/issues"
"Source" = "https://github.com/cfpb/wagtail-flags"

[build-system]
requires = ["setuptools>=43.0.0", "wheel"]
build-backend = "setuptools.build_meta"

[tool.setuptools.package-data]
treemodeladmin = [
"templates/wagtailflags/*",
"templates/wagtailflags/flags/*",
"templates/wagtailflags/includes/*",
"static/wagtailflags/css/*",
]

[tool.black]
line-length = 79
target-version = ['py36', 'py38']
target-version = ["py38"]
include = '\.pyi?$'
exclude = '''
(
Expand All @@ -14,15 +62,43 @@ exclude = '''
| dist
| migrations
| site
| \*.json
| \*.csv
)/
)
'''

[build-system]
requires = [
"setuptools>=42",
"wheel"
[tool.isort]
profile = "black"
line_length = 79
lines_after_imports = 2
skip = [".tox", "migrations", ".venv", "venv"]
known_django = ["django"]
known_wagtail = ["wagtail"]
default_section = "THIRDPARTY"
sections = [
"STDLIB",
"DJANGO",
"WAGTAIL",
"THIRDPARTY",
"FIRSTPARTY",
"LOCALFOLDER"
]

[tool.ruff]
exclude = [
".git",
".tox",
"__pycache__",
"*/migrations/*.py",
"*/tests/treemodeladmintest/migrations/*",
]
ignore = []
select = [
"E",
"F",
"W",
]

[tool.coverage.run]
omit = [
"treemodeladmin/tests/*",
]
build-backend = "setuptools.build_meta"
76 changes: 0 additions & 76 deletions setup.cfg

This file was deleted.

18 changes: 9 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
skipsdist=True
envlist=
lint,
py{39,310}-dj{32}-wag{215},
py{39,310}-dj{32,40}-wag{30,latest},
py{38,311}-dj{32}-wag{215},
py{38,311}-dj{32,40}-wag{30,latest},
coverage

[testenv]
Expand All @@ -14,29 +14,29 @@ setenv=
DJANGO_SETTINGS_MODULE=wagtailflags.tests.settings

basepython=
py39: python3.9
py310: python3.10
py38: python3.8
py311: python3.11

deps=
dj32: Django>=3.2,<3.3
dj40: Django>=4.0,<4.1
wag215: wagtail>=2.15,<2.16
wag215: wagtail>=2.15,<4
wag30: wagtail>=3.0,<3.1
waglatest: wagtail<4

[testenv:lint]
basepython=python3.10
basepython=python3.8
deps=
black
flake8
ruff
isort
commands=
black --check wagtailflags
flake8 wagtailflags
ruff wagtailflags
isort --check-only --diff wagtailflags

[testenv:coverage]
basepython=python3.10
basepython=python3.8
deps=
coverage
diff_cover
Expand Down

0 comments on commit 138ec56

Please sign in to comment.