Skip to content

summary ¤

Utilities for summarizing and formatting BioImage.IO validation results.

This module defines data structures to capture validation errors, warnings, and summaries for BioImage.IO resource descriptions, along with helpers to format these results as plain text, Markdown, or HTML for reporting and diagnostics.

Classes:

Name Description
ErrorEntry

An error in a ValidationDetail

InstalledPackage
ValidationDetail

a detail in a validation summary

ValidationEntry

Base of ErrorEntry and WarningEntry

ValidationSummary

Summarizes output of all bioimageio validations and tests

WarningEntry

A warning in a ValidationDetail

Functions:

Name Description
format_loc

helper to format a location tuple loc

Attributes:

Name Type Description
CONDA_CMD
Loc

location of error/warning in a nested data structure

WARNING_LEVEL_TO_NAME Mapping[WarningLevel, WarningLevelName]
WARNING_NAME_TO_LEVEL Mapping[WarningLevelName, WarningLevel]
WARNING_SEVERITY_TO_NAME Mapping[WarningSeverity, WarningSeverityName]
WarningLevelName
WarningSeverityName

CONDA_CMD module-attribute ¤

CONDA_CMD = (
    "conda.bat"
    if platform.system() == "Windows"
    else "conda"
)

Loc module-attribute ¤

Loc = Tuple[Union[int, str], ...]

location of error/warning in a nested data structure

WARNING_LEVEL_TO_NAME module-attribute ¤

WARNING_LEVEL_TO_NAME: Mapping[
    WarningLevel, WarningLevelName
] = MappingProxyType(
    {
        INFO: INFO_NAME,
        WARNING: WARNING_NAME,
        ALERT: ALERT_NAME,
        ERROR: ERROR_NAME,
    }
)

WARNING_NAME_TO_LEVEL module-attribute ¤

WARNING_NAME_TO_LEVEL: Mapping[
    WarningLevelName, WarningLevel
] = MappingProxyType(
    {v: k for k, v in (WARNING_LEVEL_TO_NAME.items())}
)

WARNING_SEVERITY_TO_NAME module-attribute ¤

WARNING_SEVERITY_TO_NAME: Mapping[
    WarningSeverity, WarningSeverityName
] = MappingProxyType(
    {
        INFO: INFO_NAME,
        WARNING: WARNING_NAME,
        ALERT: ALERT_NAME,
    }
)

WarningLevelName module-attribute ¤

WarningLevelName = Literal[WarningSeverityName, 'error']

WarningSeverityName module-attribute ¤

WarningSeverityName = Literal['info', 'warning', 'alert']

ErrorEntry pydantic-model ¤

Bases: ValidationEntry

An error in a ValidationDetail

Show JSON schema:
{
  "description": "An error in a `ValidationDetail`",
  "properties": {
    "loc": {
      "items": {
        "anyOf": [
          {
            "type": "integer"
          },
          {
            "type": "string"
          }
        ]
      },
      "title": "Loc",
      "type": "array"
    },
    "msg": {
      "title": "Msg",
      "type": "string"
    },
    "type": {
      "anyOf": [
        {
          "enum": [
            "no_such_attribute",
            "json_invalid",
            "json_type",
            "needs_python_object",
            "recursion_loop",
            "missing",
            "frozen_field",
            "frozen_instance",
            "extra_forbidden",
            "invalid_key",
            "get_attribute_error",
            "model_type",
            "model_attributes_type",
            "dataclass_type",
            "dataclass_exact_type",
            "default_factory_not_called",
            "none_required",
            "greater_than",
            "greater_than_equal",
            "less_than",
            "less_than_equal",
            "multiple_of",
            "finite_number",
            "too_short",
            "too_long",
            "iterable_type",
            "iteration_error",
            "string_type",
            "string_sub_type",
            "string_unicode",
            "string_too_short",
            "string_too_long",
            "string_pattern_mismatch",
            "enum",
            "dict_type",
            "mapping_type",
            "list_type",
            "tuple_type",
            "set_type",
            "set_item_not_hashable",
            "bool_type",
            "bool_parsing",
            "int_type",
            "int_parsing",
            "int_parsing_size",
            "int_from_float",
            "float_type",
            "float_parsing",
            "bytes_type",
            "bytes_too_short",
            "bytes_too_long",
            "bytes_invalid_encoding",
            "value_error",
            "assertion_error",
            "literal_error",
            "missing_sentinel_error",
            "date_type",
            "date_parsing",
            "date_from_datetime_parsing",
            "date_from_datetime_inexact",
            "date_past",
            "date_future",
            "time_type",
            "time_parsing",
            "datetime_type",
            "datetime_parsing",
            "datetime_object_invalid",
            "datetime_from_date_parsing",
            "datetime_past",
            "datetime_future",
            "timezone_naive",
            "timezone_aware",
            "timezone_offset",
            "time_delta_type",
            "time_delta_parsing",
            "frozen_set_type",
            "is_instance_of",
            "is_subclass_of",
            "callable_type",
            "union_tag_invalid",
            "union_tag_not_found",
            "arguments_type",
            "missing_argument",
            "unexpected_keyword_argument",
            "missing_keyword_only_argument",
            "unexpected_positional_argument",
            "missing_positional_only_argument",
            "multiple_argument_values",
            "url_type",
            "url_parsing",
            "url_syntax_violation",
            "url_too_long",
            "url_scheme",
            "uuid_type",
            "uuid_parsing",
            "uuid_version",
            "decimal_type",
            "decimal_parsing",
            "decimal_max_digits",
            "decimal_max_places",
            "decimal_whole_digits",
            "complex_type",
            "complex_str_parsing"
          ],
          "type": "string"
        },
        {
          "type": "string"
        }
      ],
      "title": "Type"
    },
    "with_traceback": {
      "default": false,
      "title": "With Traceback",
      "type": "boolean"
    },
    "traceback_md": {
      "default": "",
      "title": "Traceback Md",
      "type": "string"
    },
    "traceback_html": {
      "default": "",
      "title": "Traceback Html",
      "type": "string"
    }
  },
  "required": [
    "loc",
    "msg",
    "type"
  ],
  "title": "ErrorEntry",
  "type": "object"
}

