Coverage for src/mafw/devtools/toolchain/default_registry.py: 100%
25 statements
« prev ^ index » next coverage.py v7.15.0, created at 2026-07-26 09:13 +0000
« prev ^ index » next coverage.py v7.15.0, created at 2026-07-26 09:13 +0000
1# Copyright 2026 European Union
2# Author: Bulgheroni Antonio (antonio.bulgheroni@ec.europa.eu)
3# SPDX-License-Identifier: EUPL-1.2
4"""
5Default tool registry factory.
7This module provides the :func:`get_default_registry` function, which creates
8a :class:`~mafw.devtools.toolchain.ToolRegistry` pre-populated with
9all concrete :class:`~mafw.devtools.toolchain.base.ToolChainTool`
10implementations in their canonical registration order.
12CLI commands use this factory to obtain the registry of all managed tools
13without hardcoding individual tool references.
14"""
16from __future__ import annotations
18from mafw.devtools.toolchain.registry import ToolRegistry
19from mafw.devtools.toolchain.tools.git_cliff import GitCliffTool
20from mafw.devtools.toolchain.tools.hatch import HatchTool
21from mafw.devtools.toolchain.tools.mypy import MypyTool
22from mafw.devtools.toolchain.tools.pip_audit import PipAuditTool
23from mafw.devtools.toolchain.tools.precommit import PreCommitTool
24from mafw.devtools.toolchain.tools.pytest import PytestTool
25from mafw.devtools.toolchain.tools.pyupgrade import PyUpgradeTool
26from mafw.devtools.toolchain.tools.ruff import RuffTool
27from mafw.devtools.toolchain.tools.sphinx import SphinxTool
28from mafw.devtools.toolchain.tools.uv import UvTool
31def get_default_registry() -> ToolRegistry:
32 """Create a :class:`ToolRegistry` populated with all managed tools.
34 The tools are registered in the canonical order: host tools first
35 (hatch, uv), followed by project tools (pytest, mypy, sphinx, ruff,
36 pyupgrade, pre-commit, git-cliff, pip-audit).
38 :return: A fully-populated registry ready for use by CLI commands.
39 :rtype: toolchain.ToolRegistry
40 """
41 registry = ToolRegistry()
43 # Host tools (managed via pipx).
44 registry.register(HatchTool())
45 registry.register(UvTool())
47 # Project tools (managed via pyproject.toml).
48 registry.register(PytestTool())
49 registry.register(MypyTool())
50 registry.register(SphinxTool())
51 registry.register(RuffTool())
52 registry.register(PyUpgradeTool())
53 registry.register(PreCommitTool())
54 registry.register(GitCliffTool())
55 registry.register(PipAuditTool())
57 return registry