minversion¶
-
astropy.utils.introspection.minversion(module, version, inclusive=True, version_path='__version__')[source] [edit on github]¶ Returns
Trueif the specified Python module satisfies a minimum version requirement, andFalseif not.By default this uses
pkg_resources.parse_versionto do the version comparison if available. Otherwise it falls back ondistutils.version.LooseVersion.Parameters: module : module or
strAn imported module of which to check the version, or the name of that module (in which case an import of that module is attempted– if this fails
Falseis returned).version :
strThe version as a string that this module must have at a minimum (e.g.
'0.12').inclusive :
boolThe specified version meets the requirement inclusively (i.e.
>=) as opposed to strictly greater than (default:True).version_path :
strA dotted attribute path to follow in the module for the version. Defaults to just
'__version__', which should work for most Python modules.Examples
>>> import astropy >>> minversion(astropy, '0.4.4') True