Coverage for src/mafw/devtools/toolchain/tools/git_cliff.py: 100%

12 statements  

« 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""" 

5Git-cliff toolchain tool implementation. 

6 

7This module provides the :class:`GitCliffTool` concrete implementation of 

8:class:`~mafw.devtools.toolchain.ProjectTool` for managing the 

9``git-cliff`` changelog generator dependency in ``pyproject.toml``. 

10 

11Git-cliff is a project tool whose version lower bound is declared in 

12``project.optional-dependencies.dev``. It has no cross-file consistency 

13concerns (unlike ruff which also appears in ``.pre-commit-config.yaml``), 

14so all behaviour is inherited from :class:`~mafw.devtools.toolchain.ProjectTool` without overrides. 

15""" 

16 

17from __future__ import annotations 

18 

19from mafw.devtools.toolchain import ProjectTool 

20 

21 

22class GitCliffTool(ProjectTool): 

23 """Manage the git-cliff changelog generator version in pyproject.toml. 

24 

25 Git-cliff is declared in ``project.optional-dependencies.dev`` with a 

26 ``>=`` lower-bound specifier. This tool queries PyPI for the latest 

27 release and updates the lower bound accordingly. 

28 

29 All behaviour (version detection, update, verify, bootstrap) is 

30 provided by :class:`~mafw.devtools.toolchain.ProjectTool`. 

31 

32 :param project_root: Path to the project root directory containing 

33 ``pyproject.toml``. Defaults to the current working directory. 

34 :type project_root: Path | None 

35 """ 

36 

37 @property 

38 def package_name(self) -> str: 

39 """PyPI package name. 

40 

41 :return: ``"git-cliff"`` 

42 :rtype: str 

43 """ 

44 return 'git-cliff' 

45 

46 @property 

47 def section_path(self) -> str: 

48 """TOML section path where git-cliff is declared. 

49 

50 :return: ``"project.optional-dependencies.dev"`` 

51 :rtype: str 

52 """ 

53 return 'project.optional-dependencies.dev' 

54 

55 @property 

56 def env_name(self) -> str: 

57 """Hatch environment where git-cliff lives. 

58 

59 :return: ``"dev"`` 

60 :rtype: str 

61 """ 

62 return 'dev'