From 11e7ae00ca3ac01766e8d28853591cb2514271be Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Wed, 16 Oct 2024 09:14:14 +0200 Subject: [PATCH] Use PEP 735 / dependency groups in tox --- .github/workflows/ci.yml | 12 +++++------- pyproject.toml | 2 +- tox.ini | 15 +++++++-------- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 999a86e..b09ae41 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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: @@ -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' diff --git a/pyproject.toml b/pyproject.toml index b75d905..4205114 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,7 @@ dependencies = [ "attrs>=21.3.0", # attrs namespace ] -[project.optional-dependencies] +[dependency-groups] docs = [ "sphinx>=7.2.2", "sphinx-design", diff --git a/tox.ini b/tox.ini index 65a89b7..717a049 100644 --- a/tox.ini +++ b/tox.ini @@ -3,7 +3,7 @@ # SPDX-License-Identifier: MIT [tox] -min_version = 4 +min_version = 4.22 env_list = pre-commit, docs, @@ -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 @@ -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 @@ -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 \ @@ -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