Skip to content

Commit b7837af

Browse files
committed
Switch to dependency-groups
1 parent 5e727bb commit b7837af

File tree

4 files changed

+49
-41
lines changed

4 files changed

+49
-41
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ cd example-research-software-project
5555
git init
5656
# uv venv
5757
# source .venv/bin/activate
58-
uv pip install -e ".[dev]"
58+
uv pip install -e . --group dev
5959
```
6060

6161
<!-- links here -->

tests/data/test_package_generation/pyproject.toml

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,27 @@ requires = [
55
"setuptools-scm",
66
]
77

8+
[dependency-groups]
9+
dev = [
10+
"build",
11+
"mypy",
12+
"pre-commit",
13+
"ruff",
14+
"tox",
15+
"twine",
16+
]
17+
docs = [
18+
"mkdocs",
19+
"mkdocs-include-markdown-plugin",
20+
"mkdocs-material",
21+
"mkdocstrings",
22+
"mkdocstrings-python",
23+
]
24+
test = [
25+
"pytest",
26+
"pytest-cov",
27+
]
28+
829
[project]
930
authors = [
1031
{email = "eva.lu.ator@ucl.ac.uk", name = "Eva Lu Ator"},
@@ -31,23 +52,6 @@ license-files = [
3152
"LICENSE.md",
3253
]
3354
name = "cookiecutter-test"
34-
optional-dependencies = {dev = [
35-
"build",
36-
"mypy",
37-
"pre-commit",
38-
"ruff",
39-
"tox",
40-
"twine",
41-
], docs = [
42-
"mkdocs",
43-
"mkdocs-include-markdown-plugin",
44-
"mkdocs-material",
45-
"mkdocstrings",
46-
"mkdocstrings-python",
47-
], test = [
48-
"pytest",
49-
"pytest-cov",
50-
]}
5155
readme = "README.md"
5256
requires-python = ">=3.11"
5357
urls.homepage = "https://github.com/test-user/cookiecutter-test"
@@ -126,7 +130,7 @@ env_run_base = {commands = [
126130
"--cov",
127131
"--cov-report=xml",
128132
],
129-
], extras = [
133+
], dependency_groups = [
130134
"test",
131135
]}
132136
env.docs = {commands = [
@@ -135,7 +139,7 @@ env.docs = {commands = [
135139
"build",
136140
"--strict",
137141
],
138-
], extras = [
142+
], dependency_groups = [
139143
"docs",
140144
]}
141145
gh.python."3.11" = ["py311"]

tutorial.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ uv venv --python 3.11.6
309309
Once you have created and activated a virtual environment for the project, you can install the package in [editable mode](https://setuptools.pypa.io/en/latest/userguide/development_mode.html), along with both its required dependencies and optional sets of dependencies for development (`dev`), documentation (`docs`) and testing (`test`) by running
310310

311311
```sh
312-
uv pip install --editable ".[dev,docs,test]"
312+
uv pip install --editable . --group dev --group docs --group test
313313
```
314314

315315
from the root of the project repository.
@@ -343,7 +343,7 @@ python -m pip install --upgrade pip
343343
Similar to `uv`, once the environment is active, you can install the package in editable mode as well as all dependencies:
344344

345345
```sh
346-
python -m pip install --editable ".[dev,docs,test]"
346+
python -m pip install --editable . --group dev --group docs --group test
347347
```
348348

349349
</details>

{{cookiecutter.project_slug}}/pyproject.toml

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,27 @@ requires = [
55
"setuptools-scm",
66
]
77

8+
[dependency-groups]
9+
dev = [
10+
"build",
11+
"mypy",
12+
"pre-commit",
13+
"ruff",
14+
"tox",
15+
"twine",
16+
]
17+
docs = [
18+
"mkdocs",
19+
"mkdocs-include-markdown-plugin",
20+
"mkdocs-material",
21+
"mkdocstrings",
22+
"mkdocstrings-python",
23+
]
24+
test = [
25+
"pytest",
26+
"pytest-cov",
27+
]
28+
829
[project]
930
authors = [
1031
{email = "{{cookiecutter.author_email}}", name = "{{cookiecutter.author_given_names}} {{cookiecutter.author_family_names}}"},
@@ -34,23 +55,6 @@ license-files = [
3455
"LICENSE.md",
3556
]
3657
name = "{{cookiecutter.project_slug}}"
37-
optional-dependencies = {dev = [
38-
"build",
39-
"mypy",
40-
"pre-commit",
41-
"ruff",
42-
"tox",
43-
"twine",
44-
], docs = [
45-
"mkdocs",
46-
"mkdocs-include-markdown-plugin",
47-
"mkdocs-material",
48-
"mkdocstrings",
49-
"mkdocstrings-python",
50-
], test = [
51-
"pytest",
52-
"pytest-cov",
53-
]}
5458
readme = "README.md"
5559
requires-python = ">={{cookiecutter.min_python_version}}"
5660
urls.homepage = "{{cookiecutter.__repo_url}}"
@@ -132,7 +136,7 @@ env_run_base = {commands = [
132136
"--cov",
133137
"--cov-report=xml",
134138
],
135-
], extras = [
139+
], dependency_groups = [
136140
"test",
137141
]}
138142
env.docs = {commands = [
@@ -141,7 +145,7 @@ env.docs = {commands = [
141145
"build",
142146
"--strict",
143147
],
144-
], extras = [
148+
], dependency_groups = [
145149
"docs",
146150
]}
147151
{%- for python_version in range(

0 commit comments

Comments
 (0)