Skip to content

Commit 36be7e3

Browse files
committed
add validate_format
1 parent e3e2a53 commit 36be7e3

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

bioimageio/core/commands.py

+20-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
import fire
88

99
from bioimageio.core import __version__, test_description
10-
from bioimageio.spec import save_bioimageio_package
10+
from bioimageio.spec import (
11+
load_description_and_validate_format_only,
12+
save_bioimageio_package,
13+
)
1114
from bioimageio.spec.collection import CollectionDescr
1215
from bioimageio.spec.dataset import DatasetDescr
1316
from bioimageio.spec.model import ModelDescr
@@ -54,13 +57,28 @@ def test(
5457
devices: Device(s) to use for testing
5558
decimal: Precision for numerical comparisons
5659
"""
60+
print(f"\ntesting {source}...")
5761
summary = test_description(
5862
source,
5963
weight_format=None if weight_format is None else weight_format,
6064
devices=[devices] if isinstance(devices, str) else devices,
6165
decimal=decimal,
6266
)
63-
print(f"\ntesting model {source}...")
67+
print(summary.format())
68+
sys.exit(0 if summary.status == "passed" else 1)
69+
70+
@staticmethod
71+
def validate_format(
72+
source: str,
73+
):
74+
"""validate the meta data format of a bioimageio resource description
75+
76+
Args:
77+
source: Path or URL to the bioimageio resource description file
78+
(bioimageio.yaml or rdf.yaml) or to a zipped resource
79+
"""
80+
print(f"\validating meta data format of {source}...")
81+
summary = load_description_and_validate_format_only(source)
6482
print(summary.format())
6583
sys.exit(0 if summary.status == "passed" else 1)
6684

0 commit comments

Comments
 (0)