# eric7.PipInterface.Pip

Package implementing the pip GUI logic.

### Global Attributes

SSL_AVAILABLE

### Classes

Pip | Class implementing the pip GUI logic.

### Functions

None

## Pip

Class implementing the pip GUI logic.

### Derived from

QObject

### Class Attributes

DefaultIndexUrlPypi
DefaultIndexUrlSearch
DefaultIndexUrlSimple
DefaultPyPiUrl

### Class Methods

None

### Methods

Pip | Constructor
__checkUpgradeEric | Private method to check, if an upgrade of the eric-ide package is attempted.
__checkUpgradePyQt | Private method to check, if an upgrade of PyQt packages is attempted.
__extractOutdatedPackages | Private method to extract the outdated packages list out of the process output.
__filterUpgradePackages | Private method to filter out the packages that cannot be upgraded without stopping eric first.
__outdatedFinished | Private method to handle the process finished signal.
cacheList | Public method to list files contained in the pip cache.
cachePurge | Public method to remove all files from the pip cache.
cacheRemove | Public method to remove files from the pip cache.
checkPackagesOutdated | Public method to check, if groups of packages are outdated.
getDependencyTree | Public method to get the dependency tree of installed packages.
getFrozenPackages | Public method to get the list of package specifiers to freeze them.
getIndexUrl | Public method to get the index URL for PyPI.
getIndexUrlPypi | Public method to get the index URL for PyPI API calls.
getIndexUrlSearch | Public method to get the index URL for PyPI API calls.
getInstalledPackages | Public method to get the list of installed packages.
getLicenses | Public method to get the licenses per package for a given environment.
getNetworkAccessManager | Public method to get a reference to the network access manager object.
getOutdatedPackages | Public method to get the list of outdated packages.
getPackageDetails | Public method to get package details using the PyPI JSON interface.
getPackageVersions | Public method to get a list of versions available for the given package.
getProjectEnvironmentString | Public method to get the string for the project environment.
getUserConfig | Public method to get the name of the user configuration file.
getVirtualenvConfig | Public method to get the name of the virtualenv configuration file.
getVirtualenvInterpreter | Public method to get the interpreter for a virtual environment.
getVirtualenvNames | Public method to get a sorted list of virtual environment names.
getVulnerabilityChecker | Public method to get a reference to the vulnerability checker object.
installEditableProject | Public method to install a project in development mode.
installPackages | Public method to install the given list of packages.
installPip | Public method to install pip.
installPyprojectDependencies | Public method to install the dependencies listed in a pyproject.toml file.
installRequirements | Public method to install packages as given in a requirements file.
repairPip | Public method to repair the pip installation.
runProcess | Public method to execute the current pip with the given arguments.
showCacheInfo | Public method to show some information about the pip cache.
shutdown | Public method to perform shutdown actions.
uninstallPackages | Public method to uninstall the given list of packages.
uninstallPyprojectDependencies | Public method to uninstall the dependencies listed in a pyproject.toml file.
uninstallRequirements | Public method to uninstall packages as given in a requirements file.
upgradePackages | Public method to upgrade the given list of packages.

### Static Methods

None

#### Pip (Constructor)

Pip(parent=None)

Constructor

parent (QObject)
  reference to the user interface object

#### Pip.__checkUpgradeEric

__checkUpgradeEric(packages)

Private method to check, if an upgrade of the eric-ide package is attempted.

packages (list of str)
  list of packages to upgrade

Return:
  flag indicating an eric-ide upgrade

Return Type:
  bool

#### Pip.__checkUpgradePyQt

__checkUpgradePyQt(packages)

Private method to check, if an upgrade of PyQt packages is attempted.

packages (list of str)
  list of packages to upgrade

Return:
  flag indicating a PyQt upgrade

Return Type:
  bool

#### Pip.__extractOutdatedPackages

__extractOutdatedPackages(proc)

Private method to extract the outdated packages list out of the process output.

proc (QProcess)
  reference to the process

Return:
  dictionary with the package name as key and a tuple containing the installed and available version as the value

Return Type:
  dict of [str: (str, str)]

#### Pip.__filterUpgradePackages

__filterUpgradePackages(packages)

Private method to filter out the packages that cannot be upgraded without stopping eric first.

packages (list of str)
  list of packages to upgrade

Return:
  list of packages that can be upgraded

Return Type:
  list of str

#### Pip.__outdatedFinished

__outdatedFinished(callback, proc, exitCode, exitStatus)

Private method to handle the process finished signal.

callback (function)
  reference to the function to be called with the list of outdated packages
proc (QProcess)
  reference to the process
exitCode (int)
  exit code of the process
