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
def test_is_installed(): assert is_installed("kipoi>=0.1") assert is_installed("kipoi<=10.1") assert not is_installed("kipoi>=10.1") assert is_installed("kipoi>=0.1,>=0.2") assert is_installed("kipoi>=0.1,>0.2") assert not is_installed("package_doesnt_exist")