# eric7.PipInterface.PipPackagesWidget

Module implementing the pip packages management widget.

### Global Attributes

None

### Classes

PipPackagesWidget | Class implementing the pip packages management widget.
PypiSearchResultsParser | Class implementing the parser for the PyPI search result page.

### Functions

None

## PipPackagesWidget

Class implementing the pip packages management widget.

### Derived from

QWidget, Ui_PipPackagesWidget

### Class Attributes

AvailableVersionColumn
DepInstalledVersionColumn
DepPackageColumn
DepRequiredVersionColumn
InstalledVersionColumn
PackageColumn
SearchVersionRole
ShowProcessClassifiersMode
ShowProcessEntryPointsMode
ShowProcessFilesListMode
ShowProcessGeneralMode
VulnerabilityColumn
VulnerabilityRole

### Class Methods

None

### Methods

PipPackagesWidget | Constructor
__aboutToShowPipMenu | Private slot to set the action enabled status.
__addDependency | Private method to add a dependency branch to a given parent.
__allUpdateableItems | Private method to get a list of all items that can be updated.
__availablePipVersion | Private method to get the pip version of the selected environment.
__clearVulnerabilityInfo | Private slot to clear the vulnerability info.
__editConfiguration | Private method to edit a configuration.
__editUserConfiguration | Private slot to edit the user configuration.
__editVirtualenvConfiguration | Private slot to edit the configuration of the selected environment.
__finishSearch | Private slot performing the search finishing actions.
__generateRequirements | Private slot to generate the contents for a requirements file.
__initPipMenu | Private method to create the super menu and attach it to the super menu button.
__installLocalPackage | Private slot to install a package available on local storage.
__installPackages | Private slot to install packages to be given by the user.
__installPip | Private slot to install pip into the selected environment.
__installPipUser | Private slot to install pip into the user site for the selected environment.
__installRequirements | Private slot to install packages as given in a requirements file.
__isPipAvailable | Private method to check, if the pip package is available for the selected environment.
__pipConfigure | Private slot to open the configuration page.
__populateEnvironments | Private method to get a list of environments and populate the selector.
__projectClosed | Private slot to handle the projectClosed signal.
__projectOpened | Private slot to handle the projectOpened signal.
__purgeCache | Private slot to empty the pip cache.
__refreshDependencyTree | Private method to refresh the dependency tree.
__refreshPackagesList | Private method to refresh the packages list.
__reinstallPackages | Private slot to force a re-installation of the selected packages.
__removeCachedFiles | Private slot to remove files from the pip cache.
__repairPip | Private slot to repair the pip installation of the selected environment.
__search | Private method to perform the search by calling the PyPI search URL.
__searchFirst | Private method to perform the search for packages.
__searchResponse | Private method to extract the search result data from the response.
__selectedUpdateableItems | Private method to get a list of selected items that can be updated.
__showCacheInfo | Private slot to show information about the cache.
__showCacheList | Private slot to show a list of cached files.
__showLicensesDialog | Private slot to show a dialog with the licenses of the selected environment.
__showPackageDetails | Private method to populate the package details dialog.
__showPackageInformation | Private method to show information for a package.
__showSearchedDetails | Private slot to show details about the selected search result package.
__showVulnerabilityInformation | Private method to show the detected vulnerability data.
__uninstallRequirements | Private slot to uninstall packages as given in a requirements file.
__updateActionButtons | Private method to set the state of the action buttons.
__updateDepActionButtons | Private method to set the state of the dependency page action buttons.
__updateSearchActionButtons | Private method to update the action button states of the search widget.
__updateSearchButton | Private method to update the state of the search button.
__updateSearchMoreButton | Private method to update the state of the search more button.
__updateVulnerabilityData | Private slot to update the shown vulnerability info.
__updateVulnerabilityDbCache | Private slot to initiate an update of the local cache of the vulnerability database.
executeInstallPackages | Public method to install the given list of packages.
executeUninstallPackages | Public method to uninstall the given list of packages.
executeUpgradePackages | Public method to execute the pip upgrade command.
getPip | Public method to get a reference to the pip interface object.
on_dependenciesList_itemActivated | Private slot reacting on a package item of the dependency tree being activated.
on_dependenciesList_itemPressed | Private slot reacting on a package item of the dependency tree being pressed.
on_dependenciesList_itemSelectionChanged | Private slot reacting on a change of selected items of the dependency tree.
on_environmentsComboBox_currentTextChanged | Private slot handling the selection of a Python environment.
on_installButton_clicked | Private slot to handle pressing the Install button..
on_installUserSiteButton_clicked | Private slot to handle pressing the Install to User-Site button..
on_installedFilesCheckBox_clicked | Private slot to handle a change of the installed files information checkbox.
on_localCheckBox_clicked | Private slot handling the switching of the local mode.
on_localDepCheckBox_clicked | Private slot handling the switching of the local mode.
on_notRequiredCheckBox_clicked | Private slot handling the switching of the 'not required' mode.
on_packagesList_itemActivated | Private slot reacting on a package item being activated.
on_packagesList_itemPressed | Private slot reacting on a package item being pressed.
on_packagesList_itemSelectionChanged | Private slot reacting on a change of selected items.
on_refreshButton_clicked | Private slot to refresh the display.
on_refreshDependenciesButton_clicked | Private slot to refresh the dependency tree.
on_requiresButton_toggled | Private slot handling the selection of the view type.
on_searchButton_clicked | Private slot handling a press of the search button.
on_searchEditName_returnPressed | Private slot initiating a search via a press of the Return key.
on_searchEditName_textChanged | Private slot handling a change of the search term.
on_searchMoreButton_clicked | Private slot handling a press of the search more button.
on_searchResultList_itemActivated | Private slot reacting on an search result item activation.
on_searchResultList_itemSelectionChanged | Private slot handling changes of the search result selection.
on_searchToggleButton_toggled | Private slot to togle the search widget.
on_showDepPackageDetailsButton_clicked | Private slot to show information for the selected package of the dependency tree.
on_showDetailsButton_clicked | Private slot to handle pressing the Show Details button.
on_showPackageDetailsButton_clicked | Private slot to show information for the selected package.
on_uninstallButton_clicked | Private slot to remove selected packages of the selected environment.
on_upgradeAllButton_clicked | Private slot to upgrade all packages of the selected environment.
on_upgradeButton_clicked | Private slot to upgrade selected packages of the selected environment.
on_userCheckBox_clicked | Private slot handling the switching of the 'user-site' mode.
on_userDepCheckBox_clicked | Private slot handling the switching of the 'user-site' mode.
on_verboseCheckBox_clicked | Private slot to handle a change of the verbose package information checkbox.
on_viewToggleButton_toggled | Private slot handling the view selection.
on_vulnerabilityCheckBox_clicked | Private slot handling a change of the automatic vulnerability checks.

