INNER CODE UNIT · Python
find_project_root
snakemake/snakefmt · snakefmt/config.py:21
def find_project_root(
srcs: Sequence[str], stdin_filename: Optional[str] = None
) -> Tuple[Path, str]:
"""Return a directory containing .git, .hg, or pyproject.toml.
That directory will be a common parent of all files and directories
passed in `srcs`.
If no directory in the tree contains a marker that would specify it's the
project root, the root of the file system is returned.
Returns a two-tuple with the first element as the project root path and
the second element as a string describing the method by which the
project root was discovered.
Note: taken directly from black v24.1.0 as they changed the behaviour of this
function in v24.2.0 to only find the root if the pyproject.toml file contained the
[tool.black] section. This is not the desired behaviour for snakefmt