From 8a46ff84879308da842fa788e0fcc5c215ea308b Mon Sep 17 00:00:00 2001 From: Markus Graf Date: Thu, 18 Jun 2026 17:20:51 +0200 Subject: [PATCH] refactor: locate project root by pyproject.toml marker --- api/schema.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/api/schema.py b/api/schema.py index c97299d..b5b5948 100644 --- a/api/schema.py +++ b/api/schema.py @@ -33,7 +33,13 @@ def is_wecker_ringing() -> bool: def _project_root() -> Path: - return Path(__file__).parent.parent.absolute() + """Locate the project root by searching upward for pyproject.toml.""" + start = Path(__file__).resolve() + for parent in start.parents: + if (parent / "pyproject.toml").exists(): + return parent + # Fallback for unusual layouts; keep a sensible default. + return start.parent.parent def _default_command() -> str: