Skip to content

Commit af74dcb

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

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
@@ -96,7 +96,7 @@ upgrade: .venv/upgraded-on
9696
.venv/upgraded-on: pyproject.toml
9797
python -m pip install --upgrade pip setuptools
9898
python -m pip install --upgrade wheel
99-
python -m pip install --upgrade --upgrade-strategy eager --editable .[actions,dev,docs,hooks,test]
99+
python -m pip install --upgrade --upgrade-strategy eager --group dev --editable .
100100
$(MAKE) upgrade-quiet
101101
force-upgrade:
102102
rm -f .venv/upgraded-on

pyproject.toml

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,27 +37,39 @@ something = "package.__main__:main"
3737
[project.entry-points]
3838

3939
[project.optional-dependencies]
40+
# Add optional package dependencies (extras) here.
41+
# https://packaging.python.org/en/latest/specifications/dependency-specifiers/#extras
42+
43+
[project.urls]
44+
Homepage = "https://github.com/jenstroeger/python-package-template"
45+
Changelog = "https://github.com/jenstroeger/python-package-template/blob/main/CHANGELOG.md"
46+
Documentation = "https://github.com/jenstroeger/python-package-template/wiki"
47+
Issues = "https://github.com/jenstroeger/python-package-template/issues"
48+
49+
50+
# https://packaging.python.org/en/latest/specifications/dependency-groups/
51+
# https://peps.python.org/pep-0735/
52+
[dependency-groups]
53+
dev = [
54+
{include-group = "actions"},
55+
{include-group = "check"},
56+
{include-group = "test"},
57+
{include-group = "docs"},
58+
{include-group = "dist"},
59+
{include-group = "hooks"},
60+
]
4061
# The 'actions' requirements match exactly the packages installed by the workflows.
4162
# We keep them listed here to ensure the infrastructure BOM is consistent with what's
4263
# installed. Make sure to keep the requirements in sync with the workflows!
4364
actions = [
4465
"commitizen ==4.13.9",
4566
"twine ==6.2.0",
4667
]
47-
dev = [
48-
"flit >=3.2.0,<4.0.0",
68+
check = [
4969
"mypy >=1.0.0,!=1.20.2,<1.21",
5070
"pip-audit >=2.4.4,<3.0.0",
5171
"pylint >=3.0.0,<4.1.0",
5272
"perflint >=0.8.0,<1.0.0",
53-
"cyclonedx-bom >=7.0.0,<8.0.0",
54-
]
55-
docs = [
56-
"sphinx >=5.1.1,<9.0.0",
57-
"sphinx-markdown-builder >=0.6.4,<1.0.0",
58-
]
59-
hooks = [
60-
"pre-commit >=3.0.0,<4.6.0",
6173
]
6274
# Note that the `custom_exit_code` and `env` plugins may currently be unmaintained.
6375
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 ==6.3.0", # Uses: coverage[toml] >=7.5
83+
"pytest-custom_exit_code ==0.3.0",
7284
"pytest-doctestplus ==1.7.1",
7385
"pytest-env ==1.2.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.6.0",
97+
]
8198

8299

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

0 commit comments

Comments
 (0)