### Static Methods

None

#### PipPackagesWidget (Constructor)

PipPackagesWidget(pip, parent=None)

Constructor

pip (Pip)
  reference to the global pip interface
parent (QWidget)
  reference to the parent widget

#### PipPackagesWidget.__aboutToShowPipMenu

__aboutToShowPipMenu()

Private slot to set the action enabled status.

#### PipPackagesWidget.__addDependency

__addDependency(dependency, parent)

Private method to add a dependency branch to a given parent.

dependency (dict)
  dependency to be added
parent (QTreeWidget or QTreeWidgetItem)
  reference to the parent item

#### PipPackagesWidget.__allUpdateableItems

__allUpdateableItems()

Private method to get a list of all items that can be updated.

Return:
  list of all items that can be updated

Return Type:
  list of QTreeWidgetItem

#### PipPackagesWidget.__availablePipVersion

__availablePipVersion()

Private method to get the pip version of the selected environment.

Return:
  tuple containing the version number or tuple with all zeros in case pip is not available

Return Type:
  tuple of int

#### PipPackagesWidget.__clearVulnerabilityInfo

__clearVulnerabilityInfo()

Private slot to clear the vulnerability info.

#### PipPackagesWidget.__editConfiguration

__editConfiguration(venvName="")

Private method to edit a configuration.

venvName (str)
  name of the environment to act upon

#### PipPackagesWidget.__editUserConfiguration

__editUserConfiguration()

Private slot to edit the user configuration.

#### PipPackagesWidget.__editVirtualenvConfiguration

__editVirtualenvConfiguration()

Private slot to edit the configuration of the selected environment.

#### PipPackagesWidget.__finishSearch

__finishSearch()

Private slot performing the search finishing actions.

#### PipPackagesWidget.__generateRequirements

__generateRequirements()

Private slot to generate the contents for a requirements file.

#### PipPackagesWidget.__initPipMenu

__initPipMenu()

Private method to create the super menu and attach it to the super menu button.

#### PipPackagesWidget.__installLocalPackage

__installLocalPackage()

Private slot to install a package available on local storage.

#### PipPackagesWidget.__installPackages

__installPackages()

Private slot to install packages to be given by the user.

#### PipPackagesWidget.__installPip

__installPip()

Private slot to install pip into the selected environment.

#### PipPackagesWidget.__installPipUser

