absfuyu.version module

Absfuyu: Version

Package versioning module

Version: 5.1.0 Date updated: 10/03/2025 (dd/mm/yyyy)

class absfuyu.version.ReleaseOption(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: StrEnum

MAJOR, MINOR, PATCH

MAJOR = 'major'
MINOR = 'minor'
PATCH = 'patch'
classmethod all_option() list[str][source]

Return a list of release options

class absfuyu.version.ReleaseLevel(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: StrEnum

FINAL, DEV, RC

FINAL = 'final'
DEV = 'dev'
RC = 'rc'
classmethod all_level() list[str][source]

Return a list of release levels

class absfuyu.version.Version(major: int | str, minor: int | str, patch: int | str, release_level: str = ReleaseLevel.FINAL, serial: int | str = 0)[source]

Bases: BaseClass

property version: str

Return version string

Example:

>>> test = Version(1, 0, 0)
>>> test.version
1.0.0
>>> str(test) # test.__str__()
1.0.0
>>> test_serial = Version(1, 0, 0, "dev", 1)
>>> test_serial.version
1.0.0.dev1
classmethod from_tuple(iterable: tuple[int, int, int] | tuple[int, int, int, str, int]) Self[source]

Convert to Version from a tuple

Parameters:

iterable (tuple[int, int, int] | tuple[int, int, int, str, int]) – Version tuple in correct format

Returns:

Version

Return type:

Version

Raises:

ValueError – Wrong tuple format

Example:

>>> test = Version.from_tuple((1, 0, 0))
>>> test.version
1.0.0
classmethod from_str(version_string: str) Self[source]

Convert to Version from a str

Parameters:

version_string (str) –

Version str in correct format
<major>.<minor>.<patch>
<major>.<minor>.<patch>.<release level><serial>

Returns:

Version

Return type:

Version

Raises:

ValueError – Wrong version_string format

Example:

>>> test = Version.from_str("1.0.0")
>>> test.version
1.0.0
to_dict() VersionDictFormat[source]

Convert Version into dict

Returns:

Version dict

Return type:

VersionDictFormat

Example:

>>> test = Version(1, 0, 0)
>>> test.to_dict()
{
    "major": 1,
    "minor": 0,
    "patch": 0,
    "release_level": "final",
    "serial": 0
}
class absfuyu.version.Bumper(major: int | str, minor: int | str, patch: int | str, release_level: str = ReleaseLevel.FINAL, serial: int | str = 0)[source]

Bases: Version

Version bumper

bump(*, option: str = ReleaseOption.PATCH, channel: str = ReleaseLevel.FINAL) None[source]

Bump current version (internally)

Parameters:
  • option (str) – Release option (Default: "patch")

  • channel (str) – Release channel (Default: "final")

Example:

>>> test = Bumper(1, 0, 0)
>>> test.version
1.0.0
>>> test.bump()
>>> test.version
1.0.1
class absfuyu.version.PkgVersion(package_name: str)[source]

Bases: object

Package Version

check_for_update(*, force_update: bool = False) None[source]

Check for latest update

Parameters:

force_update (bool) – Auto update the package when run (Default: False)