MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / _check_monai_version

Function _check_monai_version

monai/bundle/scripts.py:330–340  ·  view source on GitHub ↗

Get the `monai_version` from the metadata.json and compare if it is smaller than the installed `monai` package version

(bundle_dir: PathLike, name: str)

Source from the content-addressed store, hash-verified

328
329
330def _check_monai_version(bundle_dir: PathLike, name: str) -> None:
331 """Get the `monai_version` from the metadata.json and compare if it is smaller than the installed `monai` package version"""
332 metadata_file = Path(bundle_dir) / name / "configs" / "metadata.json"
333 if not metadata_file.exists():
334 logger.warning(f"metadata file not found in {metadata_file}.")
335 return
336 with open(metadata_file) as f:
337 metadata = json.load(f)
338 is_compatible, msg = _examine_monai_version(metadata.get("monai_version", "0+unknown"))
339 if not is_compatible:
340 logger.warning(msg)
341
342
343def _list_latest_versions(data: dict, max_versions: int = 3) -> list[str]:

Callers 1

downloadFunction · 0.85

Calls 3

_examine_monai_versionFunction · 0.85
loadMethod · 0.80
getMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…