Coverage for bioimageio/spec/notebook/v0_2.py: 100%
36 statements
« prev ^ index » next coverage.py v7.8.0, created at 2025-04-02 14:21 +0000
« prev ^ index » next coverage.py v7.8.0, created at 2025-04-02 14:21 +0000
1from typing import TYPE_CHECKING, ClassVar, Literal, Optional, Union
3from typing_extensions import Annotated
5from .._internal.common_nodes import Node
6from .._internal.io import WithSuffix
7from .._internal.io_basics import AbsoluteFilePath as AbsoluteFilePath
8from .._internal.url import HttpUrl
9from ..generic.v0_2 import VALID_COVER_IMAGE_EXTENSIONS as VALID_COVER_IMAGE_EXTENSIONS
10from ..generic.v0_2 import AttachmentsDescr as AttachmentsDescr
11from ..generic.v0_2 import Author as Author
12from ..generic.v0_2 import BadgeDescr as BadgeDescr
13from ..generic.v0_2 import CiteEntry as CiteEntry
14from ..generic.v0_2 import Doi as Doi
15from ..generic.v0_2 import GenericDescrBase
16from ..generic.v0_2 import LinkedResource as LinkedResource
17from ..generic.v0_2 import Maintainer as Maintainer
18from ..generic.v0_2 import OrcidId as OrcidId
19from ..generic.v0_2 import RelativeFilePath as RelativeFilePath
20from ..generic.v0_2 import ResourceId as ResourceId
21from ..generic.v0_2 import Uploader as Uploader
22from ..generic.v0_2 import Version as Version
25class NotebookId(ResourceId):
26 pass
29_WithNotebookSuffix = WithSuffix(".ipynb", case_sensitive=True)
30NotebookSource = Union[
31 Annotated[HttpUrl, _WithNotebookSuffix],
32 Annotated[AbsoluteFilePath, _WithNotebookSuffix],
33 Annotated[RelativeFilePath, _WithNotebookSuffix],
34]
37class NotebookDescr(GenericDescrBase):
38 """Bioimage.io description of a Jupyter Notebook."""
40 implemented_type: ClassVar[Literal["notebook"]] = "notebook"
41 if TYPE_CHECKING:
42 type: Literal["notebook"] = "notebook"
43 else:
44 type: Literal["notebook"]
46 id: Optional[NotebookId] = None
47 """bioimage.io-wide unique resource identifier
48 assigned by bioimage.io; version **un**specific."""
50 source: NotebookSource
51 """The Jupyter notebook"""
54class LinkedNotebook(Node):
55 """Reference to a bioimage.io notebook."""
57 id: NotebookId
58 """A valid notebook `id` from the bioimage.io collection."""
60 version_number: Optional[int] = None
61 """version number (n-th published version, not the semantic version) of linked notebook"""