Fields:

loc pydantic-field ¤

loc: Loc

msg pydantic-field ¤

msg: str

traceback_html pydantic-field ¤

traceback_html: str = ''

traceback_md pydantic-field ¤

traceback_md: str = ''

traceback_rich property ¤

traceback_rich: Optional[rich.traceback.Traceback]

type pydantic-field ¤

type: Union[ErrorType, str]

with_traceback pydantic-field ¤

with_traceback: bool = False

model_post_init ¤

model_post_init(__context: Any)
Source code in src/bioimageio/spec/summary.py
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
def model_post_init(self, __context: Any):
    if self.with_traceback and not (self.traceback_md or self.traceback_html):
        self._traceback_rich = rich.traceback.Traceback()
        console = rich.console.Console(
            record=True,
            file=open(os.devnull, "wt", encoding="utf-8"),
            color_system="truecolor",
            width=120,
            tab_size=4,
            soft_wrap=True,
        )
        console.print(self._traceback_rich)
        if not self.traceback_md:
            self.traceback_md = console.export_text(clear=False)

        if not self.traceback_html:
            self.traceback_html = console.export_html(clear=False)

InstalledPackage ¤

Bases: NamedTuple


              flowchart TD
              bioimageio.spec.summary.InstalledPackage[InstalledPackage]

              

              click bioimageio.spec.summary.InstalledPackage href "" "bioimageio.spec.summary.InstalledPackage"
            

Attributes:

Name Type Description
build str
channel str
name str
version str

build class-attribute instance-attribute ¤

build: str = ''

channel class-attribute instance-attribute ¤

channel: str = ''

name instance-attribute ¤

name: str

version instance-attribute ¤

version: str

ValidationDetail pydantic-model ¤

Bases: BaseModel

a detail in a validation summary

