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

Function load_project_settings

src/cocoindex_code/settings.py:593–608  ·  view source on GitHub ↗

Read ``$PROJECT_ROOT/.cocoindex_code/settings.yml``. Raises ``FileNotFoundError`` if the file does not exist.

(project_root: Path)

Source from the content-addressed store, hash-verified

591
592
593def load_project_settings(project_root: Path) -> ProjectSettings:
594 """Read ``$PROJECT_ROOT/.cocoindex_code/settings.yml``.
595
596 Raises ``FileNotFoundError`` if the file does not exist.
597 """
598 path = project_settings_path(project_root)
599 if not path.is_file():
600 raise FileNotFoundError(f"Project settings not found: {path}")
601 try:
602 with open(path) as f:
603 data = _yaml.safe_load(f)
604 if not data:
605 return default_project_settings()
606 return _project_settings_from_dict(data)
607 except Exception as e:
608 raise type(e)(f"Error loading {path}: {e}") from e
609
610
611def save_project_settings(project_root: Path, settings: ProjectSettings) -> Path:

Calls 3

project_settings_pathFunction · 0.85
default_project_settingsFunction · 0.85