console¶
The rich console the package prints its output on.
sbmlutils separates output from logging:
- Output is what a user asked to see: the files
create_modelwrites, the report of a validation with its findings, the summary of a flattening, a download. It is printed onconsole, the rich console of this module, with colors, tables and links. - Logging is for tracing problems and for debugging: a warning about content
which is lost or a definition which should be fixed, the error of a libsbml
call which failed, and debug detail. It goes to the standard
loggingmodule and is configured by the application, seesbmlutils.log.
The console prints to standard output. Silence it for a block of code with
quiet, or for the whole program by setting console.quiet = True:
from sbmlutils.console import console, quiet
with quiet():
create_model(model, filepath="model.xml")
console.quiet = True
Scripts and examples print on the same console, so their output and the output of the package look the same:
Importing this module has no side effects on the interpreter. To get rich
representations in an interactive session, install them explicitly with
rich.pretty.install().
quiet
¶
Suppress the output of the package inside the context.
Logging is not affected, warnings and errors are still logged. The console is shared by every thread, so the output of another thread is suppressed as well while the context is active.
Yields:
| Type | Description |
|---|---|
Generator[None]
|
None |
path_text
¶
Get a path as text which a terminal shows as a link to the file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path | str
|
the path of a file, relative paths are resolved |
required |
Returns:
| Type | Description |
|---|---|
Text
|
the path as it was given, linked to the absolute file URI |