__installPipUser()

Private slot to install pip into the user site for the selected environment.

#### PipPackagesWidget.__installRequirements

__installRequirements()

Private slot to install packages as given in a requirements file.

#### PipPackagesWidget.__isPipAvailable

__isPipAvailable()

Private method to check, if the pip package is available for the selected environment.

Return:
  flag indicating availability

Return Type:
  bool

#### PipPackagesWidget.__pipConfigure

__pipConfigure()

Private slot to open the configuration page.

#### PipPackagesWidget.__populateEnvironments

__populateEnvironments()

Private method to get a list of environments and populate the selector.

#### PipPackagesWidget.__projectClosed

__projectClosed(shutdown)

Private slot to handle the projectClosed signal.

shutdown (bool)
  flag indicating the IDE shutdown

#### PipPackagesWidget.__projectOpened

__projectOpened()

Private slot to handle the projectOpened signal.

#### PipPackagesWidget.__purgeCache

__purgeCache()

Private slot to empty the pip cache.

#### PipPackagesWidget.__refreshDependencyTree

__refreshDependencyTree()

Private method to refresh the dependency tree.

#### PipPackagesWidget.__refreshPackagesList

__refreshPackagesList()

Private method to refresh the packages list.

#### PipPackagesWidget.__reinstallPackages

__reinstallPackages()

Private slot to force a re-installation of the selected packages.

#### PipPackagesWidget.__removeCachedFiles

__removeCachedFiles()

Private slot to remove files from the pip cache.

#### PipPackagesWidget.__repairPip

__repairPip()

Private slot to repair the pip installation of the selected environment.

#### PipPackagesWidget.__search

__search(page=1)

Private method to perform the search by calling the PyPI search URL.

page (int (optional))
  search page to retrieve (defaults to 1)

#### PipPackagesWidget.__searchFirst

__searchFirst()

Private method to perform the search for packages.

#### PipPackagesWidget.__searchResponse

__searchResponse(reply)

Private method to extract the search result data from the response.

reply (QNetworkReply)
  reference to the reply object containing the data

#### PipPackagesWidget.__selectedUpdateableItems

__selectedUpdateableItems()

Private method to get a list of selected items that can be updated.

Return:
  list of selected items that can be updated

Return Type:
  list of QTreeWidgetItem

#### PipPackagesWidget.__showCacheInfo

__showCacheInfo()

Private slot to show information about the cache.

#### PipPackagesWidget.__showCacheList

__showCacheList()

Private slot to show a list of cached files.

#### PipPackagesWidget.__showLicensesDialog

__showLicensesDialog()

Private slot to show a dialog with the licenses of the selected environment.

#### PipPackagesWidget.__showPackageDetails

__showPackageDetails(packageName, packageVersion, upgradable=False, installable=False)

Private method to populate the package details dialog.

packageName (str)
  name of the package to show details for
packageVersion (str)
  version of the package
upgradable (bool (optional))
  flag indicating that the package may be upgraded (defaults to False)
installable (bool (optional))
  flag indicating that the package may be installed (defaults to False)

#### PipPackagesWidget.__showPackageInformation

__showPackageInformation(packageName, infoWidget)

Private method to show information for a package.

packageName (str)
  name of the package
infoWidget (QTreeWidget)
  reference to the widget to contain the information

#### PipPackagesWidget.__showSearchedDetails

__showSearchedDetails(item=None)

Private slot to show details about the selected search result package.

item (QTreeWidgetItem)
  reference to the search result item to show details for

#### PipPackagesWidget.__showVulnerabilityInformation

__showVulnerabilityInformation(packageName, packageVersion, vulnerabilities)

Private method to show the detected vulnerability data.

packageName (str)
  name of the package
packageVersion (str)
  installed version number
vulnerabilities (list of Vulnerability)
  list of vulnerabilities

#### PipPackagesWidget.__uninstallRequirements

__uninstallRequirements()

Private slot to uninstall packages as given in a requirements file.

#### PipPackagesWidget.__updateActionButtons

__updateActionButtons()

Private method to set the state of the action buttons.

#### PipPackagesWidget.__updateDepActionButtons

__updateDepActionButtons()

Private method to set the state of the dependency page action buttons.

#### PipPackagesWidget.__updateSearchActionButtons

__updateSearchActionButtons()

Private method to update the action button states of the search widget.

#### PipPackagesWidget.__updateSearchButton

__updateSearchButton()

Private method to update the state of the search button.

#### PipPackagesWidget.__updateSearchMoreButton

__updateSearchMoreButton(enable)

Private method to update the state of the search more button.

