Files

54 строки
1.4 KiB
Python

#!/usr/bin/env python3
"""
Repository Config Model
------------------------
This module defines Pydantic data models for validating and parsing the repos-config.json file.
Structure of the expected JSON:
{
"repositories": [
{
"name": "rocblas",
"url": "ROCm/rocBLAS",
"branch": "develop",
"category": "projects"
},
...
]
}
"""
from typing import List
from pydantic import BaseModel
class RepoEntry(BaseModel):
"""
Represents a single repository entry in the repos-config.json file.
Fields:
name : Name of the project matching packaging file names. Lower-cased and no underscores. (e.g., "rocblas")
url : Individual GitHub org plus repo names in matching case and punctuation. (e.g., "ROCm/rocBLAS")
branch : The base branch of the sub-repo to target (e.g., "develop").
category : Directory category in the super-repo (e.g., "projects" or "shared").
monorepo_source_of_truth : Whether this project has completed migration to monorepo as source of truth.
"""
name: str
url: str
branch: str
category: str
auto_subtree_pull: bool
auto_subtree_push: bool
monorepo_source_of_truth: bool
class RepoConfig(BaseModel):
"""
Represents the full config file structure.
Fields:
repositories : List of RepoEntry items.
"""
repositories: List[RepoEntry]