Show JSON schema:
{
  "$defs": {
    "CondaEnv": {
      "description": "Represenation of the content of a conda environment.yaml file",
      "properties": {
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Name"
        },
        "channels": {
          "items": {
            "type": "string"
          },
          "title": "Channels",
          "type": "array"
        },
        "dependencies": {
          "items": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "$ref": "#/$defs/PipDeps"
              }
            ]
          },
          "title": "Dependencies",
          "type": "array"
        }
      },
      "title": "CondaEnv",
      "type": "object"
    },
    "ErrorEntry": {
      "description": "An error in a `ValidationDetail`",
      "properties": {
        "loc": {
          "items": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "string"
              }
            ]
          },
          "title": "Loc",
          "type": "array"
        },
        "msg": {
          "title": "Msg",
          "type": "string"
        },
        "type": {
          "anyOf": [
            {
              "enum": [
                "no_such_attribute",
                "json_invalid",
                "json_type",
                "needs_python_object",
                "recursion_loop",
                "missing",
                "frozen_field",
                "frozen_instance",
                "extra_forbidden",
                "invalid_key",
                "get_attribute_error",
                "model_type",
                "model_attributes_type",
                "dataclass_type",
                "dataclass_exact_type",
                "default_factory_not_called",
                "none_required",
                "greater_than",
                "greater_than_equal",
                "less_than",
                "less_than_equal",
                "multiple_of",
                "finite_number",
                "too_short",
                "too_long",
                "iterable_type",
                "iteration_error",
                "string_type",
                "string_sub_type",
                "string_unicode",
                "string_too_short",
                "string_too_long",
                "string_pattern_mismatch",
                "enum",
                "dict_type",
                "mapping_type",
                "list_type",
                "tuple_type",
                "set_type",
                "set_item_not_hashable",
                "bool_type",
                "bool_parsing",
                "int_type",
                "int_parsing",
                "int_parsing_size",
                "int_from_float",
                "float_type",
                "float_parsing",
                "bytes_type",
                "bytes_too_short",
                "bytes_too_long",
                "bytes_invalid_encoding",
                "value_error",
                "assertion_error",
                "literal_error",
                "missing_sentinel_error",
                "date_type",
                "date_parsing",
                "date_from_datetime_parsing",
                "date_from_datetime_inexact",
                "date_past",
                "date_future",
                "time_type",
                "time_parsing",
                "datetime_type",
                "datetime_parsing",
                "datetime_object_invalid",
                "datetime_from_date_parsing",
                "datetime_past",
                "datetime_future",
                "timezone_naive",
                "timezone_aware",
                "timezone_offset",
                "time_delta_type",
                "time_delta_parsing",
                "frozen_set_type",
                "is_instance_of",
                "is_subclass_of",
                "callable_type",
                "union_tag_invalid",
                "union_tag_not_found",
                "arguments_type",
                "missing_argument",
                "unexpected_keyword_argument",
                "missing_keyword_only_argument",
                "unexpected_positional_argument",
                "missing_positional_only_argument",
                "multiple_argument_values",
                "url_type",
                "url_parsing",
                "url_syntax_violation",
                "url_too_long",
                "url_scheme",
                "uuid_type",
                "uuid_parsing",
                "uuid_version",
                "decimal_type",
                "decimal_parsing",
                "decimal_max_digits",
                "decimal_max_places",
                "decimal_whole_digits",
                "complex_type",
                "complex_str_parsing"
              ],
              "type": "string"
            },
            {
              "type": "string"
            }
          ],
          "title": "Type"
        },
        "with_traceback": {
          "default": false,
          "title": "With Traceback",
          "type": "boolean"
        },
        "traceback_md": {
          "default": "",
          "title": "Traceback Md",
          "type": "string"
        },
        "traceback_html": {
          "default": "",
          "title": "Traceback Html",
          "type": "string"
        }
      },
      "required": [
        "loc",
        "msg",
        "type"
      ],
      "title": "ErrorEntry",
      "type": "object"
    },
    "PipDeps": {
      "description": "Pip dependencies to include in conda dependecies",
      "properties": {
        "pip": {
          "items": {
            "type": "string"
          },
          "title": "Pip",
          "type": "array"
        }
      },
      "title": "PipDeps",
      "type": "object"
    },
    "ValidationContextSummary": {
      "additionalProperties": false,
      "properties": {
        "file_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "File Name"
        },
        "original_source_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Original Source Name"
        },
        "perform_io_checks": {
          "default": true,
          "title": "Perform Io Checks",
          "type": "boolean"
        },
        "known_files": {
          "additionalProperties": {
            "anyOf": [
              {
                "description": "A SHA-256 hash value",
                "maxLength": 64,
                "minLength": 64,
                "title": "Sha256",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "title": "Known Files",
          "type": "object"
        },
        "update_hashes": {
          "default": false,
          "title": "Update Hashes",
          "type": "boolean"
        },
        "root": {
          "anyOf": [
            {
              "description": "An untested HTTP URL, possibly a 'URL folder' or an invalid HTTP URL",
              "format": "uri",
              "maxLength": 2083,
              "minLength": 1,
              "title": "RootHttpUrl",
              "type": "string"
            },
            {
              "format": "path",
              "type": "string"
            },
            {
              "const": "in-memory",
              "type": "string"
            }
          ],
          "default": ".",
          "title": "Root"
        }
      },
      "title": "ValidationContextSummary",
      "type": "object"
    },
    "WarningEntry": {
      "description": "A warning in a `ValidationDetail`",
      "properties": {
        "loc": {
          "items": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "string"
              }
            ]
          },
          "title": "Loc",
          "type": "array"
        },
        "msg": {
          "title": "Msg",
          "type": "string"
        },
        "type": {
          "anyOf": [
            {
              "enum": [
                "no_such_attribute",
                "json_invalid",
                "json_type",
                "needs_python_object",
                "recursion_loop",
                "missing",
                "frozen_field",
                "frozen_instance",
                "extra_forbidden",
                "invalid_key",
                "get_attribute_error",
                "model_type",
                "model_attributes_type",
                "dataclass_type",
                "dataclass_exact_type",
                "default_factory_not_called",
                "none_required",
                "greater_than",
                "greater_than_equal",
                "less_than",
                "less_than_equal",
                "multiple_of",
                "finite_number",
                "too_short",
                "too_long",
                "iterable_type",
                "iteration_error",
                "string_type",
                "string_sub_type",
                "string_unicode",
                "string_too_short",
                "string_too_long",
                "string_pattern_mismatch",
                "enum",
                "dict_type",
                "mapping_type",
                "list_type",
                "tuple_type",
                "set_type",
                "set_item_not_hashable",
                "bool_type",
                "bool_parsing",
                "int_type",
                "int_parsing",
                "int_parsing_size",
                "int_from_float",
                "float_type",
                "float_parsing",
                "bytes_type",
                "bytes_too_short",
                "bytes_too_long",
                "bytes_invalid_encoding",
                "value_error",
                "assertion_error",
                "literal_error",
                "missing_sentinel_error",
                "date_type",
                "date_parsing",
                "date_from_datetime_parsing",
                "date_from_datetime_inexact",
                "date_past",
                "date_future",
                "time_type",
                "time_parsing",
                "datetime_type",
                "datetime_parsing",
                "datetime_object_invalid",
                "datetime_from_date_parsing",
                "datetime_past",
                "datetime_future",
                "timezone_naive",
                "timezone_aware",
                "timezone_offset",
                "time_delta_type",
                "time_delta_parsing",
                "frozen_set_type",
                "is_instance_of",
                "is_subclass_of",
                "callable_type",
                "union_tag_invalid",
                "union_tag_not_found",
                "arguments_type",
                "missing_argument",
                "unexpected_keyword_argument",
                "missing_keyword_only_argument",
                "unexpected_positional_argument",
                "missing_positional_only_argument",
                "multiple_argument_values",
                "url_type",
                "url_parsing",
                "url_syntax_violation",
                "url_too_long",
                "url_scheme",
                "uuid_type",
                "uuid_parsing",
                "uuid_version",
                "decimal_type",
                "decimal_parsing",
                "decimal_max_digits",
                "decimal_max_places",
                "decimal_whole_digits",
                "complex_type",
                "complex_str_parsing"
              ],
              "type": "string"
            },
            {
              "type": "string"
            }
          ],
          "title": "Type"
        },
        "severity": {
          "default": 30,
          "enum": [
            20,
            30,
            35
          ],
          "title": "Severity",
          "type": "integer"
        }
      },
      "required": [
        "loc",
        "msg",
        "type"
      ],
      "title": "WarningEntry",
      "type": "object"
    }
  },
  "additionalProperties": true,
  "description": "a detail in a validation summary",
  "properties": {
    "name": {
      "title": "Name",
      "type": "string"
    },
    "status": {
      "enum": [
        "passed",
        "failed"
      ],
      "title": "Status",
      "type": "string"
    },
    "loc": {
      "default": [],
      "items": {
        "anyOf": [
          {
            "type": "integer"
          },
          {
            "type": "string"
          }
        ]
      },
      "title": "Loc",
      "type": "array"
    },
    "errors": {
      "items": {
        "$ref": "#/$defs/ErrorEntry"
      },
      "title": "Errors",
      "type": "array"
    },
    "warnings": {
      "items": {
        "$ref": "#/$defs/WarningEntry"
      },
      "title": "Warnings",
      "type": "array"
    },
    "context": {
      "anyOf": [
        {
          "$ref": "#/$defs/ValidationContextSummary"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "recommended_env": {
      "anyOf": [
        {
          "$ref": "#/$defs/CondaEnv"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "saved_conda_compare": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Saved Conda Compare"
    }
  },
  "required": [
    "name",
    "status"
  ],
  "title": "ValidationDetail",
  "type": "object"
}

Fields:

Validators:

  • _load_legacy

conda_compare property ¤

conda_compare: Optional[str]

context pydantic-field ¤

context: Optional[ValidationContextSummary] = None

errors pydantic-field ¤

errors: List[ErrorEntry]

loc pydantic-field ¤

loc: Loc = ()

location in the RDF that this detail applies to

name pydantic-field ¤

name: str

recommended_env pydantic-field ¤

recommended_env: Optional[CondaEnv] = None

recommended conda environemnt for this validation detail

saved_conda_compare pydantic-field ¤

saved_conda_compare: Optional[str] = None

output of conda compare <recommended env>

status pydantic-field ¤

status: Literal['passed', 'failed']

status_icon property ¤

status_icon: str

warnings pydantic-field ¤

warnings: List[WarningEntry]

ValidationEntry pydantic-model ¤

Bases: BaseModel

Base of ErrorEntry and WarningEntry

Show JSON schema:
{
  "description": "Base of `ErrorEntry` and `WarningEntry`",
  "properties": {
    "loc": {
      "items": {
        "anyOf": [
          {
            "type": "integer"
          },
          {
            "type": "string"
          }
        ]
      },
      "title": "Loc",
      "type": "array"
    },
    "msg": {
      "title": "Msg",
      "type": "string"
    },
    "type": {
      "anyOf": [
        {
          "enum": [
            "no_such_attribute",
            "json_invalid",
            "json_type",
            "needs_python_object",
            "recursion_loop",
            "missing",
            "frozen_field",
            "frozen_instance",
            "extra_forbidden",
            "invalid_key",
            "get_attribute_error",
            "model_type",
            "model_attributes_type",
            "dataclass_type",
            "dataclass_exact_type",
            "default_factory_not_called",
            "none_required",
            "greater_than",
            "greater_than_equal",
            "less_than",
            "less_than_equal",
            "multiple_of",
            "finite_number",
            "too_short",
            "too_long",
            "iterable_type",
            "iteration_error",
            "string_type",
            "string_sub_type",
            "string_unicode",
            "string_too_short",
            "string_too_long",
            "string_pattern_mismatch",
            "enum",
            "dict_type",
            "mapping_type",
            "list_type",
            "tuple_type",
            "set_type",
            "set_item_not_hashable",
            "bool_type",
            "bool_parsing",
            "int_type",
            "int_parsing",
            "int_parsing_size",
            "int_from_float",
            "float_type",
            "float_parsing",
            "bytes_type",
            "bytes_too_short",
            "bytes_too_long",
            "bytes_invalid_encoding",
            "value_error",
            "assertion_error",
            "literal_error",
            "missing_sentinel_error",
            "date_type",
            "date_parsing",
            "date_from_datetime_parsing",
            "date_from_datetime_inexact",
            "date_past",
            "date_future",
            "time_type",
            "time_parsing",
            "datetime_type",
            "datetime_parsing",
            "datetime_object_invalid",
            "datetime_from_date_parsing",
            "datetime_past",
            "datetime_future",
            "timezone_naive",
            "timezone_aware",
            "timezone_offset",
            "time_delta_type",
            "time_delta_parsing",
            "frozen_set_type",
            "is_instance_of",
            "is_subclass_of",
            "callable_type",
            "union_tag_invalid",
            "union_tag_not_found",
            "arguments_type",
            "missing_argument",
            "unexpected_keyword_argument",
            "missing_keyword_only_argument",
            "unexpected_positional_argument",
            "missing_positional_only_argument",
            "multiple_argument_values",
            "url_type",
            "url_parsing",
            "url_syntax_violation",
            "url_too_long",
            "url_scheme",
            "uuid_type",
            "uuid_parsing",
            "uuid_version",
            "decimal_type",
            "decimal_parsing",
            "decimal_max_digits",
            "decimal_max_places",
            "decimal_whole_digits",
            "complex_type",
            "complex_str_parsing"
          ],
          "type": "string"
        },
        {
          "type": "string"
        }
      ],
      "title": "Type"
    }
  },
  "required": [
    "loc",
    "msg",
    "type"
  ],
  "title": "ValidationEntry",
  "type": "object"
}

Fields:

loc pydantic-field ¤

loc: Loc

msg pydantic-field ¤

msg: str

type pydantic-field ¤

type: Union[ErrorType, str]

ValidationSummary pydantic-model ¤

Bases: BaseModel

Summarizes output of all bioimageio validations and tests for one specific ResourceDescr instance.

Show JSON schema:
{
  "$defs": {
    "CondaEnv": {
      "description": "Represenation of the content of a conda environment.yaml file",
      "properties": {
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Name"
        },
        "channels": {
          "items": {
            "type": "string"
          },
          "title": "Channels",
          "type": "array"
        },
        "dependencies": {
          "items": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "$ref": "#/$defs/PipDeps"
              }
            ]
          },
          "title": "Dependencies",
          "type": "array"
        }
      },
      "title": "CondaEnv",
      "type": "object"
    },
    "ErrorEntry": {
      "description": "An error in a `ValidationDetail`",
      "properties": {
        "loc": {
          "items": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "string"
              }
            ]
          },
          "title": "Loc",
          "type": "array"
        },
        "msg": {
          "title": "Msg",
          "type": "string"
        },
        "type": {
          "anyOf": [
            {
              "enum": [
                "no_such_attribute",
                "json_invalid",
                "json_type",
                "needs_python_object",
                "recursion_loop",
                "missing",
                "frozen_field",
                "frozen_instance",
                "extra_forbidden",
                "invalid_key",
                "get_attribute_error",
                "model_type",
                "model_attributes_type",
                "dataclass_type",
                "dataclass_exact_type",
                "default_factory_not_called",
                "none_required",
                "greater_than",
                "greater_than_equal",
                "less_than",
                "less_than_equal",
                "multiple_of",
                "finite_number",
                "too_short",
                "too_long",
                "iterable_type",
                "iteration_error",
                "string_type",
                "string_sub_type",
                "string_unicode",
                "string_too_short",
                "string_too_long",
                "string_pattern_mismatch",
                "enum",
                "dict_type",
                "mapping_type",
                "list_type",
                "tuple_type",
                "set_type",
                "set_item_not_hashable",
                "bool_type",
                "bool_parsing",
                "int_type",
                "int_parsing",
                "int_parsing_size",
                "int_from_float",
                "float_type",
                "float_parsing",
                "bytes_type",
                "bytes_too_short",
                "bytes_too_long",
                "bytes_invalid_encoding",
                "value_error",
                "assertion_error",
                "literal_error",
                "missing_sentinel_error",
                "date_type",
                "date_parsing",
                "date_from_datetime_parsing",
                "date_from_datetime_inexact",
                "date_past",
                "date_future",
                "time_type",
                "time_parsing",
                "datetime_type",
                "datetime_parsing",
                "datetime_object_invalid",
                "datetime_from_date_parsing",
                "datetime_past",
                "datetime_future",
                "timezone_naive",
                "timezone_aware",
                "timezone_offset",
                "time_delta_type",
                "time_delta_parsing",
                "frozen_set_type",
                "is_instance_of",
                "is_subclass_of",
                "callable_type",
                "union_tag_invalid",
                "union_tag_not_found",
                "arguments_type",
                "missing_argument",
                "unexpected_keyword_argument",
                "missing_keyword_only_argument",
                "unexpected_positional_argument",
                "missing_positional_only_argument",
                "multiple_argument_values",
                "url_type",
                "url_parsing",
                "url_syntax_violation",
                "url_too_long",
                "url_scheme",
                "uuid_type",
                "uuid_parsing",
                "uuid_version",
                "decimal_type",
                "decimal_parsing",
                "decimal_max_digits",
                "decimal_max_places",
                "decimal_whole_digits",
                "complex_type",
                "complex_str_parsing"
              ],
              "type": "string"
            },
            {
              "type": "string"
            }
          ],
          "title": "Type"
        },
        "with_traceback": {
          "default": false,
          "title": "With Traceback",
          "type": "boolean"
        },
        "traceback_md": {
          "default": "",
          "title": "Traceback Md",
          "type": "string"
        },
        "traceback_html": {
          "default": "",
          "title": "Traceback Html",
          "type": "string"
        }
      },
      "required": [
        "loc",
        "msg",
        "type"
      ],
      "title": "ErrorEntry",
      "type": "object"
    },
    "InstalledPackage": {
      "maxItems": 4,
      "minItems": 2,
      "prefixItems": [
        {
          "title": "Name",
          "type": "string"
        },
        {
          "title": "Version",
          "type": "string"
        },
        {
          "default": "",
          "title": "Build",
          "type": "string"
        },
        {
          "default": "",
          "title": "Channel",
          "type": "string"
        }
      ],
      "type": "array"
    },
    "PipDeps": {
      "description": "Pip dependencies to include in conda dependecies",
      "properties": {
        "pip": {
          "items": {
            "type": "string"
          },
          "title": "Pip",
          "type": "array"
        }
      },
      "title": "PipDeps",
      "type": "object"
    },
    "ValidationContextSummary": {
      "additionalProperties": false,
      "properties": {
        "file_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "File Name"
        },
        "original_source_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Original Source Name"
        },
        "perform_io_checks": {
          "default": true,
          "title": "Perform Io Checks",
          "type": "boolean"
        },
        "known_files": {
          "additionalProperties": {
            "anyOf": [
              {
                "description": "A SHA-256 hash value",
                "maxLength": 64,
                "minLength": 64,
                "title": "Sha256",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "title": "Known Files",
          "type": "object"
        },
        "update_hashes": {
          "default": false,
          "title": "Update Hashes",
          "type": "boolean"
        },
        "root": {
          "anyOf": [
            {
              "description": "An untested HTTP URL, possibly a 'URL folder' or an invalid HTTP URL",
              "format": "uri",
              "maxLength": 2083,
              "minLength": 1,
              "title": "RootHttpUrl",
              "type": "string"
            },
            {
              "format": "path",
              "type": "string"
            },
            {
              "const": "in-memory",
              "type": "string"
            }
          ],
          "default": ".",
          "title": "Root"
        }
      },
      "title": "ValidationContextSummary",
      "type": "object"
    },
    "ValidationDetail": {
      "additionalProperties": true,
      "description": "a detail in a validation summary",
      "properties": {
        "name": {
          "title": "Name",
          "type": "string"
        },
        "status": {
          "enum": [
            "passed",
            "failed"
          ],
          "title": "Status",
          "type": "string"
        },
        "loc": {
          "default": [],
          "items": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "string"
              }
            ]
          },
          "title": "Loc",
          "type": "array"
        },
        "errors": {
          "items": {
            "$ref": "#/$defs/ErrorEntry"
          },
          "title": "Errors",
          "type": "array"
        },
        "warnings": {
          "items": {
            "$ref": "#/$defs/WarningEntry"
          },
          "title": "Warnings",
          "type": "array"
        },
        "context": {
          "anyOf": [
            {
              "$ref": "#/$defs/ValidationContextSummary"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "recommended_env": {
          "anyOf": [
            {
              "$ref": "#/$defs/CondaEnv"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "saved_conda_compare": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Saved Conda Compare"
        }
      },
      "required": [
        "name",
        "status"
      ],
      "title": "ValidationDetail",
      "type": "object"
    },
    "Version": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "integer"
        },
        {
          "type": "number"
        }
      ],
      "description": "wraps a packaging.version.Version instance for validation in pydantic models",
      "title": "Version"
    },
    "WarningEntry": {
      "description": "A warning in a `ValidationDetail`",
      "properties": {
        "loc": {
          "items": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "string"
              }
            ]
          },
          "title": "Loc",
          "type": "array"
        },
        "msg": {
          "title": "Msg",
          "type": "string"
        },
        "type": {
          "anyOf": [
            {
              "enum": [
                "no_such_attribute",
                "json_invalid",
                "json_type",
                "needs_python_object",
                "recursion_loop",
                "missing",
                "frozen_field",
                "frozen_instance",
                "extra_forbidden",
                "invalid_key",
                "get_attribute_error",
                "model_type",
                "model_attributes_type",
                "dataclass_type",
                "dataclass_exact_type",
                "default_factory_not_called",
                "none_required",
                "greater_than",
                "greater_than_equal",
                "less_than",
                "less_than_equal",
                "multiple_of",
                "finite_number",
                "too_short",
                "too_long",
                "iterable_type",
                "iteration_error",
                "string_type",
                "string_sub_type",
                "string_unicode",
                "string_too_short",
                "string_too_long",
                "string_pattern_mismatch",
                "enum",
                "dict_type",
                "mapping_type",
                "list_type",
                "tuple_type",
                "set_type",
                "set_item_not_hashable",
                "bool_type",
                "bool_parsing",
                "int_type",
                "int_parsing",
                "int_parsing_size",
                "int_from_float",
                "float_type",
                "float_parsing",
                "bytes_type",
                "bytes_too_short",
                "bytes_too_long",
                "bytes_invalid_encoding",
                "value_error",
                "assertion_error",
                "literal_error",
                "missing_sentinel_error",
                "date_type",
                "date_parsing",
                "date_from_datetime_parsing",
                "date_from_datetime_inexact",
                "date_past",
                "date_future",
                "time_type",
                "time_parsing",
                "datetime_type",
                "datetime_parsing",
                "datetime_object_invalid",
                "datetime_from_date_parsing",
                "datetime_past",
                "datetime_future",
                "timezone_naive",
                "timezone_aware",
                "timezone_offset",
                "time_delta_type",
                "time_delta_parsing",
                "frozen_set_type",
                "is_instance_of",
                "is_subclass_of",
                "callable_type",
                "union_tag_invalid",
                "union_tag_not_found",
                "arguments_type",
                "missing_argument",
                "unexpected_keyword_argument",
                "missing_keyword_only_argument",
                "unexpected_positional_argument",
                "missing_positional_only_argument",
                "multiple_argument_values",
                "url_type",
                "url_parsing",
                "url_syntax_violation",
                "url_too_long",
                "url_scheme",
                "uuid_type",
                "uuid_parsing",
                "uuid_version",
                "decimal_type",
                "decimal_parsing",
                "decimal_max_digits",
                "decimal_max_places",
                "decimal_whole_digits",
                "complex_type",
                "complex_str_parsing"
              ],
              "type": "string"
            },
            {
              "type": "string"
            }
          ],
          "title": "Type"
        },
        "severity": {
          "default": 30,
          "enum": [
            20,
            30,
            35
          ],
          "title": "Severity",
          "type": "integer"
        }
      },
      "required": [
        "loc",
        "msg",
        "type"
      ],
      "title": "WarningEntry",
      "type": "object"
    }
  },
  "additionalProperties": true,
  "description": "Summarizes output of all bioimageio validations and tests\nfor one specific `ResourceDescr` instance.",
  "properties": {
    "name": {
      "title": "Name",
      "type": "string"
    },
    "source_name": {
      "title": "Source Name",
      "type": "string"
    },
    "id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Id"
    },
    "version": {
      "anyOf": [
        {
          "$ref": "#/$defs/Version"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "type": {
      "title": "Type",
      "type": "string"
    },
    "format_version": {
      "title": "Format Version",
      "type": "string"
    },
    "status": {
      "enum": [
        "passed",
        "valid-format",
        "failed"
      ],
      "title": "Status",
      "type": "string"
    },
    "metadata_completeness": {
      "default": 0.0,
      "maximum": 1,
      "minimum": 0,
      "title": "Metadata Completeness",
      "type": "number"
    },
    "details": {
      "items": {
        "$ref": "#/$defs/ValidationDetail"
      },
      "title": "Details",
      "type": "array"
    },
    "env": {
      "items": {
        "$ref": "#/$defs/InstalledPackage"
      },
      "title": "Env",
      "type": "array",
      "uniqueItems": true
    },
    "saved_conda_list": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Saved Conda List"
    }
  },
  "required": [
    "name",
    "source_name",
    "type",
    "format_version",
    "status",
    "details"
  ],
  "title": "ValidationSummary",
  "type": "object"
}

