Files
orisys-app/shared/src/orisys_app_shared/compat.py
T
2026-09-06 21:57:50 +08:00

25 lines
689 B
Python

"""Shared API compatibility helpers."""
from __future__ import annotations
import logging
from orisys_app_shared import API_VERSION, __version__ as shared_version
logger = logging.getLogger(__name__)
def check_shared_compat(required_api: str) -> bool:
"""Return True if shared API matches the app requirement; log a warning otherwise."""
required = str(required_api or "").strip()
current = str(API_VERSION).strip()
ok = required == current
if not ok:
logger.warning(
"Shared API mismatch: app requires %s, shared provides %s (shared package %s)",
required,
current,
shared_version,
)
return ok