Source code for mafw.devtools.toolchain.default_registry

#  Copyright 2026 European Union
#  Author: Bulgheroni Antonio (antonio.bulgheroni@ec.europa.eu)
#  SPDX-License-Identifier: EUPL-1.2
"""
Default tool registry factory.

This module provides the :func:`get_default_registry` function, which creates
a :class:`~mafw.devtools.toolchain.ToolRegistry` pre-populated with
all concrete :class:`~mafw.devtools.toolchain.base.ToolChainTool`
implementations in their canonical registration order.

CLI commands use this factory to obtain the registry of all managed tools
without hardcoding individual tool references.
"""

from __future__ import annotations

from mafw.devtools.toolchain.registry import ToolRegistry
from mafw.devtools.toolchain.tools.git_cliff import GitCliffTool
from mafw.devtools.toolchain.tools.hatch import HatchTool
from mafw.devtools.toolchain.tools.mypy import MypyTool
from mafw.devtools.toolchain.tools.pip_audit import PipAuditTool
from mafw.devtools.toolchain.tools.precommit import PreCommitTool
from mafw.devtools.toolchain.tools.pytest import PytestTool
from mafw.devtools.toolchain.tools.pyupgrade import PyUpgradeTool
from mafw.devtools.toolchain.tools.ruff import RuffTool
from mafw.devtools.toolchain.tools.sphinx import SphinxTool
from mafw.devtools.toolchain.tools.uv import UvTool


[docs] def get_default_registry() -> ToolRegistry: """Create a :class:`ToolRegistry` populated with all managed tools. The tools are registered in the canonical order: host tools first (hatch, uv), followed by project tools (pytest, mypy, sphinx, ruff, pyupgrade, pre-commit, git-cliff, pip-audit). :return: A fully-populated registry ready for use by CLI commands. :rtype: toolchain.ToolRegistry """ registry = ToolRegistry() # Host tools (managed via pipx). registry.register(HatchTool()) registry.register(UvTool()) # Project tools (managed via pyproject.toml). registry.register(PytestTool()) registry.register(MypyTool()) registry.register(SphinxTool()) registry.register(RuffTool()) registry.register(PyUpgradeTool()) registry.register(PreCommitTool()) registry.register(GitCliffTool()) registry.register(PipAuditTool()) return registry