Class PipPackages
Utility class to manage pip packages.
Inherited Members
Namespace: UnityEditor .Scripting.Python.Packages
Assembly: Unity.Scripting.Python.Editor.dll
Syntax
public class PipPackages
Methods
AddPackage(string)
Convenience function to install a single package.
Wraps AddPackages
.
Declaration
public static bool AddPackage(string package)
Parameters
Type | Name | Description |
---|---|---|
string | package | The package to add |
Returns
Type | Description |
---|---|
bool | Returns true if the package is successfully or already installed returns false on failure. |
AddPackages(IEnumerable<string>)
Adds python pacakges via pip. Also adds the packages to the project's requirements.txt file if the same pacakge, at the same version is not already present and installs and/or updates the packages. If already present, no operations are performed; it is safe to add the same package multiple times.
This function has a side effect of removing installed pip packages that are not specified in the requirements.txt file or in the computed requirements (as a dependency)
Declaration
public static bool AddPackages(IEnumerable<string> packages)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<string> | packages | An enumerable of the packages to add |
Returns
Type | Description |
---|---|
bool | Returns true if the packages are successfully or already installed returns false on failure. |