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).

This change also continues support for Wagtail 3.
  • Loading branch information
willbarton committed Feb 27, 2023
1 parent b2e4161 commit 3ef76ae
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 107 deletions.
21 changes: 0 additions & 21 deletions .flake8

This file was deleted.

53 changes: 41 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@ jobs:

strategy:
matrix:
python: ['3.8', '3.9', '3.10']
django: ['3.2', '4.0', '4.1']
wagtail: ['4.1','4.2']
python: ['3.8', '3.11']
django: ['3.2', '4.1']
wagtail: ['4.1', '4.2']
include:
- python: '3.11'
django: '4.1'
wagtail: '4.1'
- python: '3.11'
django: '4.1'
wagtail: '4.2'
- python: '3.8'
django: '3.2'
wagtail: '3.0'

steps:
- uses: actions/checkout@v3

Expand All @@ -57,8 +55,39 @@ jobs:
- name: Run tox
run: |
tox
coveralls
env:
TOXENV: python${{ matrix.python }}-django${{ matrix.django }}-wagtail${{ matrix.wagtail }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github

- name: Store test coverage
uses: actions/upload-artifact@v2
with:
name: coverage
path: .coverage.*

coverage:
name: coverage
runs-on: ubuntu-latest
needs:
- test

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Retrieve test coverage
uses: actions/download-artifact@v2
with:
name: coverage

- name: Check coverage
run: tox -e coverage
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ Compatibility
This code has been tested for compatibility with:

* Python 3.8+
* Django 3.2 (LTS), 4.0, 4.1
* Wagtail 4.1 (LTS), 4.2
* Django 3.2 (LTS), 4.1
* Wagtail 3.0, 4.1 (LTS), 4.2

It should be compatible with all intermediate versions, as well.
If you find that it is not, please `file an issue <https://github.com/cfpb/wagtail-inventory/issues/new>`_.
Expand Down
76 changes: 70 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,53 @@
[project]
name = "wagtail-inventory"
version = "1.6.0"
description = "Lookup Wagtail pages by block content"
readme = "README.rst"
requires-python = ">=3.8"
license = {text = "CC0"}
authors = [
{name = "CFPB", email = "[email protected]" }
]
dependencies = [
"tqdm>=4.15.0,<5",
"wagtail>=3",
]
classifiers = [
"Framework :: Django",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4",
"Framework :: Wagtail",
"Framework :: Wagtail :: 2",
"Framework :: Wagtail :: 3",
"Framework :: Wagtail :: 4",
"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-inventory"
"Bug Reports" = "https://github.com/cfpb/wagtail-inventory/issues"
"Source" = "https://github.com/cfpb/wagtail-inventory"

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

[tool.setuptools.package-data]
inventory = [
"templates/wagtailinventory/*",
]

[tool.black]
line-length = 79
target-version = ['py36', 'py38']
target-version = ["py38"]
include = '\.pyi?$'
exclude = '''
(
Expand All @@ -13,9 +60,6 @@ exclude = '''
| build
| dist
| migrations
| site
| \*.json
| \*.csv
)/
)
'''
Expand All @@ -37,5 +81,25 @@ sections = [
"LOCALFOLDER"
]

[build-system]
requires = ["setuptools", "wheel"]
[tool.ruff]
exclude = [
".git",
".tox",
"__pycache__",
"*/migrations/*.py",
"*/tests/testapp/migrations/*.py",
"docs",
".venv",
"venv",
]
ignore = []
select = [
"E",
"F",
"W",
]

[tool.coverage.run]
omit = [
"wagtailinventory/tests/*",
]
45 changes: 2 additions & 43 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,45 +1,4 @@
from setuptools import find_packages, setup
from setuptools import setup


install_requires = [
"tqdm>=4.15.0,<5",
"wagtail>=4.1",
]


testing_extras = [
"coverage>=3.7.0",
"mock>=1.0.0",
]

setup(
name="wagtail-inventory",
url="https://github.com/cfpb/wagtail-inventory",
author="CFPB",
author_email="[email protected]",
description="Lookup Wagtail pages by block content",
long_description=open("README.rst", "r", encoding="utf-8").read(),
license="CCO",
version="1.6",
include_package_data=True,
packages=find_packages(),
python_requires=">=3.8",
install_requires=install_requires,
extras_require={"testing": testing_extras},
classifiers=[
"Framework :: Django",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.0",
"Framework :: Django :: 4.1",
"Framework :: Wagtail",
"Framework :: Wagtail :: 4",
"License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication",
"License :: Public Domain",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
)
setup()
40 changes: 17 additions & 23 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,47 @@
skipsdist=True
envlist=
lint,
python{3.8,3.9,3.10}-django{3.2,4.0,4.1}-wagtail{4.1,4.2}
python{3.11}-django{4.1}-wagtail{4.1,4.2}
python{3.8}-django{3.2}-wagtail{3.0},
python{3.8,3.11}-django{3.2,4.1}-wagtail{4.1,4.2}

[testenv]
install_command=pip install -e ".[testing]" -U {opts} {packages}
commands=
coverage erase
coverage run {toxinidir}/testmanage.py test {posargs}
coverage report --show-missing --fail-under=100
python -b -m coverage run --parallel-mode --source='wagtailinventory' {envbindir}/django-admin test {posargs}

basepython=
python3.8: python3.8
python3.9: python3.9
python3.10: python3.10
python3.11: python3.11

deps=
mock>=1.0.0
django3.2: Django>=3.2,<3.3
django4.0: Django>=4.0,<4.1
django4.1: Django>=4.1,<4.2
wagtail3.0: wagtail>=3.0,<4.0
wagtail4.1: wagtail>=4.1,<4.2
wagtail4.2: wagtail>=4.2,<5.0

[testenv:lint]
basepython=python3.8
deps=
black
flake8
ruff
isort
commands=
black --check wagtailinventory setup.py testmanage.py
flake8 wagtailinventory setup.py testmanage.py
ruff wagtailinventory testmanage.py
isort --check-only --diff wagtailinventory testmanage.py

[testenv:coverage]
basepython=python3.8
deps=
coverage[toml]
diff_cover
commands=
coverage combine
coverage report -m
coverage xml
diff-cover coverage.xml --compare-branch=origin/main --fail-under=100

[testenv:interactive]
basepython=python3.8

Expand All @@ -52,15 +58,3 @@ commands=

setenv=
INTERACTIVE=1

[isort]
combine_as_imports=1
lines_after_imports=2
include_trailing_comma=1
multi_line_output=3
skip=.tox,migrations
use_parentheses=1
known_django=django
known_wagtail=wagtail
default_section=THIRDPARTY
sections=FUTURE,STDLIB,DJANGO,WAGTAIL,THIRDPARTY,FIRSTPARTY,LOCALFOLDER

0 comments on commit 3ef76ae

Please sign in to comment.