Skip to content

Project config

blackline.models.project_config

ProjectConfig

Bases: BaseModel

Pydantic model for the configuration of a Blackline project.

Parameters:

Name Type Description Default
name str Name of the project. required
config_version int Version of the project configuration file. 1
version str Version of the project. 1
default_profile str Default profile to use for the project. default
catalogue_path Path Path to the directory containing the project's metadata catalogue. required
adapters_path Path Path to the directory containing the project's adapters. required
project_root Path required
Source code in BAR /opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/blackline/models/project_config.py
class ProjectConfig(BaseModel):
    """
    Pydantic model for the configuration of a Blackline project.
    """

    name: str = Field(..., description="Name of the project.")
    config_version: int = Field(
        default=1,
        alias="config-version",
        description="Version of the project configuration file.",
    )
    version: str = Field(default="1", description="Version of the project.")
    default_profile: str = Field(
        default="default",
        alias="default-profile",
        description="Default profile to use for the project.",
    )
    catalogue_path: Path = Field(
        alias="catalogue-path",
        description="Path to the directory containing the project's metadata catalogue.",  # noqa: E501
    )
    adapters_path: Path = Field(
        alias="adapters-path",
        description="Path to the directory containing the project's adapters.",
    )
    project_root: Path = Field(
        default=Path("."),
        alias="project-root",
        description="Path to the root directory of the project.",
    )

    class Config:
        allow_population_by_field_name = True

    @root_validator(pre=True)
    def add_root_to_path(cls, values):
        values["adapters-path"] = Path(
            values["project_root"], values.get("adapters-path", DEFAULT_ADAPTERS_FOLDER)
        )
        values["catalogue-path"] = Path(
            values["project_root"],
            values.get("catalogue-path", DEFAULT_CATALOGUE_FOLDER),
        )
        return values

    @classmethod
    def parse_config_file(cls, path: Path) -> "ProjectConfig":
        """
        Parse a project configuration file.

        Args:
            filepath (Path): Path to the project configuration file.

        Returns:
            ProjectConfig: A ProjectConfig instance.
        """
        with open(path, "rb") as f:
            info = yaml.safe_load(f)
            info["project_root"] = path.parent
            return cls.parse_obj(info)

parse_config_file(path) classmethod

Parse a project configuration file.

Parameters:

Name Type Description Default
filepath Path

Path to the project configuration file.

required

Returns:

Name Type Description
ProjectConfig ProjectConfig

A ProjectConfig instance.

Source code in /opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/blackline/models/project_config.py
@classmethod
def parse_config_file(cls, path: Path) -> "ProjectConfig":
    """
    Parse a project configuration file.

    Args:
        filepath (Path): Path to the project configuration file.

    Returns:
        ProjectConfig: A ProjectConfig instance.
    """
    with open(path, "rb") as f:
        info = yaml.safe_load(f)
        info["project_root"] = path.parent
        return cls.parse_obj(info)