reformat tomls

This commit is contained in:
2026-07-15 15:55:58 +03:00
parent 6e1567e6db
commit 60850bfc10
8 changed files with 170 additions and 117 deletions
+11 -5
View File
@@ -1,5 +1,7 @@
[build-system]
requires = ["hatchling"]
requires = [
"hatchling",
]
build-backend = "hatchling.build"
[project]
@@ -7,9 +9,9 @@ name = "ahriman-core"
description = "ArcH linux ReposItory MANager, core package"
readme = "../README.md"
requires-python = ">=3.13"
license = {file = "../COPYING"}
license = { file = "../COPYING" }
authors = [
{name = "ahriman team"},
{ name = "ahriman team" },
]
dependencies = [
"bcrypt",
@@ -18,7 +20,9 @@ dependencies = [
"pyelftools",
"requests",
]
dynamic = ["version"]
dynamic = [
"version",
]
[project.optional-dependencies]
journald = [
@@ -61,7 +65,9 @@ Changelog = "https://github.com/arcan1s/ahriman/releases"
path = "src/ahriman/__init__.py"
[tool.hatch.build.targets.wheel]
packages = ["src/ahriman"]
packages = [
"src/ahriman",
]
[tool.hatch.build.targets.wheel.shared-data]
"package/lib" = "lib"
+14 -6
View File
@@ -1,5 +1,7 @@
[build-system]
requires = ["hatchling"]
requires = [
"hatchling",
]
build-backend = "hatchling.build"
[project]
@@ -7,14 +9,16 @@ name = "ahriman-triggers"
description = "ArcH linux ReposItory MANager, additional extensions"
readme = "../README.md"
requires-python = ">=3.13"
license = {file = "../COPYING"}
license = { file = "../COPYING" }
authors = [
{name = "ahriman team"},
{ name = "ahriman team" },
]
dependencies = [
"ahriman-core",
]
dynamic = ["version"]
dynamic = [
"version",
]
[project.urls]
Documentation = "https://ahriman.readthedocs.io/"
@@ -25,8 +29,12 @@ Changelog = "https://github.com/arcan1s/ahriman/releases"
path = "../ahriman-core/src/ahriman/__init__.py"
[tool.hatch.build.targets.wheel]
only-include = ["src/ahriman"]
sources = ["src"]
only-include = [
"src/ahriman",
]
sources = [
"src",
]
[tool.hatch.build.targets.wheel.shared-data]
"package/share" = "share"
+14 -6
View File
@@ -1,5 +1,7 @@
[build-system]
requires = ["hatchling"]
requires = [
"hatchling",
]
build-backend = "hatchling.build"
[project]
@@ -7,9 +9,9 @@ name = "ahriman-web"
description = "ArcH linux ReposItory MANager, web server"
readme = "../README.md"
requires-python = ">=3.13"
license = {file = "../COPYING"}
license = { file = "../COPYING" }
authors = [
{name = "ahriman team"},
{ name = "ahriman team" },
]
dependencies = [
"ahriman-core",
@@ -18,7 +20,9 @@ dependencies = [
"aiohttp_jinja2",
"aiohttp_sse",
]
dynamic = ["version"]
dynamic = [
"version",
]
[project.optional-dependencies]
auth = [
@@ -47,8 +51,12 @@ Changelog = "https://github.com/arcan1s/ahriman/releases"
path = "../ahriman-core/src/ahriman/__init__.py"
[tool.hatch.build.targets.wheel]
only-include = ["src/ahriman"]
sources = ["src"]
only-include = [
"src/ahriman",
]
sources = [
"src",
]
[tool.hatch.build.targets.wheel.shared-data]
"package/lib" = "lib"
+19 -16
View File
@@ -1,27 +1,26 @@
[build-system]
requires = ["hatchling"]
requires = [
"hatchling",
]
build-backend = "hatchling.build"
[project]
name = "ahriman"
description = "ArcH linux ReposItory MANager"
readme = "README.md"
requires-python = ">=3.13"
license = {file = "COPYING"}
license = { file = "COPYING" }
authors = [
{name = "ahriman team"},
{ name = "ahriman team" },
]
dependencies = [
"ahriman-core",
"ahriman-triggers",
"ahriman-web",
]
dynamic = ["version"]
dynamic = [
"version",
]
[project.urls]
Documentation = "https://ahriman.readthedocs.io/"
@@ -57,17 +56,21 @@ tests = [
[tool.hatch.build.targets.sdist]
exclude = [
"/.github",
"/archlinux",
"/docker",
"/package/archlinux",
"/docs",
"/recipes",
"/tools",
"tests",
"/.bandit.yml",
"/.dockerignore",
"/.pylint.toml",
"/.readthedocs.yml",
"/conftest.py",
"/github-logo.png",
"/tox.toml",
"/toxfile.py",
"/web.png",
]
[tool.hatch.build.targets.wheel]
@@ -75,18 +78,18 @@ bypass-selection = true
[tool.hatch.envs.default]
workspace.members = [
{path = "ahriman-core"},
{path = "ahriman-triggers"},
{path = "ahriman-web"},
{ path = "ahriman-core" },
{ path = "ahriman-triggers" },
{ path = "ahriman-web" },
]
[tool.hatch.version]
path = "ahriman-core/src/ahriman/__init__.py"
[tool.uv.sources]
ahriman-core = {workspace = true}
ahriman-triggers = {workspace = true}
ahriman-web = {workspace = true}
ahriman-core = { workspace = true }
ahriman-triggers = { workspace = true }
ahriman-web = { workspace = true }
[tool.uv.workspace]
members = [
+30 -38
View File
@@ -3,6 +3,36 @@ from pathlib import Path
from ahriman.core.utils import walk
def _test_path(source_root: Path, source_file: Path) -> Path:
"""
generate expected test path for source file
Args:
source_root(Path): package source root
source_file(Path): source file
Returns:
Path: expected test file path
"""
relative_path = source_file.relative_to(source_root)
match relative_path.parts:
# some workaround for well known files
case ("ahriman", "application", "handlers", *_, source_name) if source_name != "handler.py":
return relative_path.parent / f"test_handler_{source_name}"
case ("ahriman", "web", "views", "api", source_name):
return relative_path.parent / f"test_view_api_{source_name}"
case ("ahriman", "web", "views", version, api, source_name) if version in ("v1", "v2"):
return relative_path.parent / f"test_view_{version}_{api}_{source_name}"
case ("ahriman", "web", "views", *_, source_name):
if source_name.endswith("_guard.py"):
return relative_path.parent / f"test_{source_name}"
else:
return relative_path.parent / f"test_view_{source_name}"
case _:
return relative_path.parent / f"test_{source_file.name}"
def test_test_coverage() -> None:
"""
must have test files for each source file
@@ -19,41 +49,3 @@ def test_test_coverage() -> None:
for source_file in filter(lambda fn: fn.suffix == ".py" and fn.name != "__init__.py", walk(source_root)):
test_file = package_root / "tests" / _test_path(source_root, source_file)
assert test_file.is_file(), test_file
def _test_path(source_root: Path, source_file: Path) -> Path:
"""
generate expected test path for source file
Args:
source_root(Path): package source root
source_file(Path): source file
Returns:
Path: expected test file path
"""
relative_path = source_file.relative_to(source_root)
match relative_path.parts:
# some workaround for well known files
case ("ahriman", "application", "handlers", *_, filename) if filename != "handler.py":
filename = f"test_handler_{source_file.name}"
test_parent = Path("ahriman", "application", "handlers")
case ("ahriman", "web", "views", _, filename) if (api := relative_path.parts[3]) == "api":
filename = f"test_view_{api}_{source_file.name}"
test_parent = relative_path.parent
case ("ahriman", "web", "views", _, _, filename) if (version := relative_path.parts[3]) in ("v1", "v2"):
api = relative_path.parts[4]
filename = f"test_view_{version}_{api}_{source_file.name}"
test_parent = relative_path.parent
case ("ahriman", "web", "views", *_, filename):
if source_file.name.endswith("_guard.py"):
filename = f"test_{source_file.name}"
else:
filename = f"test_view_{source_file.name}"
test_parent = relative_path.parent
case _:
filename = f"test_{source_file.name}"
test_parent = relative_path.parent
return test_parent / filename
+75 -39
View File
@@ -15,26 +15,36 @@ npm_install = [
"npm",
{ replace = "ref", of = ["flags", "npm"], extend = true },
"install",
"--cache", "{envtmpdir}/npm-cache",
"--cache",
"{envtmpdir}/npm-cache",
],
]
[flags]
autopep8 = [
"--max-line-length", "120",
"--max-line-length",
"120",
"-aa",
]
bandit = [
"--configfile", ".bandit.yml",
"--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",
"--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",
@@ -43,18 +53,22 @@ mypy = [
"--allow-subclassing-any",
]
npm = [
"--prefix", "frontend",
"--prefix",
"frontend",
]
pydeps = [
"--no-config",
"--cluster",
]
pylint = [
"--rcfile", ".pylint.toml",
"--rcfile",
".pylint.toml",
]
shtab = [
"--prefix", "{[project]name}",
"--prog", "{[project]name}",
"--prefix",
"{[project]name}",
"--prog",
"{[project]name}",
"ahriman.application.ahriman._parser",
]
@@ -73,7 +87,8 @@ system_site_packages = true
commands = [
[
"{envpython}",
"-m", "build",
"-m",
"build",
"--sdist",
"--no-isolation",
],
@@ -99,7 +114,8 @@ commands = [
{ replace = "ref", of = ["flags", "autopep8"], extend = true },
"--exit-code",
"--in-place",
"--jobs", "0",
"--jobs",
"0",
"--recursive",
"ahriman-core/src/{[project]name}",
"ahriman-triggers/src/{[project]name}",
@@ -125,18 +141,20 @@ commands = [
[
"bandit",
{ replace = "ref", of = ["flags", "bandit"], extend = true },
"--skip", "B101,B105,B106",
"--skip",
"B101,B105,B106",
"--recursive",
"ahriman-core/src/{[project]name}",
"ahriman-triggers/src/{[project]name}",
"ahriman-web/src/{[project]name}",
"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}",
"--package",
"{[project]name}",
],
{ replace = "ref", of = ["commands", "npm_install"], extend = true },
[
@@ -166,26 +184,34 @@ commands = [
[
"shtab",
{ replace = "ref", of = ["flags", "shtab"], extend = true },
"--shell", "bash",
"--output", "ahriman-core/package/share/bash-completion/completions/_ahriman",
"--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",
"--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",
"--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",
"--dot-output",
"{tox_root}/docs/_static/architecture.dot",
"--no-output",
"--show-dot",
"{envsitepackagesdir}/{[project]name}",
@@ -194,7 +220,8 @@ commands = [
"sphinx-apidoc",
"--force",
"--no-toc",
"--output-dir", "docs",
"--output-dir",
"docs",
"{envsitepackagesdir}/{[project]name}",
],
# compile list of dependencies for rtd.io
@@ -202,11 +229,16 @@ commands = [
"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",
"--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",
],
@@ -240,9 +272,11 @@ recreate = true
commands = [
[
"sphinx-build",
"--builder", "html",
"--builder",
"html",
"--fail-on-warning",
"--jobs", "1",
"--jobs",
"1",
"--write-all",
"docs",
"{envtmpdir}/html",
@@ -275,7 +309,8 @@ commands = [
[
"git",
"commit",
"--message", "Release {posargs}",
"--message",
"Release {posargs}",
],
[
"git",
@@ -328,7 +363,8 @@ commands = [
# check if version is set and validate it
[
"{envpython}",
"-c", "from packaging.version import Version; Version('{posargs}')",
"-c",
"from packaging.version import Version; Version('{posargs}')",
],
[
"sed",