Read ``$PROJECT_ROOT/.cocoindex_code/settings.yml``. Raises ``FileNotFoundError`` if the file does not exist.
(project_root: Path)
| 591 | |
| 592 | |
| 593 | def 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 | |
| 611 | def save_project_settings(project_root: Path, settings: ProjectSettings) -> Path: |