mojo.pipTools

installNeededPackages(extensionName, packages)

Install packages needed by an extension. Extensions do not need to test if a package is installed before asking this function to install it. This function will check to see if the package is installed and only do the installation if it is not.

Arguments:

  • extensionName A string representing the extension name.
  • packages A list of package dictionaries.

Package dictionary structure:

{
    # The name of the package on PIP.
    # Required.
    packageName : "packagename",

    # The name of the mudule to be used during import.
    # This is only needed if the module name is different
    # from the package name. For example: pillow and PIL.
    importName : "name",

    # Optional arguments to be added to the standard
    # ["install", "--upgrade", "--target", applicationRootPath, packageName]
    pipArgs : []
}
Last edited on 25/01/2024