MCPcopy Create free account
hub / github.com/cocoindex-io/cocoindex-code / find_project_root

Function find_project_root

src/cocoindex_code/settings.py:324–336  ·  view source on GitHub ↗

Walk up from *start* looking for ``.cocoindex_code/settings.yml``. Returns the directory containing it, or ``None``.

(start: Path)

Source from the content-addressed store, hash-verified

322
323
324def find_project_root(start: Path) -> Path | None:
325 """Walk up from *start* looking for ``.cocoindex_code/settings.yml``.
326
327 Returns the directory containing it, or ``None``.
328 """
329 current = start.resolve()
330 while True:
331 if (current / _SETTINGS_DIR_NAME / _SETTINGS_FILE_NAME).is_file():
332 return current
333 parent = current.parent
334 if parent == current:
335 return None
336 current = parent
337
338
339def find_legacy_project_root(start: Path) -> Path | None:

Callers 7

require_project_rootFunction · 0.85
doctorFunction · 0.85
_iter_targetsFunction · 0.85
mainFunction · 0.85

Calls

no outgoing calls