Skip to content

Commit a55be3f

Browse files
committed
Bye setuptools, hello hatchling and ruff
1 parent 1c4a48e commit a55be3f

File tree

10 files changed

+139
-86
lines changed

10 files changed

+139
-86
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
- "3.8"
1818
- "3.9"
1919
- "3.10"
20+
- "3.11"
2021

2122
steps:
2223
- uses: actions/checkout@v3
@@ -26,7 +27,7 @@ jobs:
2627
python-version: ${{ matrix.python-version }}
2728
- name: Install dependencies
2829
run: |
29-
python -m pip install --upgrade pip wheel setuptools tox
30+
python -m pip install --upgrade pip tox
3031
- name: Run tox targets for ${{ matrix.python-version }}
3132
run: |
3233
ENV_PREFIX=$(tr -C -d "0-9" <<< "${{ matrix.python-version }}")

.pre-commit-config.yaml

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,43 @@ repos:
44
rev: v4.4.0
55
hooks:
66
- id: check-added-large-files
7+
- id: check-builtin-literals
8+
- id: check-executables-have-shebangs
79
- id: check-merge-conflict
10+
- id: check-toml
11+
- id: check-yaml
12+
- id: detect-private-key
813
- id: end-of-file-fixer
14+
- id: mixed-line-ending
915
- id: trailing-whitespace
10-
- repo: https://github.com/asottile/pyupgrade
11-
rev: v3.3.1
12-
hooks:
13-
- id: pyupgrade
14-
args: [--py38-plus]
1516
- repo: https://github.com/adamchainz/django-upgrade
1617
rev: 1.13.0
1718
hooks:
1819
- id: django-upgrade
1920
args: [--target-version, "3.2"]
20-
- repo: https://github.com/pycqa/isort
21-
rev: 5.12.0
21+
- repo: https://github.com/MarcoGorelli/absolufy-imports
22+
rev: v0.3.1
23+
hooks:
24+
- id: absolufy-imports
25+
- repo: https://github.com/charliermarsh/ruff-pre-commit
26+
rev: "v0.0.269"
2227
hooks:
23-
- id: isort
24-
args: [--profile=black, --lines-after-imports=2, --combine-as]
28+
- id: ruff
2529
- repo: https://github.com/psf/black
26-
rev: 23.1.0
30+
rev: 23.3.0
2731
hooks:
2832
- id: black
29-
- repo: https://github.com/pycqa/flake8
30-
rev: 6.0.0
31-
hooks:
32-
- id: flake8
33-
args: ["--ignore=E203,E501,W503", "--max-complexity=15"]
34-
additional_dependencies:
35-
- flake8-bugbear
3633
- repo: https://github.com/pre-commit/mirrors-prettier
37-
rev: v3.0.0-alpha.6
34+
rev: v3.0.0-alpha.9-for-vscode
3835
hooks:
3936
- id: prettier
4037
args: [--list-different, --no-semi]
4138
exclude: "^conf/|.*\\.html$"
39+
- repo: https://github.com/tox-dev/pyproject-fmt
40+
rev: 0.11.2
41+
hooks:
42+
- id: pyproject-fmt
43+
- repo: https://github.com/abravalheri/validate-pyproject
44+
rev: v0.13
45+
hooks:
46+
- id: validate-pyproject

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Change log
88
.. _Next version: https://github.com/matthiask/feincms3-data/compare/0.5...main
99

1010
- Fixed the broken argument validation of ``./manage.py f3dumpdata``.
11+
- Switched to hatchling and ruff.
1112

1213

1314
`0.5`_ (2023-03-15)

MANIFEST.in

Lines changed: 0 additions & 6 deletions
This file was deleted.

feincms3_data/management/commands/f3dumpdata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ def handle(self, *args, **options):
2020
except KeyError:
2121
raise CommandError(
2222
f"Invalid dataset {dataset}; should be one of {', '.join(DATASETS)}"
23-
)
23+
) from None
2424
self.stdout.write(dump_specs(ds["specs"](args), mappers=ds.get("mappers")))

