Skip to content

cli_app.utils.misc

cli_app.utils.misc

find_project_root

find_project_root(marker='pyproject.toml')

Find the project root by searching upwards for a marker.

Source code in src/cli_app/utils/misc.py
def find_project_root(marker: str = "pyproject.toml") -> Path:
    """Find the project root by searching upwards for a marker."""
    current_path = Path(__file__).resolve()
    while current_path != current_path.parent:
        if (current_path / marker).exists():
            return current_path
        current_path = current_path.parent

    return Path(__file__).parent.resolve()