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

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

5Hatch host tool implementation. 

6 

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

8:class:`~mafw.devtools.toolchain.HostTool` for managing hatch as a 

9host tool installed via pipx. 

10 

11Hatch is the build backend and project management tool used by MAFw. As a 

12host tool, it lives outside the project's virtual environments and is managed 

13through pipx commands. All operational logic (bootstrap, version detection, 

14upgrade, verification) is inherited from :class:`~mafw.devtools.toolchain.HostTool`. 

15""" 

16 

17from __future__ import annotations 

18 

19from mafw.devtools.toolchain import HostTool 

20 

21 

22class HatchTool(HostTool): 

23 """Manage hatch as a host tool installed via pipx. 

24 

25 This tool handles bootstrapping (installing hatch via pipx), detecting 

26 the currently installed version from pipx metadata, querying PyPI for the 

27 latest release, and upgrading via ``pipx upgrade``. 

28 

29 Since hatch is a host-level tool that does not modify repository files, 

30 the :meth:`verify` method always returns an empty list. 

31 

32 All method implementations are inherited from :class:`~mafw.devtools.toolchain.HostTool`. 

33 """ 

34 

35 @property 

36 def pipx_package_name(self) -> str: 

37 """The pipx package name for hatch.""" 

38 return 'hatch'