@@ -97,16 +97,25 @@ class ArgMixin(BaseModel, use_attribute_docstrings=True, cli_implicit_flags=True
9797
9898
9999class WithSummaryLogging (ArgMixin ):
100- summary : Union [Path , Sequence [Path ]] = Field (
101- (), examples = [Path ("summary.md" ), Path ("bioimageio_summaries/" )]
100+ summary : Union [
101+ Literal ["display" ], Path , Sequence [Union [Literal ["display" ], Path ]]
102+ ] = Field (
103+ "display" ,
104+ examples = [
105+ "display" ,
106+ Path ("summary.md" ),
107+ Path ("bioimageio_summaries/" ),
108+ ["display" , Path ("summary.md" )],
109+ ],
102110 )
103- """Save the validation summary as JSON, Markdown or HTML.
111+ """Display the validation summary or save it as JSON, Markdown or HTML.
104112 The format is chosen based on the suffix: `.json`, `.md`, `.html`.
105113 If a folder is given (path w/o suffix) the summary is saved in all formats.
114+ Choose/add `"display"` to render the validation summary to the terminal.
106115 """
107116
108117 def log (self , descr : Union [ResourceDescr , InvalidDescr ]):
109- _ = descr .validation_summary .save (self .summary )
118+ _ = descr .validation_summary .log (self .summary )
110119
111120
112121class WithSource (ArgMixin ):
@@ -267,8 +276,13 @@ def _get_stat(
267276
268277
269278class UpdateCmdBase (CmdBase , WithSource , ABC ):
270- output : Union [Literal ["render" , "stdout" ], Path ] = "render"
271- """Output updated bioimageio.yaml to the terminal or write to a file."""
279+ output : Union [Literal ["display" , "stdout" ], Path ] = "display"
280+ """Output updated bioimageio.yaml to the terminal or write to a file.
281+ Notes:
282+ - `"display"`: Render to the terminal with syntax highlighting.
283+ - `"stdout"`: Write to sys.stdout without syntax highligthing.
284+ (More convenient for copying the updated bioimageio.yaml from the terminal.)
285+ """
272286
273287 diff : Union [bool , Path ] = Field (True , alias = "diff" )
274288 """Output a diff of original and updated bioimageio.yaml.
@@ -318,7 +332,7 @@ def run(self):
318332 if isinstance (self .output , Path ):
319333 _ = self .output .write_text (updated_yaml , encoding = "utf-8" )
320334 logger .info (f"written updated description to { self .output } " )
321- elif self .output == "render " :
335+ elif self .output == "display " :
322336 updated_md = f"```yaml\n { updated_yaml } \n ```"
323337 rich .console .Console ().print (rich .markdown .Markdown (updated_md ))
324338 elif self .output == "stdout" :
@@ -705,7 +719,7 @@ def input_dataset(stat: Stat):
705719 save_sample (sp_out , sample_out )
706720
707721
708- class AddWeightsCmd (CmdBase , WithSource ):
722+ class AddWeightsCmd (CmdBase , WithSource , WithSummaryLogging ):
709723 output : CliPositionalArg [Path ]
710724 """The path to write the updated model package to."""
711725
@@ -735,7 +749,7 @@ def run(self):
735749 if updated_model_descr is None :
736750 return
737751
738- _ = updated_model_descr . validation_summary . save ( )
752+ self . log ( updated_model_descr )
739753
740754
741755JSON_FILE = "bioimageio-cli.json"
0 commit comments