Skip to content

Commit 67bee84

Browse files
committed
refactor: use Dependency Groups (PEP 735) instead of misusing package extras for dependencies that are not direct package dependencies
1 parent b3bbbd4 commit 67bee84

2 files changed

Lines changed: 35 additions & 18 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ upgrade: .venv/upgraded-on
107107
.venv/upgraded-on: pyproject.toml
108108
python -m pip install --upgrade pip setuptools
109109
python -m pip install --upgrade wheel
110-
python -m pip install --upgrade --upgrade-strategy eager --editable .[actions,dev,docs,hooks,test]
110+
python -m pip install --upgrade --upgrade-strategy eager --group dev --editable .
111111
$(MAKE) upgrade-quiet
112112
force-upgrade:
113113
rm -f .venv/upgraded-on

pyproject.toml

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,38 @@ something = "package.__main__:main"
3939
[project.entry-points]
4040

4141
[project.optional-dependencies]
42+
# Add optional package dependencies (extras) here.
43+
# https://packaging.python.org/en/latest/specifications/dependency-specifiers/#extras
44+
45+
[project.urls]
46+
Homepage = "https://github.com/jenstroeger/python-package-template"
47+
Changelog = "https://github.com/jenstroeger/python-package-template/blob/main/CHANGELOG.md"
48+
Documentation = "https://github.com/jenstroeger/python-package-template/wiki"
49+
Issues = "https://github.com/jenstroeger/python-package-template/issues"
50+
51+
52+
# https://packaging.python.org/en/latest/specifications/dependency-groups/
53+
# https://peps.python.org/pep-0735/
54+
[dependency-groups]
55+
dev = [
56+
{include-group = "actions"},
57+
{include-group = "check"},
58+
{include-group = "test"},
59+
{include-group = "docs"},
60+
{include-group = "dist"},
61+
{include-group = "hooks"},
62+
]
4263
# The 'actions' requirements match exactly the packages installed by the workflows.
4364
# We keep them listed here to ensure the infrastructure BOM is consistent with what's
4465
# installed. Make sure to keep the requirements in sync with the workflows!
4566
actions = [
4667
"commitizen ==4.16.2",
4768
"twine ==6.2.0",
4869
]
49-
dev = [
50-
"flit >=3.2.0,<4.0.0",
70+
check = [
5171
"mypy >=1.0.0,!=1.20.2,<1.21",
5272
"pip-audit >=2.4.4,<3.0.0",
5373
"pylint >=4.0.0,<4.1.0",
54-
"cyclonedx-bom >=7.0.0,<8.0.0",
55-
]
56-
docs = [
57-
"sphinx >=5.1.1,<9.0.0",
58-
"sphinx-markdown-builder >=0.6.4,<1.0.0",
59-
]
60-
hooks = [
61-
"pre-commit >=3.0.0,<4.7.0",
6274
]
6375
# Note that the `custom_exit_code` and `env` plugins may currently be unmaintained.
6476
test = [
@@ -67,17 +79,22 @@ test = [
6779
"pytest >=9.0.3,<10.0.0",
6880
"pytest-benchmark ==5.2.3",
6981
"pytest-cases ==3.10.1",
70-
"pytest-custom_exit_code ==0.3.0",
7182
"pytest-cov ==7.1.0",
83+
"pytest-custom_exit_code ==0.3.0",
7284
"pytest-doctestplus ==1.7.1",
7385
"pytest-env ==1.6.0",
7486
]
75-
76-
[project.urls]
77-
Homepage = "https://github.com/jenstroeger/python-package-template"
78-
Changelog = "https://github.com/jenstroeger/python-package-template/blob/main/CHANGELOG.md"
79-
Documentation = "https://github.com/jenstroeger/python-package-template/wiki"
80-
Issues = "https://github.com/jenstroeger/python-package-template/issues"
87+
docs = [
88+
"sphinx >=5.1.1,<9.0.0",
89+
"sphinx-markdown-builder >=0.6.4,<1.0.0",
90+
]
91+
dist = [
92+
"cyclonedx-bom >=7.0.0,<8.0.0",
93+
"flit >=3.2.0,<4.0.0",
94+
]
95+
hooks = [
96+
"pre-commit >=3.0.0,<4.7.0",
97+
]
8198

8299

83100
# https://bandit.readthedocs.io/en/latest/config.html

0 commit comments

Comments
 (0)