display¶
Console output of scripts: sections, key/value blocks and links to results.
The output of a run, e.g. of simulation experiments or of a fit, is a sequence of sections with aligned key/value lines. A result which is a file, e.g. a report, is a link: the terminal opens it with one click.
from sbmlsim import display
display.section("Report", icon=display.ICON_REPORT)
display.key_values({"experiments": 3})
display.link("report", "results/index.html")
The output goes to the console of the package, see sbmlsim.console.
section
¶
Start a section of the output.
A blank line separates the section from whatever came before it, so the sections are told apart whether the previous one ended in a table or in a key/value block.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
title of the section. |
required |
icon
|
str | None
|
emoji in front of the title, e.g. |
None
|
link
¶
Print a link to a file or a directory, which the terminal opens with a click.
The link is a hyperlink of the terminal (OSC 8), which VS Code, iTerm2,
Windows Terminal, GNOME Terminal and kitty open with a click, whatever the
width of the terminal. Its text is the file:// URI of the path on a
single line, so that a terminal without hyperlinks still recognizes it,
and it is what ends up in a log file. The URI has forward slashes and a
drive is file:///C:/...; a windows path with backslashes is not a link
a terminal opens.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
what the link points to, in front of it. |
required |
path
|
Path | str
|
path of the file or the directory, relative paths are resolved. |
required |