/
niceSOFT
/
python3-setuptools_scm
Обзор
Документация
Войти
/
niceSOFT
/
python3-setuptools_scm
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
vcs-versioning/src/vcs_versioning/_version_fields.py
39 строк
951 B
Ronny Pfannschmidt
refactor: add VersionFields protocol for shared version-metadata contract
17 июн 2026, 13:15
17 июн 2026, 13:15
269d955
Код
Авторство
О чём код?
"""Shared version-metadata contract. Defines the minimal set of fields that all version-data representations (live ``ScmVersion``, serialized ``ScmVersionData``, env-override ``PretendMetadataDict``) have in common. Used to type boundaries that accept any of these without circular imports. """ from __future__ import annotations from datetime import date from typing import Protocol, runtime_checkable @runtime_checkable class VersionFields(Protocol): """Minimal VCS version metadata -- the shared contract. Both ``ScmVersion`` (live) and ``ScmVersionData`` (serialized) satisfy this protocol structurally. """ @property def tag(self) -> str: ... @property def distance(self) -> int: ... @property def node(self) -> str | None: ... @property def dirty(self) -> bool: ... @property def branch(self) -> str | None: ... @property def node_date(self) -> date | str | None: ...