Fields:

Validators:

  • _convert_old_envenv

conda_list property ¤

conda_list: str

details pydantic-field ¤

details: List[ValidationDetail]

List of validation details

env pydantic-field ¤

env: Set[InstalledPackage]

List of selected, relevant package versions

errors property ¤

errors: List[ErrorEntry]

format_version pydantic-field ¤

format_version: str

Format version of the validated resource

id pydantic-field ¤

id: Optional[str] = None

ID of the validated resource

metadata_completeness pydantic-field ¤

metadata_completeness: Annotated[
    float, annotated_types.Interval(ge=0, le=1)
] = 0.0

Estimate of completeness of the metadata in the resource description.

This completeness estimate may change with subsequent releases

and should be considered bioimageio.spec version specific.

name pydantic-field ¤

name: str

Name of the validation

saved_conda_list pydantic-field ¤

saved_conda_list: Optional[str] = None

source_name pydantic-field ¤

source_name: str

Source of the validated bioimageio description

status pydantic-field ¤

status: Literal['passed', 'valid-format', 'failed']

Overall status of the bioimageio validation

status_icon property ¤

status_icon: str

type pydantic-field ¤

type: str

Type of the validated resource

version pydantic-field ¤

version: Optional[Version] = None

Version of the validated resource

warnings property ¤

