Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the PEP 735 [dependency-groups] table #13073

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/builddoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ jobs:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install .[docs]
run: |
uv pip install --group docs
uv pip install .
- name: Render the documentation
run: >
sphinx-build
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install ".[lint,test]"
run: uv pip install --group types
- name: Type check with mypy
run: mypy

Expand All @@ -81,7 +81,7 @@ jobs:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install ".[lint,test]"
run: uv pip install --group types
- name: Type check with pyright
run: pyright

Expand All @@ -102,7 +102,7 @@ jobs:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install --upgrade sphinx-lint
run: uv pip install --group lint
- name: Lint documentation with sphinx-lint
run: make doclinter

Expand Down
24 changes: 18 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ jobs:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install .[test]
run: |
uv pip install --group test
uv pip install .
- name: Install Docutils ${{ matrix.docutils }}
run: uv pip install --upgrade "docutils~=${{ matrix.docutils }}.0"
- name: Test with pytest
Expand Down Expand Up @@ -202,7 +204,9 @@ jobs:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install .[test]
run: |
uv pip install --group test
uv pip install .
- name: Test with pytest
run: python -m pytest -vv --durations 25
env:
Expand Down Expand Up @@ -237,7 +241,9 @@ jobs:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install .[test]
run: |
uv pip install --group test
uv pip install .
- name: Install Docutils' HEAD
run: uv pip install "docutils @ git+https://repo.or.cz/docutils.git#subdirectory=docutils"
- name: Test with pytest
Expand Down Expand Up @@ -271,7 +277,8 @@ jobs:
enable-cache: false
- name: Install dependencies
run: |
uv pip install .[test] --resolution lowest-direct
uv pip install --group test
uv pip install . --resolution lowest-direct
uv pip install alabaster==1.0.0
- name: Test with pytest
run: python -m pytest -vv --durations 25
Expand Down Expand Up @@ -301,7 +308,9 @@ jobs:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install .[test]
run: |
uv pip install --group test
uv pip install .
- name: Test with pytest
run: python -m pytest -vv --durations 25
env:
Expand Down Expand Up @@ -332,7 +341,10 @@ jobs:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install .[test] pytest-cov
run: |
uv pip install --group test
uv pip install pytest-cov
uv pip install .
- name: Test with pytest
run: python -m pytest -vv --cov . --cov-append --cov-config pyproject.toml
env:
Expand Down
56 changes: 36 additions & 20 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,41 +77,57 @@ dependencies = [
dynamic = ["version"]

[project.optional-dependencies]
docs = []
lint = []
test = []

[[project.authors]]
name = "Georg Brandl"
email = "[email protected]"

[project.scripts]
sphinx-build = "sphinx.cmd.build:main"
sphinx-quickstart = "sphinx.cmd.quickstart:main"
sphinx-apidoc = "sphinx.ext.apidoc:main"
sphinx-autogen = "sphinx.ext.autosummary.generate:main"

[dependency-groups]
all = [
{ include-group = "docs" },
{ include-group = "lint" },
{ include-group = "test" },
{ include-group = "types" },
]
Comment on lines +95 to +100
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open question: ought we use all, which seems more natural to me, or dev, which is special-cased by uv?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can change tool.uv.default-groups to ["all"] if you want

docs = [
"sphinxcontrib-websupport",
]
lint = [
"ruff==0.9.2",
"mypy==1.14.1",
"sphinx-lint>=0.9",
]
test = [
"pytest>=8.0",
"defusedxml>=0.7.1", # for secure XML/HTML parsing
"cython>=3.0",
"setuptools>=70.0", # for Cython compilation
"typing_extensions>=4.9", # for test_restify_Unpack
]
types = [
"mypy==1.14.1",
"pyright==1.1.392.post0",
"pytest>=8.0", # for mypy
{ include-group = "type-stubs" },
]
type-stubs = [
"types-colorama==0.4.15.20240311",
"types-defusedxml==0.7.0.20240218",
"types-docutils==0.21.0.20241128",
"types-Pillow==10.2.0.20240822",
"types-Pygments==2.19.0.20250107",
"types-requests==2.32.0.20241016", # align with requests
"types-urllib3==1.26.25.14",
"pyright==1.1.392.post0",
"pytest>=6.0",
]
test = [
"pytest>=8.0",
"defusedxml>=0.7.1", # for secure XML/HTML parsing
"cython>=3.0",
"setuptools>=70.0", # for Cython compilation
"typing_extensions>=4.9", # for typing_extensions.Unpack
]

[[project.authors]]
name = "Georg Brandl"
email = "[email protected]"

[project.scripts]
sphinx-build = "sphinx.cmd.build:main"
sphinx-quickstart = "sphinx.cmd.quickstart:main"
sphinx-apidoc = "sphinx.ext.apidoc:main"
sphinx-autogen = "sphinx.ext.autosummary.generate:main"

[tool.flit.module]
name = "sphinx"

Expand Down
16 changes: 8 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ passenv =
READTHEDOCS
description =
py{311,312,313,314}: Run unit tests against {envname}.
extras =
dependency_groups =
test
setenv =
PYTHONWARNINGS = error
Expand All @@ -31,8 +31,9 @@ commands=
[testenv:lint]
description =
Run linters.
extras =
dependency_groups =
lint
types
# If you update any of these commands, don't forget to update the equivalent
# GitHub Workflow step
commands =
Expand All @@ -43,7 +44,7 @@ commands =
[testenv:docs]
description =
Build documentation.
extras =
dependency_groups =
docs
commands =
python -c "import shutil; shutil.rmtree('./build/sphinx', ignore_errors=True) if '{env:CLEAN:}' else None"
Expand All @@ -52,7 +53,7 @@ commands =
[testenv:docs-live]
description =
Build documentation.
extras =
dependency_groups =
docs
deps =
sphinx-autobuild
Expand All @@ -70,7 +71,7 @@ commands =
[testenv:ruff]
description =
Run ruff formatting and linting.
extras =
dependency_groups =
lint
commands =
ruff format .
Expand All @@ -79,8 +80,7 @@ commands =
[testenv:mypy]
description =
Run mypy type checking.
extras =
lint
test
dependency_groups =
types
commands =
mypy {posargs}
Loading