Version#

class pyxem.utils.diffraction.Version(version: str)#

Bases: _BaseVersion

This class abstracts handling of a project’s versions.

A Version instance is comparison aware and can be compared and sorted using the standard Python interfaces.

>>> v1 = Version("1.0a5")
>>> v2 = Version("1.0")
>>> v1
<Version('1.0a5')>
>>> v2
<Version('1.0')>
>>> v1 < v2
True
>>> v1 == v2
False
>>> v1 > v2
False
>>> v1 >= v2
False
>>> v1 <= v2
True

Version is immutable; use __replace__() to change part of a version.

Instances are safe to serialize with pickle. They use a stable format so the same pickle can be loaded in future packaging releases.

Changed in version 26.2: Added a stable pickle format. Pickles created with packaging 26.2+ can be unpickled with future releases. Backward compatibility with pickles from packaging < 26.2 is supported but may be removed in a future release.

Attributes

Version.base_version

The "base version" of the version.

Version.dev

The development number of the version.

Version.epoch

The epoch of the version.

Version.is_devrelease

Whether this version is a development release.

Version.is_postrelease

Whether this version is a post-release.

Version.is_prerelease

Whether this version is a pre-release.

Version.local

The local version segment of the version.

Version.major

The first item of release or 0 if unavailable.

Version.micro

The third item of release or 0 if unavailable.

Version.minor

The second item of release or 0 if unavailable.

Version.post

The post-release number of the version.

Version.pre

The pre-release segment of the version.

Version.public

The public portion of the version.

Version.release

The components of the "release" segment of the version.

Methods

Version.from_parts(*[, epoch, pre, post, ...])

Return a new version composed of the various parts.