exitStatus (QProcess.ExitStatus)
  exit status of the process

#### Pip.cacheList

cacheList(venvName)

Public method to list files contained in the pip cache.

venvName (str)
  name of the virtual environment to be used

#### Pip.cachePurge

cachePurge(venvName)

Public method to remove all files from the pip cache.

venvName (str)
  name of the virtual environment to be used

#### Pip.cacheRemove

cacheRemove(venvName)

Public method to remove files from the pip cache.

venvName (str)
  name of the virtual environment to be used

#### Pip.checkPackagesOutdated

checkPackagesOutdated(packageStarts, envName, interpreter=None)

Public method to check, if groups of packages are outdated.

packageStarts (str)
  list of start strings for package names to be checked (case insensitive)
envName (str)
  name of the environment to get the packages for
interpreter (str (optional))
  path of an interpreter executable. If this is not None, it will override the given environment name (defaults to None)

Return:
  list of tuples containing the package name, installed version and available version of outdated packages

Return Type:
  tuple of (str, str, str)

#### Pip.getDependencyTree

getDependencyTree(envName, localPackages=True, usersite=False, reverse=False)

Public method to get the dependency tree of installed packages.

envName (str)
  name of the environment to get the packages for
localPackages (bool)
  flag indicating to get the tree for local packages only
usersite (bool)
  flag indicating to get the tree for packages installed in user-site directory only
reverse (bool)
  flag indicating to get the dependency tree in reverse order (i.e. list packages needed by other)

Return:
  list of nested dictionaries resembling the requested dependency tree

Return Type:
  list of dict

#### Pip.getFrozenPackages

getFrozenPackages(envName, localPackages=True, usersite=False, requirement=None)

Public method to get the list of package specifiers to freeze them.

envName (str)
  name of the environment to get the package specifiers for
localPackages (bool)
  flag indicating to get package specifiers for local packages only
usersite (bool)
  flag indicating to get package specifiers for packages installed in user-site only
requirement (str)
  name of a requirements file

Return:
  list of package specifiers

Return Type:
  list of str

#### Pip.getIndexUrl

getIndexUrl()

Public method to get the index URL for PyPI.

Return:
  index URL for PyPI

Return Type:
  str

#### Pip.getIndexUrlPypi

getIndexUrlPypi()

Public method to get the index URL for PyPI API calls.

Return:
  index URL for XML RPC calls

Return Type:
  str

#### Pip.getIndexUrlSearch

getIndexUrlSearch()

Public method to get the index URL for PyPI API calls.

Return:
  index URL for XML RPC calls

Return Type:
  str

#### Pip.getInstalledPackages

getInstalledPackages(envName, localPackages=True, notRequired=False, usersite=False)

Public method to get the list of installed packages.

envName (str)
  name of the environment to get the packages for
localPackages (bool)
  flag indicating to get local packages only
notRequired (bool)
  flag indicating to list packages that are not dependencies of installed packages as well
usersite (bool)
  flag indicating to only list packages installed in user-site

Return:
  list of tuples containing the package name and version

Return Type:
  list of tuple of (str, str)

#### Pip.getLicenses

getLicenses(envName)

Public method to get the licenses per package for a given environment.

envName (str)
  name of the environment to get the licenses for

Return:
  list of dictionaries containing the license and version per package

Return Type:
  dict

#### Pip.getNetworkAccessManager

getNetworkAccessManager()

Public method to get a reference to the network access manager object.

Return:
  reference to the network access manager object

Return Type:
  QNetworkAccessManager

#### Pip.getOutdatedPackages

getOutdatedPackages(envName, localPackages=True, notRequired=False, usersite=False, interpreter=None, callback=None, )

Public method to get the list of outdated packages.

envName (str)
  name of the environment to get the packages for
localPackages (bool (optional))
  flag indicating to get local packages only (defaults to False)
notRequired (bool (optional))
  flag indicating to list packages that are not dependencies of installed packages as well (defaults to False)
usersite (bool (optional))
  flag indicating to only list packages installed in user-site (defaults to False)
interpreter (str (optional))
  path of an interpreter executable. If this is not None, it will override the given environment name (defaults to None)
callback (function)
  method accepting a list of tuples containing the package name, installed version and available version

Return:
  dictionary with the package name as key and a tuple containing the installed and available version as the value

Return Type:
  dict of [str: (str, str)]

#### Pip.getPackageDetails

getPackageDetails(name, version)

Public method to get package details using the PyPI JSON interface.

name (str)
  package name
version (str)
  package version

Return:
  dictionary containing PyPI package data

Return Type:
  dict

#### Pip.getPackageVersions

getPackageVersions(name)

