#
# SPDX-FileCopyrightText: <text>Copyright 2025 Arm Limited and/or its
# affiliates <open-source-office@arm.com></text>
#
# SPDX-License-Identifier: MIT
import os
from typing import Dict
[docs]
def find_project_root(filename="pyproject.toml"):
"""
Locate the root directory by searching through directory that contains
``filename``.
:param filename: Marker file to look for when determining the project root.
:returns: Absolute path to the directory containing the marker file.
"""
path = os.path.abspath(__file__)
while path != os.path.dirname(path): # stop at filesystem root
if os.path.exists(os.path.join(path, filename)):
return path
path = os.path.dirname(path)
raise FileNotFoundError(f"Could not find {filename} in parent directories")