spec.find_repo_root

spec.find_repo_root(start=None)

Walk up from start to the first directory that holds regen/architecture.toml.

Parameters

Name Type Description Default
start Path | str | None Directory to start from. Defaults to the current working directory. None

Returns

Name Type Description
Path Path The repository root.

Raises

Name Type Description
FileNotFoundError If no parent directory holds regen/architecture.toml.

Examples

from pathlib import Path
from tempfile import TemporaryDirectory

from spotregen import find_repo_root, make_sample_repo

with TemporaryDirectory() as tmp:
    root = make_sample_repo(Path(tmp) / "demo")
    print(find_repo_root(root / "src" / "samplepkg").name)
demo