Files
ahriman/tox.toml
T
2026-07-15 15:55:58 +03:00

388 lines
8.1 KiB
TOML

env_list = [
"check",
"tests",
]
isolated_build = true
labels.release = [
"version",
"docs",
"publish",
]
[commands]
npm_install = [
[
"npm",
{ replace = "ref", of = ["flags", "npm"], extend = true },
"install",
"--cache",
"{envtmpdir}/npm-cache",
],
]
[flags]
autopep8 = [
"--max-line-length",
"120",
"-aa",
]
bandit = [
"--configfile",
".bandit.yml",
]
manpage = [
"--author",
"{[project]name} team",
"--author-email",
"",
"--description",
"ArcH linux ReposItory MANager",
"--manual-title",
"ArcH linux ReposItory MANager",
"--project-name",
"{[project]name}",
"--version",
"{env:VERSION}",
"--url",
"https://github.com/arcan1s/ahriman",
]
mypy = [
"--implicit-reexport",
"--strict",
"--allow-untyped-decorators",
"--allow-subclassing-any",
]
npm = [
"--prefix",
"frontend",
]
pydeps = [
"--no-config",
"--cluster",
]
pylint = [
"--rcfile",
".pylint.toml",
]
shtab = [
"--prefix",
"{[project]name}",
"--prog",
"{[project]name}",
"ahriman.application.ahriman._parser",
]
[project]
extras = [
"./ahriman-core[journald,pacman,reports,s3,shell,stats,unixsocket,validator]",
"./ahriman-triggers",
"./ahriman-web[auth,docs,metrics,oauth2]",
]
name = "ahriman"
[env.archive]
description = "Create source files tarball"
skip_install = true
system_site_packages = true
commands = [
[
"{envpython}",
"-m",
"build",
"--sdist",
"--no-isolation",
],
]
[env.check]
description = "Run common checks like linter, mypy, etc"
allowlist_externals = [
"npm",
]
dependency_groups = [
"check",
]
deps = [
{ replace = "ref", of = ["project", "extras"], extend = true },
]
pip_pre = true
set_env.CFLAGS = "-Wno-unterminated-string-initialization"
set_env.MYPYPATH = "ahriman-core/src:ahriman-triggers/src:ahriman-web/src"
commands = [
[
"autopep8",
{ replace = "ref", of = ["flags", "autopep8"], extend = true },
"--exit-code",
"--in-place",
"--jobs",
"0",
"--recursive",
"ahriman-core/src/{[project]name}",
"ahriman-triggers/src/{[project]name}",
"ahriman-web/src/{[project]name}",
"tests",
"ahriman-core/tests",
"ahriman-triggers/tests",
"ahriman-web/tests",
],
[
"pylint",
{ replace = "ref", of = ["flags", "pylint"], extend = true },
"{[project]name}",
],
[
"bandit",
{ replace = "ref", of = ["flags", "bandit"], extend = true },
"--recursive",
"ahriman-core/src/{[project]name}",
"ahriman-triggers/src/{[project]name}",
"ahriman-web/src/{[project]name}",
],
[
"bandit",
{ replace = "ref", of = ["flags", "bandit"], extend = true },
"--skip",
"B101,B105,B106",
"--recursive",
"ahriman-core/tests/{[project]name}",
"ahriman-triggers/tests/{[project]name}",
"ahriman-web/tests/{[project]name}",
],
[
"mypy",
{ replace = "ref", of = ["flags", "mypy"], extend = true },
"--install-types",
"--non-interactive",
"--package",
"{[project]name}",
],
{ replace = "ref", of = ["commands", "npm_install"], extend = true },
[
"npm",
{ replace = "ref", of = ["flags", "npm"], extend = true },
"run",
"lint",
],
]
[env.docs]
description = "Generate source files for documentation"
dependency_groups = [
"docs",
]
depends = [
"version",
]
deps = [
{ replace = "ref", of = ["project", "extras"], extend = true },
"uv",
]
dynamic_version = "{[project]name}"
pip_pre = true
set_env.SPHINX_APIDOC_OPTIONS = "members,no-undoc-members,show-inheritance"
commands = [
[
"shtab",
{ replace = "ref", of = ["flags", "shtab"], extend = true },
"--shell",
"bash",
"--output",
"ahriman-core/package/share/bash-completion/completions/_ahriman",
],
[
"shtab",
{ replace = "ref", of = ["flags", "shtab"], extend = true },
"--shell",
"zsh",
"--output",
"ahriman-core/package/share/zsh/site-functions/_ahriman",
],
[
"argparse-manpage",
{ replace = "ref", of = ["flags", "manpage"], extend = true },
"--module",
"ahriman.application.ahriman",
"--function",
"_parser",
"--output",
"ahriman-core/package/share/man/man1/ahriman.1",
],
[
"pydeps",
{ replace = "ref", of = ["flags", "pydeps"], extend = true },
"--dot-output",
"{tox_root}/docs/_static/architecture.dot",
"--no-output",
"--show-dot",
"{envsitepackagesdir}/{[project]name}",
],
[
"sphinx-apidoc",
"--force",
"--no-toc",
"--output-dir",
"docs",
"{envsitepackagesdir}/{[project]name}",
],
# compile list of dependencies for rtd.io
[
"uv",
"pip",
"compile",
"--group",
"pyproject.toml:docs",
"--no-emit-package",
"ahriman-core",
"--no-emit-package",
"ahriman-triggers",
"--no-emit-package",
"ahriman-web",
"--output-file",
"docs/requirements.txt",
"--quiet",
"pyproject.toml",
],
]
[env.frontend]
description = "Build frontend HTML and JS"
allowlist_externals = [
"npm",
]
commands = [
{ replace = "ref", of = ["commands", "npm_install"], extend = true },
[
"npm",
{ replace = "ref", of = ["flags", "npm"], extend = true },
"run",
"build",
],
]
[env.html]
description = "Generate html documentation"
dependency_groups = [
"docs",
]
deps = [
{ replace = "ref", of = ["project", "extras"], extend = true },
]
pip_pre = true
recreate = true
commands = [
[
"sphinx-build",
"--builder",
"html",
"--fail-on-warning",
"--jobs",
"1",
"--write-all",
"docs",
"{envtmpdir}/html",
],
]
[env.publish]
description = "Create and publish release to GitHub"
allowlist_externals = [
"git",
]
depends = [
"docs",
]
pass_env = [
"SSH_AUTH_SOCK",
]
commands = [
[
"git",
"add",
"archlinux/PKGBUILD",
"docs/_static/architecture.dot",
"frontend/package.json",
"ahriman-core/package/share/man/man1/ahriman.1",
"ahriman-core/package/share/bash-completion/completions/_ahriman",
"ahriman-core/package/share/zsh/site-functions/_ahriman",
"ahriman-core/src/ahriman/__init__.py",
],
[
"git",
"commit",
"--message",
"Release {posargs}",
],
[
"git",
"tag",
"{posargs}",
],
[
"git",
"push",
],
[
"git",
"push",
"--tags",
],
]
[env.tests]
description = "Run tests"
dependency_groups = [
"tests",
]
deps = [
{ replace = "ref", of = ["project", "extras"], extend = true },
]
pip_pre = true
set_env.CFLAGS = "-Wno-unterminated-string-initialization"
commands = [
[
"pytest",
"tests/test_tests.py",
"ahriman-core/tests",
"ahriman-triggers/tests",
"ahriman-web/tests",
{ replace = "posargs", extend = true },
],
]
[env.version]
description = "Bump package version"
allowlist_externals = [
"npm",
"sed",
]
deps = [
"packaging",
]
skip_install = true
commands = [
# check if version is set and validate it
[
"{envpython}",
"-c",
"from packaging.version import Version; Version('{posargs}')",
],
[
"sed",
"--in-place",
"s/^__version__ = .*/__version__ = \"{posargs}\"/",
"ahriman-core/src/ahriman/__init__.py",
],
[
"npm",
{ replace = "ref", of = ["flags", "npm"], extend = true },
"version",
"{posargs}",
],
[
"sed",
"--in-place",
"s/pkgver=.*/pkgver={posargs}/",
"archlinux/PKGBUILD",
],
]