Skip to content

Commit 9c39db9

Browse files
committed
Use the PEP 735 [dependency-groups] table
1 parent 31de02c commit 9c39db9

File tree

5 files changed

+68
-38
lines changed

5 files changed

+68
-38
lines changed

.github/workflows/builddoc.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ jobs:
3636
version: latest
3737
enable-cache: false
3838
- name: Install dependencies
39-
run: uv pip install .[docs]
39+
run: |
40+
uv pip install --group docs
41+
uv pip install .
4042
- name: Render the documentation
4143
run: >
4244
sphinx-build

.github/workflows/lint.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
version: latest
6161
enable-cache: false
6262
- name: Install dependencies
63-
run: uv pip install ".[lint,test]"
63+
run: uv pip install --group types
6464
- name: Type check with mypy
6565
run: mypy
6666

@@ -81,7 +81,7 @@ jobs:
8181
version: latest
8282
enable-cache: false
8383
- name: Install dependencies
84-
run: uv pip install ".[lint,test]"
84+
run: uv pip install --group types
8585
- name: Type check with pyright
8686
run: pyright
8787

@@ -102,7 +102,7 @@ jobs:
102102
version: latest
103103
enable-cache: false
104104
- name: Install dependencies
105-
run: uv pip install --upgrade sphinx-lint
105+
run: uv pip install --group lint
106106
- name: Lint documentation with sphinx-lint
107107
run: make doclinter
108108

.github/workflows/main.yml

+18-6
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ jobs:
6363
version: latest
6464
enable-cache: false
6565
- name: Install dependencies
66-
run: uv pip install .[test]
66+
run: |
67+
uv pip install --group test
68+
uv pip install .
6769
- name: Install Docutils ${{ matrix.docutils }}
6870
run: uv pip install --upgrade "docutils~=${{ matrix.docutils }}.0"
6971
- name: Test with pytest
@@ -202,7 +204,9 @@ jobs:
202204
version: latest
203205
enable-cache: false
204206
- name: Install dependencies
205-
run: uv pip install .[test]
207+
run: |
208+
uv pip install --group test
209+
uv pip install .
206210
- name: Test with pytest
207211
run: python -m pytest -vv --durations 25
208212
env:
@@ -237,7 +241,9 @@ jobs:
237241
version: latest
238242
enable-cache: false
239243
- name: Install dependencies
240-
run: uv pip install .[test]
244+
run: |
245+
uv pip install --group test
246+
uv pip install .
241247
- name: Install Docutils' HEAD
242248
run: uv pip install "docutils @ git+https://repo.or.cz/docutils.git#subdirectory=docutils"
243249
- name: Test with pytest
@@ -271,7 +277,8 @@ jobs:
271277
enable-cache: false
272278
- name: Install dependencies
273279
run: |
274-
uv pip install .[test] --resolution lowest-direct
280+
uv pip install --group test
281+
uv pip install . --resolution lowest-direct
275282
uv pip install alabaster==1.0.0
276283
- name: Test with pytest
277284
run: python -m pytest -vv --durations 25
@@ -301,7 +308,9 @@ jobs:
301308
version: latest
302309
enable-cache: false
303310
- name: Install dependencies
304-
run: uv pip install .[test]
311+
run: |
312+
uv pip install --group test
313+
uv pip install .
305314
- name: Test with pytest
306315
run: python -m pytest -vv --durations 25
307316
env:
@@ -332,7 +341,10 @@ jobs:
332341
version: latest
333342
enable-cache: false
334343
- name: Install dependencies
335-
run: uv pip install .[test] pytest-cov
344+
run: |
345+
uv pip install --group test
346+
uv pip install pytest-cov
347+
uv pip install .
336348
- name: Test with pytest
337349
run: python -m pytest -vv --cov . --cov-append --cov-config pyproject.toml
338350
env:

pyproject.toml

