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

Function _examine_monai_version

monai/bundle/scripts.py:311–327  ·  view source on GitHub ↗

Examine if the package version is compatible with the MONAI version in the metadata.

(monai_version: str)

Source from the content-addressed store, hash-verified

309
310
311def _examine_monai_version(monai_version: str) -> tuple[bool, str]:
312 """Examine if the package version is compatible with the MONAI version in the metadata."""
313 version_dict = get_versions()
314 package_version = version_dict.get("version", "0+unknown")
315 if package_version == "0+unknown":
316 return False, "Package version is not available. Skipping version check."
317 if monai_version == "0+unknown":
318 return False, "MONAI version is not specified in the bundle. Skipping version check."
319 # treat rc versions as the same as the release version
320 package_version = re.sub(r"rc\d.*", "", package_version)
321 monai_version = re.sub(r"rc\d.*", "", monai_version)
322 if package_version < monai_version:
323 return (
324 False,
325 f"Your MONAI version is {package_version}, but the bundle is built on MONAI version {monai_version}.",
326 )
327 return True, ""
328
329
330def _check_monai_version(bundle_dir: PathLike, name: str) -> None:

Calls 2

get_versionsFunction · 0.90
getMethod · 0.80

Tested by 2

Used in the wild real call sites across dependent graphs

searching dependent graphs…