# eric7.PipInterface.Pip

Package implementing the pip GUI logic.

### Global Attributes

None

### 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.
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.
checkPackageOutdated | Public method to check, if a group of packages is outdated.
getDependecyTree | 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.
getLicensesSummary | Public method to get a summary of licenses found in 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.
installPackages | Public method to install the given list of packages.
installPip | Public method to install pip.
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.
uninstallPackages | Public method to uninstall the given list of packages.
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.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.checkPackageOutdated

checkPackageOutdated(packageStart, envName)

Public method to check, if a group of packages is outdated.

packageStart (str)
  start string for package names to be checked (case insensitive)
envName (str)
  name of the environment to get the packages for

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

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

#### Pip.getDependecyTree

getDependecyTree(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, localPackages=True, usersite=False, summary=False)

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

envName (str)
  name of the environment to get the licenses for
localPackages (bool)
  flag indicating to get the licenses for local packages only
usersite (bool)
  flag indicating to get the licenses for packages installed in user-site directory only
summary (bool (optional))
  flag indicating to get a summary listing (defaults to False)

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

Return Type:
  dict

#### Pip.getLicensesSummary

getLicensesSummary(envName, localPackages=True, usersite=False)

Public method to get a summary of licenses found in a given environment.

envName (str)
  name of the environment to get the licenses summary for
localPackages (bool)
  flag indicating to get the licenses summary for local packages only
usersite (bool)
  flag indicating to get the licenses summary for packages installed in user-site directory only

Return:
  list of dictionaries containing the license and the count of packages

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)

Public method to get the list of outdated 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, installed version and available version

Return Type:
  list of tuple 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)

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

noRemote (bool)
  flag indicating to exclude environments for remote debugging
noConda (bool)
  flag indicating to exclude Conda environments

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.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.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.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.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