def test_package_version(): import numpy as np import pandas as pd assert get_package_version("kipoi") == kipoi.__version__ assert get_package_version("numpy") == np.__version__ assert get_package_version("pandas") == pd.__version__ assert get_package_version("package_doesnt_exist") is None
def all_installed(self, verbose=False): """Validate if all the dependencies are installed as requested Args: verbose: if True, display warnings if the dependencies are not installed Returns: (bool): True if all the required package versions are installed and False otherwise """ norm = self.normalized() for pkg in list(norm.conda) + list(norm.pip): if not kconda.is_installed(pkg): if verbose: pkg_name, req_version = kconda.version_split(pkg) found_version = kconda.get_package_version(pkg_name) if found_version is None: print("Package '{}' is not installed". format(pkg_name)) else: print("Installed package '{}={}' doesn't " "comply with '{}'". format(pkg_name, found_version, pkg)) return False return True