build: fix tox environment creation with the latest updates

This commit is contained in:
2025-05-08 14:04:25 +03:00
parent 9e346530f2
commit 6ea56faede
10 changed files with 237 additions and 64 deletions

46
tox.ini
View File

@ -1,9 +1,9 @@
[tox]
envlist = check, tests
isolated_build = True
isolated_build = true
labels =
release = version, docs, publish
dependencies = -e .[journald,pacman,s3,shell,stats,validator,web]
dependencies = -e .[journald,pacman,reports,s3,shell,stats,unixsocket,validator,web,web_api-docs,web_auth,web_oauth2]
project_name = ahriman
[mypy]
@ -24,10 +24,13 @@ commands =
[testenv:check]
description = Run common checks like linter, mypy, etc
dependency_groups =
check
deps =
{[tox]dependencies}
-e .[check]
pip_pre = true
setenv =
CFLAGS="-Wno-unterminated-string-initialization"
MYPYPATH=src
commands =
autopep8 --exit-code --max-line-length 120 -aa -i -j 0 -r "src/{[tox]project_name}" "tests/{[tox]project_name}"
@ -38,16 +41,19 @@ commands =
[testenv:docs]
description = Generate source files for documentation
depends =
version
deps =
{[tox]dependencies}
-e .[docs]
changedir = src
allowlist_externals =
bash
find
mv
changedir = src
dependency_groups =
docs
depends =
version
deps =
{[tox]dependencies}
uv
pip_pre = true
setenv =
SPHINX_APIDOC_OPTIONS=members,no-undoc-members,show-inheritance
commands =
@ -59,22 +65,26 @@ commands =
# remove autogenerated modules rst files
find ../docs -type f -name "{[tox]project_name}*.rst" -delete
sphinx-apidoc -o ../docs .
# compile list of dependencies for rtd.io
uv pip compile --group ../pyproject.toml:docs --extra s3 --extra validator --extra web --output-file ../docs/requirements.txt --quiet ../pyproject.toml
[testenv:html]
description = Generate html documentation
dependency_groups =
docs
deps =
{[tox]dependencies}
-e .[docs]
recreate = True
pip_pre = true
recreate = true
commands =
sphinx-build -b html -a -j auto -W docs {envtmpdir}{/}html
[testenv:publish]
description = Create and publish release to GitHub
depends =
docs
allowlist_externals =
git
depends =
docs
passenv =
SSH_AUTH_SOCK
commands =
@ -86,18 +96,22 @@ commands =
[testenv:tests]
description = Run tests
dependency_groups =
tests
deps =
{[tox]dependencies}
-e .[tests]
pip_pre = true
setenv =
CFLAGS="-Wno-unterminated-string-initialization"
commands =
pytest {posargs}
[testenv:version]
description = Bump package version
deps =
packaging
allowlist_externals =
sed
deps =
packaging
commands =
# check if version is set and validate it
{envpython} -c 'from packaging.version import Version; Version("{posargs}")'