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 PEP 735 / dependency groups in tox #107

Draft
wants to merge 1 commit into
base: main
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
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
10 changes: 8 additions & 2 deletions 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 All @@ -60,7 +60,13 @@ docs = [
]
tests = ["pytest", "pytest-asyncio", "sybil>=6"]
typing = ["mypy>=1.4", "fastapi", "flask", "starlette", "aiohttp", "pyramid"]
dev = ["svcs[tests,typing]", "tox>4", "tox-uv", "httpx"]
dev = [
{ include-group = "tests" },
{ include-group = "typing" },
"tox>4",
"tox-uv",
"httpx",
]

[project.urls]
Changelog = "https://github.com/hynek/svcs/blob/main/CHANGELOG.md"
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
Loading