Skip to content

Commit 42512f1

Browse files
authored
Use dependency-groups instead of test-requirements.txt (#246)
* Try out using dependency-groups * tox always uses isolated builds in v4+ * update tox config for dependency-groups
1 parent 8afb9b2 commit 42512f1

File tree

6 files changed

+34
-17
lines changed

6 files changed

+34
-17
lines changed

.github/workflows/linting.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ jobs:
2525

2626
- name: Install flake8
2727
run: |
28-
python -m pip install --upgrade pip wheel
29-
python -m pip install flake8
30-
python --version
28+
pip install --group lint
3129
pip list
3230
3331
- name: Run flake8
@@ -48,8 +46,8 @@ jobs:
4846

4947
- name: Install bandit
5048
run: |
51-
python -m pip install --upgrade pip wheel
52-
python -m pip install bandit
49+
pip install --group security
50+
pip list
5351
5452
- name: Run bandit
5553
# "B101:assert_used" is allowed in tests.

.github/workflows/publish-to-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727

2828
- name: Install pypa/build
2929
run: |
30-
pip install build
30+
pip install --group build
3131
python --version
3232
pip list
3333

.github/workflows/tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ jobs:
9696

9797
- name: Install test requirements
9898
run: |
99-
python -m pip install --upgrade pip wheel
100-
pip install django~=${{ matrix.django }}.0 coverage[toml]~=7.0 -r tests-requirements.txt
99+
pip install django~=${{ matrix.django }}.0 --group test
101100
python --version
102101
pip list
103102

pyproject.toml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,31 @@ Documentation = "https://django-dirtyfields.readthedocs.io"
5252
[tool.setuptools.dynamic]
5353
version = {attr = "dirtyfields.__version__"}
5454

55+
[dependency-groups]
56+
dev = [
57+
{include-group = "test"},
58+
{include-group = "lint"},
59+
{include-group = "security"},
60+
{include-group = "build"},
61+
]
62+
test = [
63+
"pytest>=8.4.0,<9",
64+
"coverage[toml]>=7.10.0,<8",
65+
"psycopg2",
66+
# let pip choose the latest version compatible with the python/django version being tested.
67+
"pytest-django",
68+
"jsonfield",
69+
]
70+
lint = [
71+
"flake8",
72+
]
73+
security = [
74+
"bandit",
75+
]
76+
build = [
77+
"build",
78+
]
79+
5580
[tool.pytest.ini_options]
5681
django_find_project = false
5782
DJANGO_SETTINGS_MODULE = 'tests.django_settings'

tests-requirements.txt

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

tox.ini

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
; tox is just used for testing the python/django matrix locally
22
[tox]
3-
isolated_build = True
43
envlist =
54
py{39}-django{22,30,31}-{postgresql,sqlite}
65
py{39,310}-django{32,40}-{postgresql,sqlite}
@@ -17,7 +16,6 @@ passenv =
1716
setenv =
1817
PYTHONPATH = {toxinidir}
1918
deps =
20-
coverage[toml]~=7.0
2119
django22: Django>=2.2,<2.3
2220
django30: Django>=3.0,<3.1
2321
django31: Django>=3.1,<3.2
@@ -28,7 +26,8 @@ deps =
2826
django50: Django>=5.0,<5.1
2927
django51: Django>=5.1,<5.2
3028
django52: Django>=5.2,<5.3
31-
-rtests-requirements.txt
29+
dependency_groups =
30+
test
3231
commands =
3332
python --version
3433
pip list
@@ -37,7 +36,8 @@ commands =
3736

3837
[testenv:py{39,310,311,312}-flake8]
3938
skip_install = True
40-
deps = flake8
39+
dependency_groups =
40+
lint
4141
commands =
4242
python --version
4343
pip list

0 commit comments

Comments
 (0)