Skip to content

Commit

Permalink
Use PEP 735 / dependency groups in tox
Browse files Browse the repository at this point in the history
  • Loading branch information
hynek committed Nov 2, 2024
1 parent b0ac3a9 commit 11e7ae0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ jobs:
name: Pyright Codebase
runs-on: ubuntu-latest
needs: build-package

steps:
- name: Download pre-built packages
uses: actions/download-artifact@v4
Expand All @@ -166,11 +165,10 @@ jobs:
python-version-file: .python-version-default
- uses: hynek/setup-cached-uv@v2

- run: |
uv venv
uv pip install .[typing]
echo "$PWD/.venv/bin" >> $GITHUB_PATH
- uses: jakebailey/pyright-action@v2
- run: >
uvx --with tox-uv
tox run -e pyright
docs:
Expand Down Expand Up @@ -210,7 +208,7 @@ jobs:

- run: |
uv venv
uv pip install -e .[dev]
uv pip install --group dev --editable .
source .venv/bin/activate
python -Ic 'import svcs'
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ dependencies = [
"attrs>=21.3.0", # attrs namespace
]

[project.optional-dependencies]
[dependency-groups]
docs = [
"sphinx>=7.2.2",
"sphinx-design",
Expand Down
15 changes: 7 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: MIT

[tox]
min_version = 4
min_version = 4.22
env_list =
pre-commit,
docs,
Expand All @@ -21,11 +21,10 @@ pass_env = SETUPTOOLS_SCM_PRETEND_VERSION
[testenv]
package = wheel
wheel_build_env = .pkg
extras =
dependency_groups =
tests: tests
mypy: typing
deps =
mypy: mypy
tests: coverage[toml]
optional: aiohttp
optional: fastapi
Expand Down Expand Up @@ -56,20 +55,20 @@ commands = pre-commit run --all-files

[testenv:mypy-pkg]
description = Type-check the package.
extras = typing
dependency_groups = typing
commands = mypy src


[testenv:pyright]
deps = pyright
extras = typing
dependency_groups = typing
commands = pyright tests/typing src


[testenv:docs]
# Keep base_python in sync with ci.yml/docs and .readthedocs.yaml.
base_python = py312
extras = docs
dependency_groups = docs
commands =
sphinx-build -n -T -W -b html -d {envtmpdir}/doctrees docs docs/_build/html
sphinx-build -n -T -W -b doctest -d {envtmpdir}/doctrees docs docs/_build/html
Expand All @@ -80,7 +79,7 @@ commands =
[testenv:docs-watch]
package = editable
base_python = {[testenv:docs]base_python}
extras = {[testenv:docs]extras}
dependency_groups = {[testenv:docs]extras}
deps = watchfiles
commands =
watchfiles \
Expand All @@ -94,5 +93,5 @@ commands =

[testenv:docs-linkcheck]
base_python = {[testenv:docs]base_python}
extras = {[testenv:docs]extras}
dependency_groups = {[testenv:docs]extras}
commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees docs docs/_build/html

0 comments on commit 11e7ae0

Please sign in to comment.