|
7 | 7 | import fire |
8 | 8 |
|
9 | 9 | 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 | +) |
11 | 14 | from bioimageio.spec.collection import CollectionDescr |
12 | 15 | from bioimageio.spec.dataset import DatasetDescr |
13 | 16 | from bioimageio.spec.model import ModelDescr |
@@ -54,13 +57,28 @@ def test( |
54 | 57 | devices: Device(s) to use for testing |
55 | 58 | decimal: Precision for numerical comparisons |
56 | 59 | """ |
| 60 | + print(f"\ntesting {source}...") |
57 | 61 | summary = test_description( |
58 | 62 | source, |
59 | 63 | weight_format=None if weight_format is None else weight_format, |
60 | 64 | devices=[devices] if isinstance(devices, str) else devices, |
61 | 65 | decimal=decimal, |
62 | 66 | ) |
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) |
64 | 82 | print(summary.format()) |
65 | 83 | sys.exit(0 if summary.status == "passed" else 1) |
66 | 84 |
|
|
0 commit comments