Streamline tox (#212)

This commit is contained in:
Hynek Schlawack 2025-10-08 08:34:22 +02:00 committed by GitHub
parent 96e4ac635e
commit cb38bdd94b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 48 additions and 55 deletions

View File

@ -189,9 +189,8 @@ jobs:
- run: python -Im tox run -e system-argon2
mypy-pkg:
name: Mypy Codebase
typing:
name: Check types using supported type checkers
runs-on: ubuntu-latest
needs: build-package
@ -207,33 +206,7 @@ jobs:
python-version-file: .python-version-default
- uses: hynek/setup-cached-uv@757bedc3f972eb7227a1aa657651f15a8527c817 # v2.3.0
- run: >
uvx --with tox-uv
tox run -e mypy-pkg
pyright:
name: Pyright Codebase
runs-on: ubuntu-latest
needs: build-package
steps:
- name: Download pre-built packages
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
name: Packages
path: dist
- run: tar xf dist/*.tar.gz --strip-components=1
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version-file: .python-version-default
- uses: hynek/setup-cached-uv@757bedc3f972eb7227a1aa657651f15a8527c817 # v2.3.0
- run: |
uv venv
uv pip install . --group typing
echo "$PWD/.venv/bin" >> $GITHUB_PATH
- uses: jakebailey/pyright-action@6cabc0f01c4994be48fd45cd9dbacdd6e1ee6e5e # v2.3.3
- run: uvx --with tox-uv tox run -f typing
docs:
name: Run doctests
@ -280,8 +253,7 @@ jobs:
runs-on: ubuntu-latest
needs:
- coverage
- mypy-pkg
- pyright
- typing
- docs
- install-dev
- system-package

67
tox.ini
View File

@ -2,14 +2,13 @@
min_version = 4
env_list =
pre-commit,
mypy-pkg,
py3{9,10,11,12,13,14}-{tests,mypy},
py314t-tests,
py312-bindings-main,
py314-tests-{bindings-main,system-argon2},
pypy3-tests,
system-argon2,
typing-{pyright,ty,pyrefly,mypy}
docs-doctests,
coverage-report
coverage-{combine,report}
[testenv]
@ -28,33 +27,41 @@ commands =
mypy: mypy tests/typing
[testenv:py3{9,13}-tests]
[testenv:py3{9,14}-tests]
# Keep coverage-combine's depends with the versions.
description = Run tests and measure coverage.
deps =
coverage[toml]
deps = coverage[toml]
commands =
coverage run -m pytest {posargs}
coverage run -m argon2 -n 1 -t 1 -m 8 -p 1
coverage run -m argon2 --profile CHEAPEST
[testenv:coverage-report]
description = Report coverage over all test runs.
# Split combine/report in 2 to avoid excessive "Combined data file ..." output.
[testenv:coverage-combine]
# Keep base_python in-sync with .python-version-default
base_python = py313
# Keep in-sync with test env definition above.
depends = py3{9,14}-tests
skip_install = true
depends = py3{9,13}-tests
deps = coverage[toml]
parallel_show_output = true
commands =
coverage combine
coverage report
deps = coverage
commands = coverage combine
[testenv:coverage-report]
description = Report coverage over oldest and latest supported Python
# Keep base_python in-sync with .python-version-default
base_python = py313
skip_install = true
depends = coverage-combine
deps = coverage
parallel_show_output = true
commands = coverage report
[testenv:system-argon2]
description = Run tests against bindings that use a system installation of Argon2.
set_env = ARGON2_CFFI_USE_SYSTEM=1
install_command = pip install {opts} --no-binary=argon2-cffi-bindings {packages}
[testenv:py312-bindings-main]
description = Run tests against the current main branch of argon2-cffi-bindings
dependency_groups =
@ -70,16 +77,31 @@ deps = pre-commit-uv
commands = pre-commit run --all-files
[testenv:pyright]
[testenv:typing-mypy]
description = Check own code with Mypyy.
# Keep base_python in-sync with .python-version-default
base_python = py313
deps = mypy
dependency_groups = typing
commands = mypy src
[testenv:typing-pyright]
description = Check API and own code with Pyright
deps = pyright
dependency_groups = typing
commands = pyright tests/typing src
commands = pyright src tests/typing
[testenv:typing-ty]
description = Check API with ty
deps = ty
dependency_groups = typing
commands = ty check tests/typing
[testenv:mypy-pkg]
description = Check own code.
deps = mypy
commands = mypy src
[testenv:typing-pyrefly]
description = Check API with pyrefly
deps = pyrefly
dependency_groups = typing
commands = pyrefly check tests/typing
[testenv:docs-{build,doctests,linkcheck}]
@ -92,7 +114,6 @@ commands =
doctests: sphinx-build -n -T -W -b doctest -d {envtmpdir}/doctrees docs {posargs:docs/_build/}html
linkcheck: sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees docs docs/_build/html
[testenv:docs-watch]
package = editable
base_python = {[testenv:docs-build]base_python}