warnings: List[WarningEntry]

add_detail ¤

add_detail(
    detail: ValidationDetail, update_status: bool = True
) -> None
Source code in src/bioimageio/spec/summary.py
411
412
413
414
415
416
417
418
419
420
421
def add_detail(self, detail: ValidationDetail, update_status: bool = True) -> None:
    if update_status:
        if self.status == "valid-format" and detail.status == "passed":
            # once status is 'valid-format' we can only improve to 'passed'
            self.status = "passed"
        elif self.status == "passed" and detail.status == "failed":
            # once status is 'passed' it can only degrade to 'valid-format'
            self.status = "valid-format"
        # once format is 'failed' it cannot improve

    self.details.append(detail)

display ¤

display(
    *,
    width: Optional[int] = None,
    include_conda_list: bool = False,
    tab_size: int = 4,
    soft_wrap: bool = True,
) -> None
Source code in src/bioimageio/spec/summary.py
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
def display(
    self,
    *,
    width: Optional[int] = None,
    include_conda_list: bool = False,
    tab_size: int = 4,
    soft_wrap: bool = True,
) -> None:
    try:  # render as HTML in Jupyter notebook
        from IPython.core.getipython import get_ipython
        from IPython.display import (
            display_html,  # pyright: ignore[reportUnknownVariableType]
        )
    except ImportError:
        pass
    else:
        if get_ipython() is not None:
            _ = display_html(
                self.format_html(
                    width=width, include_conda_list=include_conda_list
                ),
                raw=True,
            )
            return

    # render with rich
    _ = self._format(
        target=rich.console.Console(
            width=width,
            tab_size=tab_size,
            soft_wrap=soft_wrap,
        ),
        width=width,
        include_conda_list=include_conda_list,
    )

