Skip to content

CLI fixes #465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,11 @@
],
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"python-envs.pythonProjects": [
{
"path": "",
"envManager": "ms-python.python:conda",
"packageManager": "ms-python.python:conda"
}
],
}
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,15 @@ may be controlled with the `LOGURU_LEVEL` environment variable.

## Changelog

### next release

- fixes:
- CLI
- improved handling of summary argument to not create a path with brackets when given a list of paths.
- improved backward compatibility when runnig tests for models specifying an older bioimageio.core version in their environment.
This is relevant when using `runtime_env="as-described"`.
It works by simply trying option `--summary` (new option name) and `--summary-path` (outdated option name).

### 0.9.0

- update to [bioimageio.spec 0.5.4.3](https://github.com/bioimage-io/spec-bioimage-io/blob/main/changelog.md#bioimageiospec-0543)
Expand Down
59 changes: 44 additions & 15 deletions bioimageio/core/_resource_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,21 +404,50 @@ def _test_in_env(
)
return summary

run_command(
[
"conda",
"run",
"-n",
env_name,
"bioimageio",
"test",
str(source),
f"--summary-path={summary_path}",
f"--determinism={determinism}",
]
+ ([f"--expected-type={expected_type}"] if expected_type else [])
+ (["--stop-early"] if stop_early else [])
)
cmd = []
for summary_path_arg_name in ("summary", "summary-path"):
run_command(
cmd := (
[
"conda",
"run",
"-n",
env_name,
"bioimageio",
"test",
str(source),
f"--{summary_path_arg_name}={summary_path.as_posix()}",
f"--determinism={determinism}",
]
+ ([f"--expected-type={expected_type}"] if expected_type else [])
+ (["--stop-early"] if stop_early else [])
)
)
if summary_path.exists():
break
else:
return ValidationSummary(
name="calling bioimageio test command",
source_name=str(source),
status="failed",
type="unknown",
format_version="unknown",
details=[
ValidationDetail(
name="run 'bioimageio test'",
errors=[
ErrorEntry(
loc=(),
type="bioimageio cli",
msg=f"test command '{' '.join(cmd)}' did not produce a summary file at {summary_path}",
)
],
status="failed",
)
],
env=set(),
)

return ValidationSummary.model_validate_json(summary_path.read_bytes())


Expand Down
9 changes: 4 additions & 5 deletions bioimageio/core/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
from tqdm import tqdm
from typing_extensions import assert_never

import bioimageio.spec
from bioimageio.spec import (
AnyModelDescr,
InvalidDescr,
Expand Down Expand Up @@ -98,10 +99,8 @@ class ArgMixin(BaseModel, use_attribute_docstrings=True, cli_implicit_flags=True


class WithSummaryLogging(ArgMixin):
summary: Union[
Literal["display"], Path, Sequence[Union[Literal["display"], Path]]
] = Field(
"display",
summary: Sequence[Union[Literal["display"], Path]] = Field(
("display",),
examples=[
"display",
Path("summary.md"),
Expand Down Expand Up @@ -867,7 +866,7 @@ def run(self):

library versions:
bioimageio.core {VERSION}
bioimageio.spec {VERSION}
bioimageio.spec {bioimageio.spec.__version__}

spec format versions:
model RDF {ModelDescr.implemented_format_version}
Expand Down
2 changes: 2 additions & 0 deletions tests/test_bioimageio_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def yield_bioimageio_yaml_urls() -> Iterable[ParameterSet]:
"mellow-takeout/1": "missing cite",
"merry-water-buffalo/0.1.0": "requires biapy",
"mesmerizing-shoe/1.14.1": "missing license",
"modest-spider/0.1.1": "non-batch id 'b'",
"naked-microbe/1": "unknown layer Convolution2D",
"nice-peacock/1": "invalid id",
"noisy-ox/1": "batch size is actually limited to 1",
Expand Down Expand Up @@ -151,6 +152,7 @@ def yield_bioimageio_yaml_urls() -> Iterable[ParameterSet]:
),
"striking-necktie/1.14.1": "invalid id",
"stupendous-sheep/1.1": "requires relativ import of attachment",
"sympathetic-mosquito/1": "error deserializing VarianceScaling",
"tempting-pizza/1": "missing license",
"timeless-running-shirt/1.13.2": "invalid id, missing license",
"uplifting-backpack/1.14.1": "invalid id, missing license",
Expand Down
Loading