Skip to content


This module provides a bunch of utility methods and helpers for version handling.

get_comparable_version(version_string, cut = None, **kwargs) #


  • version_string

    The version string for which to create a comparable version instance

  • cut

    optional, how many version digits to remove (e.g., cut=1 will turn 1.2.3 into 1.2). Defaults to None, meaning no further action. Settings this to 0 will remove anything up to the last digit, e.g. dev or rc information.


  • A comparable version

is_octoprint_compatible(*compatibility_entries, **kwargs) #

Tests if the current octoprint_version is compatible to any of the provided compatibility_entries.


  • compatibility_entries (str) –

    compatibility string(s) to test against, result will be True if any match is found

  • octoprint_version (tuple or SetuptoolsVersion) –

    optional OctoPrint version to match against, if not current base version will be determined via :func:get_octoprint_version.


  • (bool) True if any of the provided compatibility entries matches or there are no entries, else False

is_release(version) #

import pkg_resources is_release(pkg_resources.parse_version("1.3.6rc3")) True is_release(pkg_resources.parse_version("1.3.6rc3.dev2+g1234")) False is_release(pkg_resources.parse_version("1.3.6")) True is_release(pkg_resources.parse_version("1.3.6.post1+g1234")) True is_release(pkg_resources.parse_version("1.3.6.post1.dev0+g1234")) False is_release(pkg_resources.parse_version("1.3.7.dev123+g23545")) False

is_stable(version) #

import pkg_resources is_stable(pkg_resources.parse_version("1.3.6rc3")) False is_stable(pkg_resources.parse_version("1.3.6rc3.dev2+g1234")) False is_stable(pkg_resources.parse_version("1.3.6")) True is_stable(pkg_resources.parse_version("1.3.6.post1+g1234")) True is_stable(pkg_resources.parse_version("1.3.6.post1.dev0+g1234")) False is_stable(pkg_resources.parse_version("1.3.7.dev123+g23545")) False