Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Wagtail 3.x and switch to pyproject.toml #34

Merged
merged 7 commits into from
Jan 9, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 49 additions & 26 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2

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

- name: Install dependencies
run: |
Expand All @@ -32,31 +32,22 @@ jobs:
strategy:
matrix:
toxenv:
- py36-dj22-wag211
- py36-dj22-waglatest
- py36-dj32-waglatest
- py39-dj22-wag211
- py39-dj22-waglatest
- py39-dj32-waglatest
- py38-dj3-wag2
- py38-dj3-wag3
- py38-dj3-waglatest
include:
- toxenv: py36-dj22-wag211
python-version: 3.6
- toxenv: py36-dj22-waglatest
python-version: 3.6
- toxenv: py36-dj32-waglatest
python-version: 3.6
- toxenv: py39-dj22-wag211
python-version: 3.9
- toxenv: py39-dj22-waglatest
python-version: 3.9
- toxenv: py39-dj32-waglatest
python-version: 3.9
- toxenv: py38-dj3-wag2
python-version: 3.8
- toxenv: py38-dj3-wag3
python-version: 3.8
- toxenv: py38-dj3-waglatest
python-version: 3.8

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -68,8 +59,40 @@ jobs:
- name: Run tox
run: |
tox
coveralls
env:
TOXENV: ${{ matrix.toxenv }}
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- 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.10"
willbarton marked this conversation as resolved.
Show resolved Hide resolved

- 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
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: ["treemodeladmin", "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
72 changes: 67 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,53 @@
[project]
name = "wagtail-treemodeladmin"
version = "1.5.0"
description = "TreeModelAdmin for Wagtail"
readme = "README.md"
requires-python = ">=3.8"
willbarton marked this conversation as resolved.
Show resolved Hide resolved
license = {text = "CC0"}
authors = [
{name = "CFPB", email = "tech@cfpb.gov" }
]
dependencies = [
"wagtail>=2.15,<4",
chosak marked this conversation as resolved.
Show resolved Hide resolved
]
classifiers = [
"Framework :: Django",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4",
"Framework :: Wagtail",
"Framework :: Wagtail :: 2",
"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-treemodeladmin"
"Bug Reports" = "https://github.com/cfpb/wagtail-treemodeladmin/issues"
"Source" = "https://github.com/cfpb/wagtail-treemodeladmin"

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

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

[tool.black]
line-length = 79
target-version = ['py36', 'py38']
target-version = ["py38"]
include = '\.pyi?$'
exclude = '''
(
Expand All @@ -14,8 +61,6 @@ exclude = '''
| dist
| migrations
| site
| \*.json
| \*.csv
)/
)
'''
Expand All @@ -37,5 +82,22 @@ sections = [
"LOCALFOLDER"
]

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

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

install_requires = [
"wagtail>=2.11,<3",
]

testing_extras = ["coverage>=3.7.0"]

setup(
name="wagtail-treemodeladmin",
url="https://github.com/cfpb/wagtail-treemodeladmin",
author="CFPB",
author_email="tech@cfpb.gov",
description="TreeModelAdmin for Wagtail",
long_description=open("README.md", "r", encoding="utf-8").read(),
long_description_content_type="text/markdown",
license="CC0",
version="1.5.0",
include_package_data=True,
packages=find_packages(),
package_data={
"treemodeladmin": [
"templates/treemodeladmin/*",
"templates/treemodeladmin/includes/*",
"static/treemodeladmin/css/*",
]
},
python_requires=">=3.6",
install_requires=install_requires,
extras_require={"testing": testing_extras},
classifiers=[
"Framework :: Django",
"Framework :: Django :: 2.2",
"Framework :: Django :: 3.1",
"Framework :: Wagtail",
"Framework :: Wagtail :: 2",
"License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication",
"License :: Public Domain",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
],
)
setup()
60 changes: 23 additions & 37 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,46 @@
skipsdist=True
envlist=
lint,
py{36,39}-dj{22}-wag{211,latest}
py{36,39}-dj{32}-wag{latest}
py{38,311}-dj{3}-wag{2,3,latest},
coverage

[testenv]
install_command=pip install -e ".[testing]" -U {opts} {packages}
commands=
coverage erase
coverage run --source='treemodeladmin' {envbindir}/django-admin test {posargs}
coverage report -m
python -b -m coverage run --parallel-mode --source='treemodeladmin' {envbindir}/django-admin test {posargs}
setenv=
DJANGO_SETTINGS_MODULE=treemodeladmin.tests.settings

basepython=
py36: python3.6
py39: python3.9
py38: python3.8
py311: python3.11

deps=
dj22: Django>=2.2,<2.3
dj32: Django>=3.2,<3.3
wag211: wagtail>=2.11,<2.12
dj3: Django>=3.2,<4
dj4: Django>=4.1,<5
wag2: wagtail>=2.15,<3
wag3: wagtail>=3,<4
waglatest: wagtail<3

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

[flake8]
ignore=E732,W503,W504
exclude=
.git,
.tox,
__pycache__,
*/migrations/*.py,
*/tests/treemodeladmintest/migrations/*

[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
[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

[coverage:run]
omit =
treemodeladmin/tests/*
14 changes: 0 additions & 14 deletions treemodeladmin/static/treemodeladmin/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,6 @@ header.hasform {
margin-bottom: 0;
}

header .button-small {
background-color: transparent;
color: #fff;
border-color: #358c8b;
}

header .button-small:hover {
background: #358c8b;
}

header .button.bicolor {
background: #358c8b;
}

willbarton marked this conversation as resolved.
Show resolved Hide resolved
.result-list.col12 {
padding: 0;
}
Expand Down
Loading