format ¤

format(
    *,
    width: Optional[int] = None,
    include_conda_list: bool = False,
) -> str

Format summary as Markdown string (alias to format_md)

Source code in src/bioimageio/spec/summary.py
342
343
344
345
346
347
348
349
def format(
    self,
    *,
    width: Optional[int] = None,
    include_conda_list: bool = False,
) -> str:
    """Format summary as Markdown string (alias to `format_md`)"""
    return self.format_md(width=width, include_conda_list=include_conda_list)

format_html ¤

format_html(
    *,
    width: Optional[int] = None,
    include_conda_list: bool = False,
) -> str
Source code in src/bioimageio/spec/summary.py
362
363
364
365
366
367
368
369
370
371
372
373
def format_html(
    self,
    *,
    width: Optional[int] = None,
    include_conda_list: bool = False,
) -> str:
    md_with_html = self._format(
        target="html", width=width, include_conda_list=include_conda_list
    )
    return markdown.markdown(
        md_with_html, extensions=["tables", "fenced_code", "nl2br"]
    )

format_md ¤

format_md(
    *,
    width: Optional[int] = None,
    include_conda_list: bool = False,
) -> str

Format summary as Markdown string

Source code in src/bioimageio/spec/summary.py
351
352
353
354
355
356
357
358
359
360
def format_md(
    self,
    *,
    width: Optional[int] = None,
    include_conda_list: bool = False,
) -> str:
    """Format summary as Markdown string"""
    return self._format(
        width=width, target="md", include_conda_list=include_conda_list
    )

