irfpy.util.version
¶
- exception irfpy.util.version.VersionException(*args, **argv)[source]¶
Bases:
IrfpyException
- irfpy.util.version.requires(required_version, installed_version, package_name='unknown', error_message=None)[source]¶
Raises VersionException if installed version does not match.
- Parameters:
required_version (String) – Required package version.
installed_version (String) – Installed package version.
package_name – Package name. Used for error message.
error_message – Error message to show.
For typical use in library or your script:
>>> from irfpy.util import __version__ >>> requires('4.0.0', __version__, package_name='irfpy.util') # One should use irfpy.util >4.0.0
If the version does not match:
>>> installed_version = "4.0" >>> required_version = "5.0"
>>> requires(required_version, installed_version, package_name="testpackage") Traceback (most recent call last): irfpy.util.version.VersionException: ...
- irfpy.util.version.recommends(recommended_version, installed_version, package_name='unknown', error_message=None)[source]¶
Warning message is shown if installed version does not match.
- Parameters:
recommended_version (String) – Recommended package version, inclusive.
installed_version (String) – Installed package version.
package_name – Package name. (Used for error message.)
error_message – Error message to show.
For typical use in library or your script:
>>> import scipy >>> recommends('1.4.1', scipy.__version__, package_name='irfpy.util') # scipy v1.4.1 or higher is recommended.
If the version does not match:
>>> installed_version = "4.0" >>> recommended_version = "5.0"
>>> recommends(recommended_version, installed_version, package_name="testpackage")