def project_root()

in src/fmeval/util.py [0:0]


def project_root(current_file: str) -> str:
    """
    :return: project root
    """
    curpath = os.path.abspath(os.path.dirname(current_file))

    def is_project_root(path: str) -> bool:
        return os.path.exists(os.path.join(path, ".root"))

    while not is_project_root(curpath):  # pragma: no cover
        parent = os.path.abspath(os.path.join(curpath, os.pardir))
        if parent == curpath:
            raise EvalAlgorithmInternalError("Got to the root and couldn't find a parent folder with .root")
        curpath = parent
    return curpath