load_json classmethod ¤

load_json(path: Path) -> Self

Load validation/test summary from a suitable JSON file

Source code in src/bioimageio/spec/summary.py
512
513
514
515
516
@classmethod
def load_json(cls, path: Path) -> Self:
    """Load validation/test summary from a suitable JSON file"""
    json_str = Path(path).read_text(encoding="utf-8")
    return cls.model_validate_json(json_str)

log ¤

log(
    to: Union[
        Literal["display"],
        Path,
        Sequence[Union[Literal["display"], Path]],
    ],
) -> List[Path]

Convenience method to display the validation summary in the terminal and/or save it to disk. See save for details.

Source code in src/bioimageio/spec/summary.py
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
def log(
    self,
    to: Union[Literal["display"], Path, Sequence[Union[Literal["display"], Path]]],
) -> List[Path]:
    """Convenience method to display the validation summary in the terminal and/or
    save it to disk. See `save` for details."""
    if to == "display":
        display = True
        save_to = []
    elif isinstance(to, Path):
        display = False
        save_to = [to]
    else:
        display = "display" in to
        save_to = [p for p in to if p != "display"]

    if display:
        self.display()

    return self.save(save_to)

save ¤

save(
    path: Union[Path, Sequence[Path]] = Path(
        "{id}_summary_{now}"
    ),
) -> List[Path]

Save the validation/test summary in JSON, Markdown or HTML format.

Returns:

Type Description
List[Path]

List of file paths the summary was saved to.

Notes: - Format is chosen based on the suffix: .json, .md, .html. - If path has no suffix it is assumed to be a direcotry to which a summary.json, summary.md and summary.html are saved to.

Source code in src/bioimageio/spec/summary.py
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
def save(
    self, path: Union[Path, Sequence[Path]] = Path("{id}_summary_{now}")
) -> List[Path]:
    """Save the validation/test summary in JSON, Markdown or HTML format.

    Returns:
        List of file paths the summary was saved to.

    Notes:
    - Format is chosen based on the suffix: `.json`, `.md`, `.html`.
    - If **path** has no suffix it is assumed to be a direcotry to which a
      `summary.json`, `summary.md` and `summary.html` are saved to.
    """
    if isinstance(path, (str, Path)):
        path = [Path(path)]

    # folder to file paths
    file_paths: List[Path] = []
    for p in path:
        if p.suffix:
            file_paths.append(p)
        else:
            file_paths.extend(
                [
                    p / "summary.json",
                    p / "summary.md",
                    p / "summary.html",
                ]
            )

    now = datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ")
    for p in file_paths:
        p = Path(str(p).format(id=self.id or "bioimageio", now=now))
        if p.suffix == ".json":
            self.save_json(p)
        elif p.suffix == ".md":
            self.save_markdown(p)
        elif p.suffix == ".html":
            self.save_html(p)
        else:
            raise ValueError(f"Unknown summary path suffix '{p.suffix}'")

    return file_paths

save_html ¤

save_html(path: Path = Path('summary.html')) -> None

Save rendered validation/test summary as HTML file.

Source code in src/bioimageio/spec/summary.py
504
505
506
507
508
509
510
def save_html(self, path: Path = Path("summary.html")) -> None:
    """Save rendered validation/test summary as HTML file."""
    path.parent.mkdir(exist_ok=True, parents=True)

    html = self.format_html()
    _ = path.write_text(html, encoding="utf-8")
    logger.info("Saved HTML formatted summary to {}", path.absolute())

save_json ¤

save_json(
    path: Path = Path("summary.json"),
    *,
    indent: Optional[int] = 2,
) -> None

