Skip to content

Version

CurrentSCDLVersion

Bases: SCDLVersion

Current version of the SCDL schema.

Source code in bionemo/scdl/schema/version.py
88
89
90
91
92
93
class CurrentSCDLVersion(SCDLVersion):
    """Current version of the SCDL schema."""

    def __init__(self):
        """Initialize with the current SCDL schema version: 0.1.0."""
        super().__init__(major=0, minor=1, point=0)

__init__()

Initialize with the current SCDL schema version: 0.1.0.

Source code in bionemo/scdl/schema/version.py
91
92
93
def __init__(self):
    """Initialize with the current SCDL schema version: 0.1.0."""
    super().__init__(major=0, minor=1, point=0)

SCDLVersion

Bases: Version

Represent the SCDL schema version.

This class models the version of the schema used to store data in an archive.

Source code in bionemo/scdl/schema/version.py
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
class SCDLVersion(Version):
    """Represent the SCDL schema version.

    This class models the version of the schema used to store data in an archive.
    """

    def __init__(self, major: int = 0, minor: int = 0, point: int = 0):
        """Initialize an SCDL schema version.

        Args:
            major (int): Major version number.
            minor (int): Minor version number.
            point (int): Patch/point version number.
        """
        super().__init__(major, minor, point)

    def __str__(self) -> str:
        """Return the semantic version string.

        Returns:
            str: Version formatted as "major.minor.point".
        """
        return f"{self.major}.{self.minor}.{self.point}"

    def __repr__(self) -> str:
        """Return a developer-friendly representation.

        Returns:
            str: Representation including field names and values.
        """
        return f"SCDLVersion(major={self.major}, minor={self.minor}, point={self.point})"

    def __eq__(self, other: "SCDLVersion") -> bool:
        """Return whether two versions are equal.

        Args:
            other (SCDLVersion): The version to compare to.

        Returns:
            bool: True if ``major``, ``minor``, and ``point`` are equal; otherwise False.
        """
        return self.major == other.major and self.minor == other.minor and self.point == other.point

    def __ne__(self, other: "SCDLVersion") -> bool:
        """Return whether two versions are not equal.

        Args:
            other (SCDLVersion): The version to compare to.

        Returns:
            bool: True if any of ``major``, ``minor``, or ``point`` differ; otherwise False.
        """
        return not self == other

__eq__(other)

Return whether two versions are equal.

Parameters:

Name Type Description Default
other SCDLVersion

The version to compare to.

required

Returns:

Name Type Description
bool bool

True if major, minor, and point are equal; otherwise False.

Source code in bionemo/scdl/schema/version.py
65
66
67
68
69
70
71
72
73
74
def __eq__(self, other: "SCDLVersion") -> bool:
    """Return whether two versions are equal.

    Args:
        other (SCDLVersion): The version to compare to.

    Returns:
        bool: True if ``major``, ``minor``, and ``point`` are equal; otherwise False.
    """
    return self.major == other.major and self.minor == other.minor and self.point == other.point

__init__(major=0, minor=0, point=0)

Initialize an SCDL schema version.

Parameters:

Name Type Description Default
major int

Major version number.

0
minor int

Minor version number.

0
point int

Patch/point version number.

0
Source code in bionemo/scdl/schema/version.py
39
40
41
42
43
44
45
46
47
def __init__(self, major: int = 0, minor: int = 0, point: int = 0):
    """Initialize an SCDL schema version.

    Args:
        major (int): Major version number.
        minor (int): Minor version number.
        point (int): Patch/point version number.
    """
    super().__init__(major, minor, point)

__ne__(other)

Return whether two versions are not equal.

Parameters:

Name Type Description Default
other SCDLVersion

The version to compare to.

required

Returns:

Name Type Description
bool bool

True if any of major, minor, or point differ; otherwise False.

Source code in bionemo/scdl/schema/version.py
76
77
78
79
80
81
82
83
84
85
def __ne__(self, other: "SCDLVersion") -> bool:
    """Return whether two versions are not equal.

    Args:
        other (SCDLVersion): The version to compare to.

    Returns:
        bool: True if any of ``major``, ``minor``, or ``point`` differ; otherwise False.
    """
    return not self == other

__repr__()

Return a developer-friendly representation.

Returns:

Name Type Description
str str

Representation including field names and values.

Source code in bionemo/scdl/schema/version.py
57
58
59
60
61
62
63
def __repr__(self) -> str:
    """Return a developer-friendly representation.

    Returns:
        str: Representation including field names and values.
    """
    return f"SCDLVersion(major={self.major}, minor={self.minor}, point={self.point})"

__str__()

Return the semantic version string.

Returns:

Name Type Description
str str

Version formatted as "major.minor.point".

Source code in bionemo/scdl/schema/version.py
49
50
51
52
53
54
55
def __str__(self) -> str:
    """Return the semantic version string.

    Returns:
        str: Version formatted as "major.minor.point".
    """
    return f"{self.major}.{self.minor}.{self.point}"

Version

Generic version class (used throughout SCDL including for new backing implementations).

Source code in bionemo/scdl/schema/version.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class Version:
    """Generic version class (used throughout SCDL including for new backing implementations)."""

    def __init__(self, major: int = 0, minor: int = 0, point: int = 0):
        """Initialize a version.

        Args:
            major (int): Major version number.
            minor (int): Minor version number.
            point (int): Patch/point version number.
        """
        self.major = major
        self.minor = minor
        self.point = point

__init__(major=0, minor=0, point=0)

Initialize a version.

Parameters:

Name Type Description Default
major int

Major version number.

0
minor int

Minor version number.

0
point int

Patch/point version number.

0
Source code in bionemo/scdl/schema/version.py
20
21
22
23
24
25
26
27
28
29
30
def __init__(self, major: int = 0, minor: int = 0, point: int = 0):
    """Initialize a version.

    Args:
        major (int): Major version number.
        minor (int): Minor version number.
        point (int): Patch/point version number.
    """
    self.major = major
    self.minor = minor
    self.point = point