Source code for mafw.devtools.toolchain.tools.git_cliff

#  Copyright 2026 European Union
#  Author: Bulgheroni Antonio (antonio.bulgheroni@ec.europa.eu)
#  SPDX-License-Identifier: EUPL-1.2
"""
Git-cliff toolchain tool implementation.

This module provides the :class:`GitCliffTool` concrete implementation of
:class:`~mafw.devtools.toolchain.ProjectTool` for managing the
``git-cliff`` changelog generator dependency in ``pyproject.toml``.

Git-cliff is a project tool whose version lower bound is declared in
``project.optional-dependencies.dev``. It has no cross-file consistency
concerns (unlike ruff which also appears in ``.pre-commit-config.yaml``),
so all behaviour is inherited from :class:`~mafw.devtools.toolchain.ProjectTool` without overrides.
"""

from __future__ import annotations

from mafw.devtools.toolchain import ProjectTool


[docs] class GitCliffTool(ProjectTool): """Manage the git-cliff changelog generator version in pyproject.toml. Git-cliff is declared in ``project.optional-dependencies.dev`` with a ``>=`` lower-bound specifier. This tool queries PyPI for the latest release and updates the lower bound accordingly. All behaviour (version detection, update, verify, bootstrap) is provided by :class:`~mafw.devtools.toolchain.ProjectTool`. :param project_root: Path to the project root directory containing ``pyproject.toml``. Defaults to the current working directory. :type project_root: Path | None """ @property def package_name(self) -> str: """PyPI package name. :return: ``"git-cliff"`` :rtype: str """ return 'git-cliff' @property def section_path(self) -> str: """TOML section path where git-cliff is declared. :return: ``"project.optional-dependencies.dev"`` :rtype: str """ return 'project.optional-dependencies.dev' @property def env_name(self) -> str: """Hatch environment where git-cliff lives. :return: ``"dev"`` :rtype: str """ return 'dev'