__init__.py 524 B

123456789101112131415161718
  1. import re
  2. from pathlib import Path
  3. def _read_app_version() -> str:
  4. """Read APP_VERSION from backend config — single source of truth."""
  5. config_path = Path(__file__).resolve().parent.parent.parent / "backend" / "app" / "core" / "config.py"
  6. try:
  7. text = config_path.read_text()
  8. match = re.search(r'^APP_VERSION\s*=\s*["\'](.+?)["\']', text, re.MULTILINE)
  9. if match:
  10. return match.group(1)
  11. except OSError:
  12. pass
  13. return "0.0.0"
  14. __version__ = _read_app_version()