crate.operator.utils.version module

class crate.operator.utils.version.CrateVersion(vstring)

Bases: Version

Version numbering for CrateDB releases.

Implements the standard interface for version number classes as described above. A CrateDB version consists of two or three dot-separated numeric components, with an optional “-SNAPSHOT” tag on the end. Alternatively, a nightly version consists of the term “nightly” optionally followed by three dot-separated numeric components indicating the version, as well as an optional datetime or date component for the day of the build in the form YYYY-MM-DD-HH-mm or YYYYMMDD.

The following are valid version numbers (shown in the order that would be obtained by sorting according to the supplied cmp function):

  • 0.1

  • 3.2

  • 3.2.0

  • nightly-3.2.1

  • nightly-3.2.1-20190708

  • nightly-3.2.1-2019-07-08-01-02

  • 3.2.1-SNAPSHOT

  • 3.2.1

  • 4.0.0-SNAPSHOT

  • nightly

The following are examples of invalid version numbers:

  • 1

  • 1.2-SNAPSHOT

  • nightly-3.2

  • nightly-3.2.1-201907080200

  • nightly-3.2.1-201907080200-abc9876

The rationale for this version numbering system will be explained in the distutils documentation.

Parameters

vstring (str) –

date: Optional[str] = None
date_normalized: Optional[str] = None
hotfix: int
major: int
minor: int
nightly: bool
nightly_version_re = re.compile('\n            ^\n            (?:nightly)\n            (?:\n                -(?P<has_version>(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<hotfix>\\d+))\n                (?:\n                    -(?P<date>\, re.VERBOSE|re.ASCII)
parse(vstring)
snapshot: bool
stable: bool
version: Optional[Tuple[int, int, int]]
version_re = re.compile('\n            ^  # Start of the string\n            (?P<major>\\d+)\\.(?P<minor>\\d+)  # Every version has a major.minor\n            (\\.(?P<hotfix>\\d+)(?P<snapshot>-SNAPSHOT)?)?  # optionally hotf, re.VERBOSE|re.ASCII)

The regular expression to match a version string. Valid values are e.g.:

  • 0.1

  • 0.1.2

  • 0.1.2-SNAPSHOT

Invalid values are, e.g:

  • 0

  • 0.1-SNAPSHOT