Fork me on GitHub

bolero.utils.dependency.compatible_version

bolero.utils.dependency.compatible_version(actual_version_info, operation)[source]

Compares version strings.

Parameters:
actual_version_info : string

Either a package name of a package that provides the version string as variable ‘__version__’ or a version string.

operation : string

A comparison operation. Operator and version string must be seperated by whitespace, e.g. ‘>= 0.12.0’.

Returns:
comatible : bool

Is the version compatible?

Examples

>>> from bolero.utils.dependency import compatible_version
>>> compatible_version("1", ">= 0.1.2")
True
>>> compatible_version("sklearn", "> 0.0.0")
True