9cbf1ab367
- pyproject.toml -> 0.3.0 (significant changes since 0.2.0: full Phase 1-7 KB stack, classifier+labels, batch-upload UI, pending-review panel, bucket rename to legal-kb) - api/__init__.py reads version from pyproject at import time so /api/health and OpenAPI both reflect reality without a second hardcoded copy - api/services/kb/voyage.py: _post_with_retry wraps embed/rerank POSTs with exponential backoff on 429+5xx (max 5 retries, base 2s, capped 30s, +25% jitter, honors Retry-After header). Dev and prod share a single VOYAGE_API_KEY today, so a simultaneous bulk re-ingest on both used to fail half the calls; now the burst is absorbed in seconds. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
28 lines
804 B
Python
28 lines
804 B
Python
"""shira-hermes API package."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import tomllib
|
|
from pathlib import Path
|
|
|
|
|
|
def _read_version() -> str:
|
|
"""Source-of-truth version from pyproject.toml.
|
|
|
|
pyproject lives at the repo root; we walk up from this file
|
|
instead of relying on importlib.metadata so the version is
|
|
correct in editable installs and in the Docker image where the
|
|
package may not be `pip install`-ed at all.
|
|
"""
|
|
here = Path(__file__).resolve()
|
|
for parent in [here.parent, *here.parents]:
|
|
candidate = parent / "pyproject.toml"
|
|
if candidate.exists():
|
|
with candidate.open("rb") as f:
|
|
data = tomllib.load(f)
|
|
return data.get("project", {}).get("version", "0.0.0")
|
|
return "0.0.0"
|
|
|
|
|
|
__version__ = _read_version()
|