MCPcopy Index your code
hub / github.com/modelscope/modelscope / check_plugin_installed

Method check_plugin_installed

modelscope/utils/plugins.py:782–805  ·  view source on GitHub ↗

Check if the plugin is installed, and if the version is valid Args: package: the package name need to be installed Returns: if_installed: True if installed version: the version of installed or None if not installed

(package)

Source from the content-addressed store, hash-verified

780
781 @staticmethod
782 def check_plugin_installed(package):
783 """ Check if the plugin is installed, and if the version is valid
784
785 Args:
786 package: the package name need to be installed
787
788 Returns:
789 if_installed: True if installed
790 version: the version of installed or None if not installed
791
792 """
793
794 if package.split('.')[-1] == 'whl':
795 # install from whl should test package name instead of module name
796 _, module_version, package_name = get_modules_from_package(package)
797 local_installed, version = PluginsManager._check_plugin_installed(
798 package_name)
799 if local_installed and module_version != version:
800 return False, version
801 elif not local_installed:
802 return False, version
803 return True, module_version
804 else:
805 return PluginsManager._check_plugin_installed(package)
806
807 @staticmethod
808 def _check_plugin_installed(package, verified_version=None):

Callers 4

get_package_infoMethod · 0.95
_update_pluginsMethod · 0.95

Calls 2

get_modules_from_packageFunction · 0.85

Tested by

no test coverage detected