Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions imas_validator/validate/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,25 @@ def validate(
def _check_imas_version() -> None:
"""Check if the installed IMAS version is sufficient."""
# TODO: check if this is the best level to test for the IMAS version
if not imas.backends.imas_core.imas_interface.has_imas:
version_found = imas.backends.imas_core.imas_interface.ll_interface._al_version
if version_found is None:
logger.info(
"No IMAS install could be found."
"IDS Validation will work with limited functionality."
)
return
else:
logger.info(f"Found IMAS install with version {version_found}.")

if imas.backends.imas_core.imas_interface.ll_interface._al_version < Version("5.1"):
try:
# On imas-python >= 2.2 this import raises ImportError when imas_core
# is not installed. On older versions the import always succeeds and
# _al_version is None when the access layer is missing.
from imas.backends.imas_core.imas_interface import ll_interface
except ImportError:
version_found = None
else:
version_found = ll_interface._al_version

if version_found is None:
logger.info(
"No IMAS install could be found."
"IDS Validation will work with limited functionality."
)
return

logger.info(f"Found IMAS install with version {version_found}.")
if version_found < Version("5.1"):
logger.info(
"IDS Validation requires an IMAS installation of version 5.1 or newer."
"See the README for more details."
Expand Down
Loading