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
« prev ^ index » next coverage.py v7.16.0, created at 2026-09-04 11:35 +0000
1"""Models for metadata harvested from Git."""
3from __future__ import annotations
5from typing import Annotated
7from pydantic import Field
9from somesy.core.models import SomesyBaseModel
10from somesy.core.types import ContributionTypeEnum
13class GitAuthor(SomesyBaseModel):
14 """A Git author mapped to a Somesy project contributor."""
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 )
25class GitMetadata(SomesyBaseModel):
26 """Git values that map to Somesy project metadata."""
28 name: str | None = None
29 repository: str | None = None
30 version: str | None = None
31 authors: list[GitAuthor] = Field(default_factory=list)