25 lines
689 B
Python
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
|