Coverage for src/somesy/git/models.py: 100%

16 statements  

« prev     ^ index     » next       coverage.py v7.16.0, created at 2026-09-04 11:35 +0000

1"""Models for metadata harvested from Git.""" 

2 

3from __future__ import annotations 

4 

5from typing import Annotated 

6 

7from pydantic import Field 

8 

9from somesy.core.models import SomesyBaseModel 

10from somesy.core.types import ContributionTypeEnum 

11 

12 

13class GitAuthor(SomesyBaseModel): 

14 """A Git author mapped to a Somesy project contributor.""" 

15 

16 name: str 

17 email: str | None = None 

18 commit_count: Annotated[int, Field(ge=0)] = 0 

19 author: bool = True 

20 contribution_types: list[ContributionTypeEnum] = Field( 

21 default_factory=lambda: [ContributionTypeEnum.code], min_length=1 

22 ) 

23 

24 

25class GitMetadata(SomesyBaseModel): 

26 """Git values that map to Somesy project metadata.""" 

27 

28 name: str | None = None 

29 repository: str | None = None 

30 version: str | None = None 

31 authors: list[GitAuthor] = Field(default_factory=list)