Files
periscope/backend/_version.py
T
Siddharth Kothari 6672d2be57 Pinscope open-source core
Agentic schematic validation: datasheet extraction via Claude Console
Skills, netlist/BOM design graph, per-IC direct datasheet review with
page citations, capacitor derating, Next.js report UI.

Extracted from the Pinscope cloud codebase. Auth and billing live in the
private gateway repo behind stable seams (billing_hook.py, adapter files
listed in CLAUDE.md).
2026-07-16 21:29:45 -07:00

39 lines
995 B
Python

"""Pinscope app version, sourced from frontend/content/changelog.md.
The changelog is the single source of truth for the user-facing version.
The Dockerfile copies it into the image at /app/changelog.md; locally we
fall back to the in-repo path.
"""
from __future__ import annotations
import re
from functools import lru_cache
from pathlib import Path
def _candidate_paths() -> list[Path]:
here = Path(__file__).resolve()
return [
Path("/app/changelog.md"),
here.parent.parent / "frontend" / "content" / "changelog.md",
]
_VERSION_RE = re.compile(r"^##\s+(\d+\.\d+\.\d+)\b", re.MULTILINE)
@lru_cache(maxsize=1)
def get_pinscope_version() -> str:
for path in _candidate_paths():
try:
text = path.read_text(encoding="utf-8")
except (FileNotFoundError, OSError):
continue
m = _VERSION_RE.search(text)
if m:
return m.group(1)
return "unknown"
PINSCOPE_VERSION = get_pinscope_version()