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 Oct 26, 2024
1 parent ba77435 commit 062888c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,16 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
cache: pip
python-version-file: .python-version-default
- uses: hynek/setup-cached-uv@v2

- run: uv pip install --group dev --editable .
- run: |
source .venv/bin/activate
python -Ic 'import svcs'
python -Ic 'import svcs.flask'
- run: python -Im pip install -e .[dev]
- run: python -Ic 'import svcs'
- run: python -Ic 'import svcs.flask'
# XXX: Pyramid is currently broken on 3.13.
# - run: python -Ic 'import svcs.pyramid'

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 062888c

Please sign in to comment.