Something went wrong. Try again.
Building agents with code.
Something went wrong. Try again.
12345678910111213141516171819202122232425262728"""Minimal env loader — no python-dotenv required."""from __future__ import annotations
import osfrom pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
def load_dotenv(path: Path | None = None) -> None: env_path = path or (ROOT / ".env") if not env_path.is_file(): return for line in env_path.read_text().splitlines(): line = line.strip() if not line or line.startswith("#") or "=" not in line: continue key, _, value = line.partition("=") os.environ.setdefault(key.strip(), value.strip().strip('"').strip("'"))
def require(*keys: str) -> dict[str, str]: load_dotenv() missing = [k for k in keys if not os.environ.get(k)] if missing: raise SystemExit(f"Missing env: {', '.join(missing)}. Copy .env.example → .env.") return {k: os.environ[k] for k in keys}