pip: Use 'upgrade-strategy' option to make PIP upgrades less aggressive

The default upgrade-strategy could change from one version of PIP to
another and the results may be unpredictable. We can control the PIP
behavior during upgrades using the 'upgrade-strategy' option and default
that to 'only-if-required' so PIP only upgrades what's really necessary.
This also ensure that getting the latest pip passes the idempotence test
now that we only upgrade only what's really necessary.

Depends-On: I998182eca9851d2cc745930fc73ca37bfefd0951
Link: https://pip.pypa.io/en/stable/user_guide/#only-if-needed-recursive-upgrade
Co-Authored-By: Jean-Philippe Evrard <jean-philippe@evrard.me>
Change-Id: I2ba89e25c0010c9a5b515a3d0c9c731b30876e74
This commit is contained in:
Markos Chandras 2018-04-18 10:49:53 +01:00
parent 5a99262155
commit 2c724509d1
3 changed files with 17 additions and 0 deletions

View File

@ -70,6 +70,7 @@ pip_timeout: 120
# Options for pip install
pip_upgrade: true
pip_upgrade_strategy: "only-if-needed"
# Default index for pip to use
pip_default_index: https://pypi.python.org/simple

View File

@ -0,0 +1,15 @@
---
features:
- |
The PIP upgrade strategy can now be controlled using the new
``pip_install_strategy`` variable which can either be ``eager``
if the deployers want to upgrade both the package and its dependencies or
``only-if-needed`` if they want to only upgrade what's really necessary.
More information can be found on the `PIP user guide
<https://pip.pypa.io/en/stable/user_guide/#only-if-needed-recursive-upgrade>`_
upgrade:
- |
The default PIP stategy has been changed to ``only-of-needed`` in order to
minimize the amount of packages which are updated during installation.
Deployers can still override the default option using the ``pip_install_strategy``
variable.

View File

@ -14,6 +14,7 @@ trusted-host =
[install]
upgrade = {{ pip_upgrade }}
upgrade-strategy = {{ pip_upgrade_strategy }}
pre = {{ pip_enable_pre_releases }}
{% if pip_links | length > 0 %}
find-links =