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)
| 328 | |
| 329 | |
| 330 | def _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 | |
| 343 | def _list_latest_versions(data: dict, max_versions: int = 3) -> list[str]: |
no test coverage detected
searching dependent graphs…