+36-20
Original file line numberDiff line numberDiff line change
@@ -77,41 +77,57 @@ dependencies = [
7777
dynamic = ["version"]
7878

7979
[project.optional-dependencies]
80+
docs = []
81+
lint = []
82+
test = []
83+
84+
[[project.authors]]
85+
name = "Georg Brandl"
86+
87+
88+
[project.scripts]
89+
sphinx-build = "sphinx.cmd.build:main"
90+
sphinx-quickstart = "sphinx.cmd.quickstart:main"
91+
sphinx-apidoc = "sphinx.ext.apidoc:main"
92+
sphinx-autogen = "sphinx.ext.autosummary.generate:main"
93+
94+
[dependency-groups]
95+
all = [
96+
{ include-group = "docs" },
97+
{ include-group = "lint" },
98+
{ include-group = "test" },
99+
{ include-group = "types" },
100+
]
80101
docs = [
81102
"sphinxcontrib-websupport",
82103
]
83104
lint = [
84105
"ruff==0.9.2",
85-
"mypy==1.14.1",
86106
"sphinx-lint>=0.9",
107+
]
108+
test = [
109+
"pytest>=8.0",
110+
"defusedxml>=0.7.1", # for secure XML/HTML parsing
111+
"cython>=3.0",
112+
"setuptools>=70.0", # for Cython compilation
113+
"typing_extensions>=4.9", # for test_restify_Unpack
114+
]
115+
types = [
116+
"mypy==1.14.1",
117+
"pyright==1.1.392.post0",
118+
"pytest>=8.0", # for mypy
119+
{ include-group = "type-stubs" },
120+
]
121+
type-stubs = [
87122
"types-colorama==0.4.15.20240311",
88123
"types-defusedxml==0.7.0.20240218",
89124
"types-docutils==0.21.0.20241128",
90125
"types-Pillow==10.2.0.20240822",
91126
"types-Pygments==2.19.0.20250107",
92127
"types-requests==2.32.0.20241016", # align with requests
93128
"types-urllib3==1.26.25.14",
94-
"pyright==1.1.392.post0",
95-
"pytest>=6.0",
96-
]
97-
test = [
98-
"pytest>=8.0",
99-
"defusedxml>=0.7.1", # for secure XML/HTML parsing
100-
"cython>=3.0",
101-
"setuptools>=70.0", # for Cython compilation
102-
"typing_extensions>=4.9", # for typing_extensions.Unpack
103129
]
104130

105-
[[project.authors]]
106-
name = "Georg Brandl"
107-
108-
109-
[project.scripts]
110-
sphinx-build = "sphinx.cmd.build:main"
111-
sphinx-quickstart = "sphinx.cmd.quickstart:main"
112-
sphinx-apidoc = "sphinx.ext.apidoc:main"
113-
sphinx-autogen = "sphinx.ext.autosummary.generate:main"
114-
115131
[tool.flit.module]
116132
name = "sphinx"
117133

tox.ini

+8-8
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ passenv =
2020
READTHEDOCS
2121
description =
2222
py{311,312,313,314}: Run unit tests against {envname}.
23-
extras =
23+
dependency_groups =
2424
test
2525
setenv =
2626
PYTHONWARNINGS = error
@@ -31,8 +31,9 @@ commands=
3131
[testenv:lint]
3232
description =
3333
Run linters.
34-
extras =
34+
dependency_groups =
3535
lint
36+
types
3637
# If you update any of these commands, don't forget to update the equivalent
3738
# GitHub Workflow step
3839
commands =
@@ -43,7 +44,7 @@ commands =
4344
[testenv:docs]
4445
description =
4546
Build documentation.
46-
extras =
47+
dependency_groups =
4748
docs
4849
commands =
4950
python -c "import shutil; shutil.rmtree('./build/sphinx', ignore_errors=True) if '{env:CLEAN:}' else None"
@@ -52,7 +53,7 @@ commands =
5253
[testenv:docs-live]
5354
description =
5455
Build documentation.
55-
extras =
56+
dependency_groups =
5657
docs
5758
deps =
5859
sphinx-autobuild
@@ -70,7 +71,7 @@ commands =
7071
[testenv:ruff]
7172
description =
7273
Run ruff formatting and linting.
73-
extras =
74+
dependency_groups =
7475
lint
7576
commands =
7677
ruff format .
@@ -79,8 +80,7 @@ commands =
7980
[testenv:mypy]
8081
description =
8182
Run mypy type checking.
82-
extras =
83-
lint
84-
test
83+
dependency_groups =
84+
types
8585
commands =
8686
mypy {posargs}

0 commit comments

Comments
 (0)