Save validation/test summary as JSON file.

Source code in src/bioimageio/spec/summary.py
488
489
490
491
492
493
494
495
def save_json(
    self, path: Path = Path("summary.json"), *, indent: Optional[int] = 2
) -> None:
    """Save validation/test summary as JSON file."""
    json_str = self.model_dump_json(indent=indent)
    path.parent.mkdir(exist_ok=True, parents=True)
    _ = path.write_text(json_str, encoding="utf-8")
    logger.info("Saved summary to {}", path.absolute())

save_markdown ¤

save_markdown(path: Path = Path('summary.md')) -> None

Save rendered validation/test summary as Markdown file.

Source code in src/bioimageio/spec/summary.py
497
498
499
500
501
502
def save_markdown(self, path: Path = Path("summary.md")) -> None:
    """Save rendered validation/test summary as Markdown file."""
    formatted = self.format_md()
    path.parent.mkdir(exist_ok=True, parents=True)
    _ = path.write_text(formatted, encoding="utf-8")
    logger.info("Saved Markdown formatted summary to {}", path.absolute())

WarningEntry pydantic-model ¤

Bases: ValidationEntry

A warning in a ValidationDetail

Show JSON schema:
{
  "description": "A warning in a `ValidationDetail`",
  "properties": {
    "loc": {
      "items": {
        "anyOf": [
          {
            "type": "integer"
          },
          {
            "type": "string"
          }
        ]
      },
      "title": "Loc",
      "type": "array"
    },
    "msg": {
      "title": "Msg",
      "type": "string"
    },
    "type": {
      "anyOf": [
        {
          "enum": [
            "no_such_attribute",
            "json_invalid",
            "json_type",
            "needs_python_object",
            "recursion_loop",
            "missing",
            "frozen_field",
            "frozen_instance",
            "extra_forbidden",
            "invalid_key",
            "get_attribute_error",
            "model_type",
            "model_attributes_type",
            "dataclass_type",
            "dataclass_exact_type",
            "default_factory_not_called",
            "none_required",
            "greater_than",
            "greater_than_equal",
            "less_than",
            "less_than_equal",
            "multiple_of",
            "finite_number",
            "too_short",
            "too_long",
            "iterable_type",
            "iteration_error",
            "string_type",
            "string_sub_type",
            "string_unicode",
            "string_too_short",
            "string_too_long",
            "string_pattern_mismatch",
            "enum",
            "dict_type",
            "mapping_type",
            "list_type",
            "tuple_type",
            "set_type",
            "set_item_not_hashable",
            "bool_type",
            "bool_parsing",
            "int_type",
            "int_parsing",
            "int_parsing_size",
            "int_from_float",
            "float_type",
            "float_parsing",
            "bytes_type",
            "bytes_too_short",
            "bytes_too_long",
            "bytes_invalid_encoding",
            "value_error",
            "assertion_error",
            "literal_error",
            "missing_sentinel_error",
            "date_type",
            "date_parsing",
            "date_from_datetime_parsing",
            "date_from_datetime_inexact",
            "date_past",
            "date_future",
            "time_type",
            "time_parsing",
            "datetime_type",
            "datetime_parsing",
            "datetime_object_invalid",
            "datetime_from_date_parsing",
            "datetime_past",
            "datetime_future",
            "timezone_naive",
            "timezone_aware",
            "timezone_offset",
            "time_delta_type",
            "time_delta_parsing",
            "frozen_set_type",
            "is_instance_of",
            "is_subclass_of",
            "callable_type",
            "union_tag_invalid",
            "union_tag_not_found",
            "arguments_type",
            "missing_argument",
            "unexpected_keyword_argument",
            "missing_keyword_only_argument",
            "unexpected_positional_argument",
            "missing_positional_only_argument",
            "multiple_argument_values",
            "url_type",
            "url_parsing",
            "url_syntax_violation",
            "url_too_long",
            "url_scheme",
            "uuid_type",
            "uuid_parsing",
            "uuid_version",
            "decimal_type",
            "decimal_parsing",
            "decimal_max_digits",
            "decimal_max_places",
            "decimal_whole_digits",
            "complex_type",
            "complex_str_parsing"
          ],
          "type": "string"
        },
        {
          "type": "string"
        }
      ],
      "title": "Type"
    },
    "severity": {
      "default": 30,
      "enum": [
        20,
        30,
        35
      ],
      "title": "Severity",
      "type": "integer"
    }
  },
  "required": [
    "loc",
    "msg",
    "type"
  ],
  "title": "WarningEntry",
  "type": "object"
}

Fields:

loc pydantic-field ¤

loc: Loc

msg pydantic-field ¤

msg: str

severity pydantic-field ¤

severity: WarningSeverity = WARNING

severity_name property ¤

severity_name: WarningSeverityName

type pydantic-field ¤

type: Union[ErrorType, str]

format_loc ¤

format_loc(
    loc: Loc,
    target: Union[
        Literal["md", "html", "plain"], rich.console.Console
    ],
) -> str

helper to format a location tuple loc

Source code in src/bioimageio/spec/summary.py
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
def format_loc(
    loc: Loc, target: Union[Literal["md", "html", "plain"], rich.console.Console]
) -> str:
    """helper to format a location tuple **loc**"""
    loc_str = ".".join(f"({x})" if x[0].isupper() else x for x in map(str, loc))

    # additional field validation can make the location information quite convoluted, e.g.
    # `weights.pytorch_state_dict.dependencies.source.function-after[validate_url_ok(), url['http','https']]` Input should be a valid URL, relative URL without a base
    # therefore we remove the `.function-after[validate_url_ok(), url['http','https']]` here
    loc_str, *_ = loc_str.split(".function-after")
    if loc_str:
        if target == "md" or isinstance(target, rich.console.Console):
            start = "`"
            end = "`"
        elif target == "html":
            start = "<code>"
            end = "</code>"
        elif target == "plain":
            start = ""
            end = ""
        else:
            assert_never(target)

        return f"{start}{loc_str}{end}"
    else:
        return ""