Skip to content

Commit 24aee14

Browse files
authored
Merge pull request #465 from bioimage-io/dev
CLI fixes
2 parents 2cec343 + cf731c2 commit 24aee14

File tree

5 files changed

+66
-20
lines changed

5 files changed

+66
-20
lines changed

.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,11 @@
1212
],
1313
"python.testing.pytestEnabled": true,
1414
"python.testing.unittestEnabled": false,
15+
"python-envs.pythonProjects": [
16+
{
17+
"path": "",
18+
"envManager": "ms-python.python:conda",
19+
"packageManager": "ms-python.python:conda"
20+
}
21+
],
1522
}

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,15 @@ may be controlled with the `LOGURU_LEVEL` environment variable.
364364

365365
## Changelog
366366

367+
### next release
368+
369+
- fixes:
370+
- CLI
371+
- improved handling of summary argument to not create a path with brackets when given a list of paths.
372+
- improved backward compatibility when runnig tests for models specifying an older bioimageio.core version in their environment.
373+
This is relevant when using `runtime_env="as-described"`.
374+
It works by simply trying option `--summary` (new option name) and `--summary-path` (outdated option name).
375+
367376
### 0.9.0
368377

369378
- update to [bioimageio.spec 0.5.4.3](https://github.com/bioimage-io/spec-bioimage-io/blob/main/changelog.md#bioimageiospec-0543)

bioimageio/core/_resource_tests.py

Lines changed: 44 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -404,21 +404,50 @@ def _test_in_env(
404404
)
405405
return summary
406406

407-
run_command(
408-
[
409-
"conda",
410-
"run",
411-
"-n",
412-
env_name,
413-
"bioimageio",
414-
"test",
415-
str(source),
416-
f"--summary-path={summary_path}",
417-
f"--determinism={determinism}",
418-
]
419-
+ ([f"--expected-type={expected_type}"] if expected_type else [])
420-
+ (["--stop-early"] if stop_early else [])
421-
)
407+
cmd = []
408+
for summary_path_arg_name in ("summary", "summary-path"):
409+
run_command(
410+
cmd := (
411+
[
412+
"conda",
413+
"run",
414+
"-n",
415+
env_name,
416+
"bioimageio",
417+
"test",
418+
str(source),
419+
f"--{summary_path_arg_name}={summary_path.as_posix()}",
420+
f"--determinism={determinism}",
421+
]
422+
+ ([f"--expected-type={expected_type}"] if expected_type else [])
423+
+ (["--stop-early"] if stop_early else [])
424+
)
425+
)
426+
if summary_path.exists():
427+
break
428+
else:
429+
return ValidationSummary(
430+
name="calling bioimageio test command",
431+
source_name=str(source),
432+
status="failed",
433+
type="unknown",
434+
format_version="unknown",
435+
details=[
436+
ValidationDetail(
437+
name="run 'bioimageio test'",
438+
errors=[
439+
ErrorEntry(
440+
loc=(),
441+
type="bioimageio cli",
442+
msg=f"test command '{' '.join(cmd)}' did not produce a summary file at {summary_path}",
443+
)
444+
],
445+
status="failed",
446+
)
447+
],
448+
env=set(),
449+
)
450+
422451
return ValidationSummary.model_validate_json(summary_path.read_bytes())
423452

424453

bioimageio/core/cli.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
from tqdm import tqdm
4747
from typing_extensions import assert_never
4848

49+
import bioimageio.spec
4950
from bioimageio.spec import (
5051
AnyModelDescr,
5152
InvalidDescr,
@@ -98,10 +99,8 @@ class ArgMixin(BaseModel, use_attribute_docstrings=True, cli_implicit_flags=True
9899

99100

100101
class WithSummaryLogging(ArgMixin):
101-
summary: Union[
102-
Literal["display"], Path, Sequence[Union[Literal["display"], Path]]
103-
] = Field(
104-
"display",
102+
summary: Sequence[Union[Literal["display"], Path]] = Field(
103+
("display",),
105104
examples=[
106105
"display",
107106
Path("summary.md"),
@@ -867,7 +866,7 @@ def run(self):
867866
868867
library versions:
869868
bioimageio.core {VERSION}
870-
bioimageio.spec {VERSION}
869+
bioimageio.spec {bioimageio.spec.__version__}
871870
872871
spec format versions:
873872
model RDF {ModelDescr.implemented_format_version}

tests/test_bioimageio_collection.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ def yield_bioimageio_yaml_urls() -> Iterable[ParameterSet]:
123123
"mellow-takeout/1": "missing cite",
124124
"merry-water-buffalo/0.1.0": "requires biapy",
125125
"mesmerizing-shoe/1.14.1": "missing license",
126+
"modest-spider/0.1.1": "non-batch id 'b'",
126127
"naked-microbe/1": "unknown layer Convolution2D",
127128
"nice-peacock/1": "invalid id",
128129
"noisy-ox/1": "batch size is actually limited to 1",
@@ -151,6 +152,7 @@ def yield_bioimageio_yaml_urls() -> Iterable[ParameterSet]:
151152
),
152153
"striking-necktie/1.14.1": "invalid id",
153154
"stupendous-sheep/1.1": "requires relativ import of attachment",
155+
"sympathetic-mosquito/1": "error deserializing VarianceScaling",
154156
"tempting-pizza/1": "missing license",
155157
"timeless-running-shirt/1.13.2": "invalid id, missing license",
156158
"uplifting-backpack/1.14.1": "invalid id, missing license",

0 commit comments

Comments
 (0)