Files
orisys-app/shared/src/orisys_app_shared/compat.py
T
2026-09-27 19:20:43 +08:00

26 lines
718 B
Python

"""Shared API compatibility helpers."""
from __future__ import annotations
import logging
from orisys_app_shared import API_VERSION
from orisys_app_shared import __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