Coverage for src / mysingle / cli / protos / models.py: 0%
23 statements
« prev ^ index » next coverage.py v7.12.0, created at 2025-12-02 00:58 +0900
« prev ^ index » next coverage.py v7.12.0, created at 2025-12-02 00:58 +0900
1"""
2Proto 서비스 관리를 위한 핵심 모델 및 함수.
3"""
5from __future__ import annotations
7from dataclasses import dataclass
8from pathlib import Path
11@dataclass
12class ServiceProtoInfo:
13 """서비스 Proto 정보"""
15 name: str
16 service_dir: Path
17 proto_dir: Path
18 files: list[Path]
21@dataclass
22class ProtoConfig:
23 """Proto 저장소 설정"""
25 repo_root: Path
26 services_root: Path
27 proto_root: Path
28 generated_root: Path
29 buf_template: Path
30 package_name: str = "mysingle_protos"
32 @classmethod
33 def from_repo_root(
34 cls, repo_root: Path, services_root: Path | None = None
35 ) -> ProtoConfig:
36 """저장소 루트 경로로부터 설정 생성"""
37 if services_root is None:
38 services_root = repo_root.parent / "services"
40 proto_root = repo_root / "protos"
42 return cls(
43 repo_root=repo_root,
44 services_root=services_root,
45 proto_root=proto_root,
46 generated_root=repo_root / "src" / "mysingle" / "protos",
47 buf_template=proto_root / "buf.gen.yaml",
48 )