Skip to content

Commit c4a6408

Browse files
committed
Replace optional dependencies with dependency groups in template
Kept extra in setup.cfg
1 parent d668871 commit c4a6408

File tree

6 files changed

+13
-10
lines changed

6 files changed

+13
-10
lines changed

template/pyproject.toml.jinja

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ readme = {file = "README.md", content-type = "text/markdown"}
4141
requires-python = ">=3.10"
4242
version = "{{ version }}"
4343

44-
[project.optional-dependencies]
44+
[dependency-groups]
4545
dev = [
4646
"build", # build is not only used in publishing (below), but also in the template's test suite
4747
"bump-my-version",
@@ -111,7 +111,10 @@ skip_missing_interpreters = true
111111
{% if AddLocalTests -%}
112112
[testenv]
113113
commands = pytest
114-
extras = dev
114+
[tool.tox.env_run_base]
115+
dependency_groups = [
116+
"dev",
117+
]
115118
{%- endif %}
116119
"""
117120

template/{% if AddDevDoc %}README.dev.md{% endif %}.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ python -m pip install --upgrade pip setuptools
1818
# install {{ package_name }} as an editable package
1919
python -m pip install --no-cache-dir --editable .
2020
# install development dependencies
21-
python -m pip install --no-cache-dir --editable .[dev]
21+
python -m pip install --no-cache-dir --editable . --group dev
2222
# install documentation dependencies only
23-
python -m pip install --no-cache-dir --editable .[docs]
23+
python -m pip install --no-cache-dir --editable . --group docs
2424
```
2525

2626
Afterwards check that the install directory is present in the `PATH` environment variable.

template/{% if HasWorkflows %}.github{% endif %}/workflows/{% if AddGitHubActionBuild %}build.yml{% endif %}.jinja

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Upgrade pip and install dependencies
3333
run: |
3434
python -m pip install --upgrade pip setuptools
35-
python -m pip install .[dev,publishing]
35+
python -m pip install . --group dev --group publishing
3636
- name: Run unit tests
3737
run: python -m pytest -v
3838
- name: Verify that we can build the package
@@ -58,7 +58,7 @@ jobs:
5858
- name: Upgrade pip and install dependencies
5959
run: |
6060
python -m pip install --upgrade pip setuptools
61-
python -m pip install .[dev,publishing]
61+
python -m pip install . --group dev
6262
- name: Check style against standards using ruff
6363
run: |
6464
ruff check .
@@ -78,7 +78,7 @@ jobs:
7878
- name: Upgrade pip and install dependencies
7979
run: |
8080
python -m pip install --upgrade pip setuptools
81-
python -m pip install .[dev]
81+
python -m pip install . --group dev
8282
- name: Run {{ SelectTypeChecker }}
8383
run: |
8484
{{ SelectTypeChecker }}

template/{% if HasWorkflows %}.github{% endif %}/workflows/{% if AddGitHubActionDocumentation %}documentation.yml{% endif %}

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Upgrade pip and install dependencies
2929
run: |
3030
python -m pip install --upgrade pip setuptools
31-
python -m pip install .[dev,publishing]
31+
python -m pip install . --group dev --group docs
3232
- name: Install pandoc using apt
3333
run: sudo apt install pandoc
3434
- name: Build documentation

template/{% if HasWorkflows %}.github{% endif %}/workflows/{% if AddSonarCloud %}sonarcloud.yml{% endif %}

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
which python
2929
python --version
3030
- name: Install dependencies
31-
run: python -m pip install .[dev]
31+
run: python -m pip install . --group dev
3232
- name: Run unit tests with coverage
3333
run: python -m pytest --cov --cov-report term --cov-report xml --junitxml=xunit-result.xml tests/
3434
- name: Correct coverage paths

tests/test_project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def baked_with_development_dependencies(copie_session, project_env_bin_dir, copi
6464
bin_dir = project_env_bin_dir
6565
latest_pip_output = run([f'{bin_dir}python', '-m', 'pip', 'install', '--upgrade', 'pip', 'setuptools'], project_dir)
6666
assert latest_pip_output.returncode == 0
67-
pip_output = run([f'{bin_dir}python', '-m', 'pip', 'install', '--editable', '.[dev]'], project_dir)
67+
pip_output = run([f'{bin_dir}python', '-m', 'pip', 'install', '--editable', '.', '--group', 'dev'], project_dir)
6868
assert pip_output.returncode == 0
6969
return project_dir
7070

0 commit comments

Comments
 (0)