Examine if the package version is compatible with the MONAI version in the metadata.
(monai_version: str)
| 309 | |
| 310 | |
| 311 | def _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 | |
| 330 | def _check_monai_version(bundle_dir: PathLike, name: str) -> None: |
searching dependent graphs…