pyproject.toml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
[build-system]
2+
build-backend = "hatchling.build"
3+
requires = [
4+
"hatchling",
5+
]
6+
7+
[project]
8+
name = "feincms3-data"
9+
readme = "README.rst"
10+
license = {text = "BSD-3-Clause"}
11+
authors = [
12+
{ name = "Matthias Kestenholz", email = "mk@feinheit.ch" },
13+
]
14+
requires-python = ">=3.8"
15+
classifiers = [
16+
"Environment :: Web Environment",
17+
"Framework :: Django",
18+
"Intended Audience :: Developers",
19+
"License :: OSI Approved :: BSD License",
20+
"Operating System :: OS Independent",
21+
"Programming Language :: Python",
22+
"Programming Language :: Python :: 3 :: Only",
23+
"Programming Language :: Python :: 3.8",
24+
"Programming Language :: Python :: 3.9",
25+
"Programming Language :: Python :: 3.10",
26+
"Programming Language :: Python :: 3.11",
27+
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
28+
"Topic :: Software Development",
29+
"Topic :: Software Development :: Libraries :: Application Frameworks",
30+
]
31+
dynamic = [
32+
"version",
33+
]
34+
dependencies = [
35+
"Django>=3.2",
36+
]
37+
[project.optional-dependencies]
38+
tests = [
39+
"coverage",
40+
]
41+
[project.urls]
42+
Homepage = "https://github.com/matthiask/feincms3-data/"
43+
44+
[tool.hatch.version]
45+
path = "feincms3_data/__init__.py"
46+
47+
[tool.ruff]
48+
extend-select = [
49+
# pyflakes, pycodestyle
50+
"F", "E", "W",
51+
# mmcabe
52+
"C90",
53+
# isort
54+
"I",
55+
# pep8-naming
56+
"N",
57+
# pyupgrade
58+
"UP",
59+
# flake8-2020
60+
"YTT",
61+
# flake8-boolean-trap
62+
"FBT",
63+
# flake8-bugbear
64+
"B",
65+
# flake8-builtins
66+
"A",
67+
# flake8-comprehensions
68+
"C4",
69+
# flake8-django
70+
"DJ",
71+
# flake8-logging-format
72+
"G",
73+
# flake8-pie
74+
"PIE",
75+
# flake8-simplify
76+
"SIM",
77+
# flake8-gettext
78+
"INT",
79+
# pygrep-hooks
80+
"PGH",
81+
# pylint
82+
"PL",
83+
# unused noqa
84+
"RUF100",
85+
]
86+
extend-ignore = [
87+
# Allow zip() without strict=
88+
"B905",
89+
# No line length errors
90+
"E501",
91+
]
92+
fix = true
93+
show-fixes = true
94+
target-version = "py38"
95+
96+
[tool.ruff.isort]
97+
combine-as-imports = true
98+
lines-after-imports = 2
99+
100+
[tool.ruff.mccabe]
101+
max-complexity = 15
102+
103+
[tool.ruff.per-file-ignores]
104+
"*/migrat*/*" = [
105+
# Allow using PascalCase model names in migrations
106+
"N806",
107+
# Ignore the fact that migration files are invalid module names
108+
"N999",
109+
]

setup.cfg

Lines changed: 0 additions & 52 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

tests/testapp/test_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from django.db import models
44
from django.test import TransactionTestCase
5-
from testapp.models import Child, Child1, Parent, Related, Tag, UniqueSlug
65

76
from feincms3_data.data import (
87
InvalidSpec,
@@ -15,6 +14,7 @@
1514
specs_for_derived_models,
1615
specs_for_models,
1716
)
17+
from testapp.models import Child, Child1, Parent, Related, Tag, UniqueSlug
1818

1919

2020
def parent_child1_set():

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tox]
22
envlist =
33
py{38,39,310}-dj{32,40,41,42}
4-
py{310}-dj{32,40,41,42,main}
4+
py{310,311}-dj{32,40,41,42,main}
55

66
[testenv]
77
usedevelop = true
@@ -13,7 +13,7 @@ deps =
1313
dj32: Django>=3.2,<4.0
1414
dj40: Django>=4.0,<4.1
1515
dj41: Django>=4.1,<4.2
16-
dj42: Django>=4.2a1,<5.0
16+
dj42: Django>=4.2,<5.0
1717
djmain: https://github.com/django/django/archive/main.tar.gz
1818

1919
[testenv:docs]

0 commit comments

Comments
 (0)