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

Method install_plugins

modelscope/utils/plugins.py:938–972  ·  view source on GitHub ↗

Install packages via pip Args: install_args (list): List of arguments passed to `pip install`. index_url (str, optional): The pypi index url. force_update: If force update on or off

(self,
                        install_args: List[str],
                        index_url: Optional[str] = None,
                        force_update=False)

Source from the content-addressed store, hash-verified

936 return options, args
937
938 def install_plugins(self,
939 install_args: List[str],
940 index_url: Optional[str] = None,
941 force_update=False) -> Any:
942 """Install packages via pip
943 Args:
944 install_args (list): List of arguments passed to `pip install`.
945 index_url (str, optional): The pypi index url.
946 force_update: If force update on or off
947 """
948
949 if len(install_args) == 0:
950 return 0, []
951
952 if index_url is not None:
953 install_args += ['-i', index_url]
954
955 if force_update is not False:
956 install_args += ['-f']
957
958 status_code, options, args = PluginsManager.pip_command(
959 'install',
960 install_args,
961 )
962
963 if status_code == 0:
964 logger.info(f'The plugins {",".join(args)} is installed')
965
966 # TODO Add Ast index for ast update record
967
968 # Add the plugins info to the local record
969 installed_package = self.parse_args_info(args, options)
970 self.update_plugins_file(installed_package)
971
972 return status_code, install_args
973
974 def parse_args_info(self, args: List[str], options):
975 """

Callers 5

executeMethod · 0.80
test_install_pluginsMethod · 0.80

Calls 4

parse_args_infoMethod · 0.95
update_plugins_fileMethod · 0.95
pip_commandMethod · 0.80
infoMethod · 0.80

Tested by 3

test_install_pluginsMethod · 0.64