compare_version

Contents

compare_version#

compare_version(lib: str | Version, version_to_check: str, operator: str) bool[source]#

Compare the version of a librarie to a reference, giving the operator.

Parameters:
  • lib (str) – Name of the library, it’s version as a string or as a Version object

  • version_to_check (str) – Version of the library to be compared

  • operator (str) – Operator to use (>, <, >=, <=, ==)

Returns:

True if the comparison between the version of the library and the reference version is respected

Return type:

bool

Example

>>> compare_version("geopandas", "0.10.0", ">=")
True
>>> compare_version(sertit.__version__, "1.0.0", ">=")
True