bioimageio.spec.generic

implementaions of all released minor versions are available in submodules:

 1# autogen: start
 2"""
 3implementaions of all released minor versions are available in submodules:
 4- generic v0_2: `bioimageio.spec.generic.v0_2.GenericDescr`
 5- generic v0_3: `bioimageio.spec.generic.v0_3.GenericDescr`
 6"""
 7
 8from typing import Union
 9
10from pydantic import Discriminator
11from typing_extensions import Annotated
12
13from . import v0_2, v0_3
14
15GenericDescr = v0_3.GenericDescr
16GenericDescr_v0_2 = v0_2.GenericDescr
17GenericDescr_v0_3 = v0_3.GenericDescr
18
19AnyGenericDescr = Annotated[
20    Union[GenericDescr_v0_2, GenericDescr_v0_3], Discriminator("format_version")
21]
22"""Union of any released generic desription"""
23# autogen: stop
class GenericDescr(bioimageio.spec.generic.v0_3.GenericDescrBase):
410class GenericDescr(
411    GenericDescrBase, extra="ignore", title="bioimage.io generic specification"
412):
413    """Specification of the fields used in a generic bioimage.io-compliant resource description file (RDF).
414
415    An RDF is a YAML file that describes a resource such as a model, a dataset, or a notebook.
416    Note that those resources are described with a type-specific RDF.
417    Use this generic resource description, if none of the known specific types matches your resource.
418    """
419
420    type: Annotated[str, LowerCase] = Field("generic", frozen=True)
421    """The resource type assigns a broad category to the resource."""
422
423    id: Optional[ResourceId] = None
424    """bioimage.io-wide unique resource identifier
425    assigned by bioimage.io; version **un**specific."""
426
427    parent: Optional[ResourceId] = None
428    """The description from which this one is derived"""
429
430    source: Optional[HttpUrl] = None
431    """The primary source of the resource"""
432
433    @field_validator("type", mode="after")
434    @classmethod
435    def check_specific_types(cls, value: str) -> str:
436        if value in KNOWN_SPECIFIC_RESOURCE_TYPES:
437            raise ValueError(
438                f"Use the {value} description instead of this generic description for"
439                + f" your '{value}' resource."
440            )
441
442        return value

Specification of the fields used in a generic bioimage.io-compliant resource description file (RDF).

An RDF is a YAML file that describes a resource such as a model, a dataset, or a notebook. Note that those resources are described with a type-specific RDF. Use this generic resource description, if none of the known specific types matches your resource.

type: Annotated[str, Annotated[~_StrType, Predicate(str.islower)]]

The resource type assigns a broad category to the resource.

bioimage.io-wide unique resource identifier assigned by bioimage.io; version unspecific.

The description from which this one is derived

source: Optional[bioimageio.spec._internal.url.HttpUrl]

The primary source of the resource

@field_validator('type', mode='after')
@classmethod
def check_specific_types(cls, value: str) -> str:
433    @field_validator("type", mode="after")
434    @classmethod
435    def check_specific_types(cls, value: str) -> str:
436        if value in KNOWN_SPECIFIC_RESOURCE_TYPES:
437            raise ValueError(
438                f"Use the {value} description instead of this generic description for"
439                + f" your '{value}' resource."
440            )
441
442        return value
implemented_format_version: ClassVar[str] = '0.3.0'
implemented_format_version_tuple: ClassVar[Tuple[int, int, int]] = (0, 3, 0)
def model_post_init(self: pydantic.main.BaseModel, context: Any, /) -> None:
124                    def wrapped_model_post_init(self: BaseModel, context: Any, /) -> None:
125                        """We need to both initialize private attributes and call the user-defined model_post_init
126                        method.
127                        """
128                        init_private_attributes(self, context)
129                        original_model_post_init(self, context)

We need to both initialize private attributes and call the user-defined model_post_init method.

GenericDescr_v0_2 = <class 'bioimageio.spec.generic.v0_2.GenericDescr'>
GenericDescr_v0_3 = <class 'GenericDescr'>
AnyGenericDescr = typing.Annotated[typing.Union[bioimageio.spec.generic.v0_2.GenericDescr, GenericDescr], Discriminator(discriminator='format_version', custom_error_type=None, custom_error_message=None, custom_error_context=None)]

Union of any released generic desription