enable (bool)
  flag indicating the desired enable state

#### PipPackagesWidget.__updateVulnerabilityData

__updateVulnerabilityData(clearFirst=True)

Private slot to update the shown vulnerability info.

clearFirst (bool (optional))
  flag indicating to clear the vulnerability info first (defaults to True)

#### PipPackagesWidget.__updateVulnerabilityDbCache

__updateVulnerabilityDbCache()

Private slot to initiate an update of the local cache of the vulnerability database.

#### PipPackagesWidget.executeInstallPackages

executeInstallPackages(packages, userSite=False)

Public method to install the given list of packages.

packages (list of str)
  list of package names to be installed
userSite (bool)
  flag indicating to install to the user directory

#### PipPackagesWidget.executeUninstallPackages

executeUninstallPackages(packages)

Public method to uninstall the given list of packages.

packages (list of str)
  list of package names to be uninstalled

#### PipPackagesWidget.executeUpgradePackages

executeUpgradePackages(packages)

Public method to execute the pip upgrade command.

packages (list of str)
  list of package names to be upgraded

#### PipPackagesWidget.getPip

getPip()

Public method to get a reference to the pip interface object.

Return:
  reference to the pip interface object

Return Type:
  Pip

#### PipPackagesWidget.on_dependenciesList_itemActivated

on_dependenciesList_itemActivated(item, column)

Private slot reacting on a package item of the dependency tree being activated.

item (QTreeWidgetItem)
  reference to the activated item
column (int)
  activated column

#### PipPackagesWidget.on_dependenciesList_itemPressed

on_dependenciesList_itemPressed(item, column)

Private slot reacting on a package item of the dependency tree being pressed.

item (QTreeWidgetItem)
  reference to the pressed item
column (int)
  pressed column

#### PipPackagesWidget.on_dependenciesList_itemSelectionChanged

on_dependenciesList_itemSelectionChanged()

Private slot reacting on a change of selected items of the dependency tree.

#### PipPackagesWidget.on_environmentsComboBox_currentTextChanged

on_environmentsComboBox_currentTextChanged(name)

Private slot handling the selection of a Python environment.

name (str)
  name of the selected Python environment

#### PipPackagesWidget.on_installButton_clicked

on_installButton_clicked()

Private slot to handle pressing the Install button..

#### PipPackagesWidget.on_installUserSiteButton_clicked

on_installUserSiteButton_clicked()

Private slot to handle pressing the Install to User-Site button..

#### PipPackagesWidget.on_installedFilesCheckBox_clicked

on_installedFilesCheckBox_clicked(checked)

Private slot to handle a change of the installed files information checkbox.

checked (bool)
  state of the checkbox

#### PipPackagesWidget.on_localCheckBox_clicked

on_localCheckBox_clicked()

Private slot handling the switching of the local mode.

#### PipPackagesWidget.on_localDepCheckBox_clicked

on_localDepCheckBox_clicked()

Private slot handling the switching of the local mode.

#### PipPackagesWidget.on_notRequiredCheckBox_clicked

on_notRequiredCheckBox_clicked()

Private slot handling the switching of the 'not required' mode.

#### PipPackagesWidget.on_packagesList_itemActivated

on_packagesList_itemActivated(item, column)

Private slot reacting on a package item being activated.

item (QTreeWidgetItem)
  reference to the activated item
column (int)
  activated column

#### PipPackagesWidget.on_packagesList_itemPressed

on_packagesList_itemPressed(item, column)

Private slot reacting on a package item being pressed.

item (QTreeWidgetItem)
  reference to the pressed item
column (int)
  pressed column

#### PipPackagesWidget.on_packagesList_itemSelectionChanged

on_packagesList_itemSelectionChanged()

Private slot reacting on a change of selected items.

#### PipPackagesWidget.on_refreshButton_clicked

on_refreshButton_clicked()

Private slot to refresh the display.

#### PipPackagesWidget.on_refreshDependenciesButton_clicked

on_refreshDependenciesButton_clicked()

Private slot to refresh the dependency tree.

#### PipPackagesWidget.on_requiresButton_toggled

on_requiresButton_toggled(checked)

Private slot handling the selection of the view type.

checked (bool)
  state of the radio button (unused)

#### PipPackagesWidget.on_searchButton_clicked

on_searchButton_clicked()

Private slot handling a press of the search button.

#### PipPackagesWidget.on_searchEditName_returnPressed

on_searchEditName_returnPressed()

Private slot initiating a search via a press of the Return key.

#### PipPackagesWidget.on_searchEditName_textChanged

on_searchEditName_textChanged(txt)

Private slot handling a change of the search term.