Public method to get a list of versions available for the given package.

name (str)
  package name

Return:
  list of available versions

Return Type:
  list of str

#### Pip.getProjectEnvironmentString

getProjectEnvironmentString()

Public method to get the string for the project environment.

Return:
  string for the project environment

Return Type:
  str

#### Pip.getUserConfig

getUserConfig()

Public method to get the name of the user configuration file.

Return:
  path of the user configuration file

Return Type:
  str

#### Pip.getVirtualenvConfig

getVirtualenvConfig(venvName)

Public method to get the name of the virtualenv configuration file.

venvName (str)
  name of the environment to get config file path for

Return:
  path of the virtualenv configuration file

Return Type:
  str

#### Pip.getVirtualenvInterpreter

getVirtualenvInterpreter(venvName)

Public method to get the interpreter for a virtual environment.

venvName (str)
  logical name for the virtual environment

Return:
  interpreter path

Return Type:
  str

#### Pip.getVirtualenvNames

getVirtualenvNames(noRemote=False, noConda=False, noGlobals=False, noServer=False)

Public method to get a sorted list of virtual environment names.

noRemote (bool (optional))
  flag indicating to exclude environments for remote debugging (defaults to False)
noConda (bool (optional))
  flag indicating to exclude Conda environments (defaults to False)
noGlobals (bool (optional))
  flag indicating to exclude global environments (defaults to False)
noServer (bool (optional))
  flag indicating to exclued eric-ide server environments (defaults to False)

Return:
  sorted list of virtual environment names

Return Type:
  list of str

#### Pip.getVulnerabilityChecker

getVulnerabilityChecker()

Public method to get a reference to the vulnerability checker object.

Return:
  reference to the vulnerability checker object

Return Type:
  PipVulnerabilityChecker

#### Pip.installEditableProject

installEditableProject(interpreter, projectPath)

Public method to install a project in development mode.

interpreter (str)
  interpreter to be used for execution
projectPath (str)
  path of the project

#### Pip.installPackages

installPackages(packages, venvName="", userSite=False, interpreter="", forceReinstall=False, )

Public method to install the given list of packages.

packages (list of str)
  list of packages to install
venvName (str)
  name of the virtual environment to be used
userSite (bool)
  flag indicating an install to the user install directory
interpreter (str)
  interpreter to be used for execution
forceReinstall (bool)
  flag indicating to force a reinstall of the packages

#### Pip.installPip

installPip(venvName, userSite=False)

Public method to install pip.

venvName (str)
  name of the environment to install pip into
userSite (bool)
  flag indicating an install to the user install directory

#### Pip.installPyprojectDependencies

installPyprojectDependencies(venvName)

Public method to install the dependencies listed in a pyproject.toml file.

venvName (str)
  name of the virtual environment to be used

#### Pip.installRequirements

installRequirements(venvName)

Public method to install packages as given in a requirements file.

venvName (str)
  name of the virtual environment to be used

#### Pip.repairPip

repairPip(venvName)

Public method to repair the pip installation.

venvName (str)
  name of the environment to install pip into

#### Pip.runProcess

runProcess(args, interpreter)

Public method to execute the current pip with the given arguments.

The selected pip executable is called with the given arguments and waited for its end.

args (list of str)
  list of command line arguments
interpreter (str)
  path of the Python interpreter to be used

Return:
  tuple containing a flag indicating success and the output of the process

Return Type:
  tuple of (bool, str)

#### Pip.showCacheInfo

showCacheInfo(venvName)

Public method to show some information about the pip cache.

venvName (str)
  name of the virtual environment to be used

#### Pip.shutdown

shutdown()

Public method to perform shutdown actions.

#### Pip.uninstallPackages

uninstallPackages(packages, venvName)

Public method to uninstall the given list of packages.

packages (list of str)
  list of packages to uninstall
venvName (str)
  name of the virtual environment to be used

Return:
  flag indicating a successful execution

Return Type:
  bool

#### Pip.uninstallPyprojectDependencies

uninstallPyprojectDependencies(venvName)

Public method to uninstall the dependencies listed in a pyproject.toml file.

venvName (str)
  name of the virtual environment to be used

#### Pip.uninstallRequirements

uninstallRequirements(venvName)

Public method to uninstall packages as given in a requirements file.

venvName (str)
  name of the virtual environment to be used

#### Pip.upgradePackages

upgradePackages(packages, venvName, userSite=False)

Public method to upgrade the given list of packages.

packages (list of str)
  list of packages to upgrade
venvName (str)
  name of the virtual environment to be used
userSite (bool)
  flag indicating an install to the user install directory

Return:
  flag indicating a successful execution

Return Type:
  bool

Up