txt (str)
  search term

#### PipPackagesWidget.on_searchMoreButton_clicked

on_searchMoreButton_clicked()

Private slot handling a press of the search more button.

#### PipPackagesWidget.on_searchResultList_itemActivated

on_searchResultList_itemActivated(item, column)

Private slot reacting on an search result item activation.

item (QTreeWidgetItem)
  reference to the activated item
column (int)
  activated column

#### PipPackagesWidget.on_searchResultList_itemSelectionChanged

on_searchResultList_itemSelectionChanged()

Private slot handling changes of the search result selection.

#### PipPackagesWidget.on_searchToggleButton_toggled

on_searchToggleButton_toggled(checked)

Private slot to togle the search widget.

checked (bool)
  state of the search widget button

#### PipPackagesWidget.on_showDepPackageDetailsButton_clicked

on_showDepPackageDetailsButton_clicked()

Private slot to show information for the selected package of the dependency tree.

#### PipPackagesWidget.on_showDetailsButton_clicked

on_showDetailsButton_clicked()

Private slot to handle pressing the Show Details button.

#### PipPackagesWidget.on_showPackageDetailsButton_clicked

on_showPackageDetailsButton_clicked()

Private slot to show information for the selected package.

#### PipPackagesWidget.on_uninstallButton_clicked

on_uninstallButton_clicked()

Private slot to remove selected packages of the selected environment.

#### PipPackagesWidget.on_upgradeAllButton_clicked

on_upgradeAllButton_clicked()

Private slot to upgrade all packages of the selected environment.

#### PipPackagesWidget.on_upgradeButton_clicked

on_upgradeButton_clicked()

Private slot to upgrade selected packages of the selected environment.

#### PipPackagesWidget.on_userCheckBox_clicked

on_userCheckBox_clicked()

Private slot handling the switching of the 'user-site' mode.

#### PipPackagesWidget.on_userDepCheckBox_clicked

on_userDepCheckBox_clicked()

Private slot handling the switching of the 'user-site' mode.

#### PipPackagesWidget.on_verboseCheckBox_clicked

on_verboseCheckBox_clicked(checked)

Private slot to handle a change of the verbose package information checkbox.

checked (bool)
  state of the checkbox

#### PipPackagesWidget.on_viewToggleButton_toggled

on_viewToggleButton_toggled(checked)

Private slot handling the view selection.

checked (bool)
  state of the toggle button

#### PipPackagesWidget.on_vulnerabilityCheckBox_clicked

on_vulnerabilityCheckBox_clicked(checked)

Private slot handling a change of the automatic vulnerability checks.

checked (bool)
  flag indicating the state of the check box

Up

## PypiSearchResultsParser

Class implementing the parser for the PyPI search result page.

### Derived from

html.parser.HTMLParser

### Class Attributes

ClassPrefix

### Class Methods

None

### Methods

PypiSearchResultsParser | Constructor
__getClass | Private method to extract the class attribute out of the list of attributes.
__getDate | Private method to extract the datetime attribute out of the list of attributes and process it.
getResults | Public method to get the extracted search results.
handle_data | Public method process arbitrary data.
handle_endtag | Public method to process the end tag.
handle_starttag | Public method to process the start tag.

### Static Methods

None

#### PypiSearchResultsParser (Constructor)

PypiSearchResultsParser(data)

Constructor

data (str)
  data to be parsed

#### PypiSearchResultsParser.__getClass

__getClass(attrs)

Private method to extract the class attribute out of the list of attributes.

attrs (list of tuple of (str, str))
  list of tag attributes as (name, value) tuples

Return:
  value of the 'class' attribute or None

Return Type:
  str

#### PypiSearchResultsParser.__getDate

__getDate(attrs)

Private method to extract the datetime attribute out of the list of attributes and process it.

attrs (list of tuple of (str, str))
  list of tag attributes as (name, value) tuples

Return:
  value of the 'class' attribute or None

Return Type:
  str

#### PypiSearchResultsParser.getResults

getResults()

Public method to get the extracted search results.

Return:
  extracted result data

Return Type:
  list of dict

#### PypiSearchResultsParser.handle_data

handle_data(data)

Public method process arbitrary data.

data (str)
  data to be processed

#### PypiSearchResultsParser.handle_endtag

handle_endtag(tag)

Public method to process the end tag.

tag (str)
  tag name (all lowercase)

#### PypiSearchResultsParser.handle_starttag

handle_starttag(tag, attrs)

Public method to process the start tag.

tag (str)
  tag name (all lowercase)
attrs (list of tuple of (str, str))
  list of tag attributes as (name, value) tuples

Up