Skip to content

Commit ce21547

Browse files
committed
Update documentation according to new behaviour
1 parent e9e39db commit ce21547

File tree

3 files changed

+23
-40
lines changed

3 files changed

+23
-40
lines changed

docs/quickstart.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Install a package from `PyPI`_:
1111
[...]
1212
Successfully installed SomePackage
1313

14-
Install a package already downloaded from `PyPI`_ or got elsewhere.
14+
Install a package already downloaded from `PyPI`_ or obtained via other means.
1515
This is useful if the target machine does not have a network connection:
1616

1717
::
@@ -39,11 +39,11 @@ List what packages are outdated:
3939
$ pip list --outdated
4040
SomePackage (Current: 1.0 Latest: 2.0)
4141

42-
Upgrade a package:
42+
To upgrade an existing package, simply run the install command again:
4343

4444
::
4545

46-
$ pip install --upgrade SomePackage
46+
$ pip install SomePackage
4747
[...]
4848
Found existing installation: SomePackage 1.0
4949
Uninstalling SomePackage:

docs/reference/pip_install.rst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -758,13 +758,6 @@ Examples
758758
$ pip install -r requirements.txt
759759

760760

761-
#. Upgrade an already installed `SomePackage` to the latest from PyPI.
762-
763-
::
764-
765-
$ pip install --upgrade SomePackage
766-
767-
768761
#. Install a local project in "editable" mode. See the section on :ref:`Editable Installs <editable-installs>`.
769762

770763
::

docs/user_guide.rst

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -469,35 +469,33 @@ Then, to install from local only, you'll be using :ref:`--find-links
469469
$ pip install --no-index --find-links=DIR -r requirements.txt
470470

471471

472-
"Only if needed" Recursive Upgrade
473-
**********************************
472+
Upgrade Behaviour
473+
*****************
474474

475-
``pip install --upgrade`` is currently written to perform an eager recursive
476-
upgrade, i.e. it upgrades all dependencies regardless of whether they still
477-
satisfy the new parent requirements.
475+
``pip install`` is currently performs a non-eager recursive upgrade, i.e.
476+
it upgrades dependencies only when they no longer satisfy the new parent
477+
requirements.
478478

479-
E.g. supposing:
479+
As an example, consider this scenario:
480480

481+
* Only `SomePackage-1.0` and `AnotherPackage-1.0` are currently installed
482+
* `SomePackage-2.0`, `AnotherPackage-2.0` are the latest versions available on PyPI.
481483
* `SomePackage-1.0` requires `AnotherPackage>=1.0`
482484
* `SomePackage-2.0` requires `AnotherPackage>=1.0` and `OneMorePackage==1.0`
483-
* `SomePackage-1.0` and `AnotherPackage-1.0` are currently installed
484-
* `SomePackage-2.0` and `AnotherPackage-2.0` are the latest versions available on PyPI.
485-
486-
Running ``pip install --upgrade SomePackage`` would upgrade `SomePackage` *and*
487-
`AnotherPackage` despite `AnotherPackage` already being satisfied.
488485

489-
pip doesn't currently have an option to do an "only if needed" recursive
490-
upgrade, but you can achieve it using these 2 steps::
486+
Running ``pip install SomePackage`` would:
487+
* install `OneMorePackage-1.0` and `SomePackage-2.0`
488+
* do not install/upgrade `AnotherPackage` as it satisfies existing requirements
491489

492-
pip install --upgrade --no-deps SomePackage
493-
pip install SomePackage
490+
pip doesn't currently have an option to do an upgrade package(s) and
491+
dependencies to latest version. This can currently only be achieved by
492+
explicitly listing all the dependencies of the package(s) as command line
493+
arguments or in a requirements file.
494494

495-
The first line will upgrade `SomePackage`, but not dependencies like
496-
`AnotherPackage`. The 2nd line will fill in new dependencies like
497-
`OneMorePackage`.
498-
499-
See :issue:`59` for a plan of making "only if needed" recursive the default
500-
behavior for a new ``pip upgrade`` command.
495+
See :issue:`59` for discussion related to this behaviour. An ``upgrade-all``
496+
command has been proposed, with the intent of using it in virtual environments
497+
as an alternative to the earlier behaviour (before pip 9.0) of eager upgrading,
498+
upgrading dependencies to the latest version.
501499

502500

503501
User Installs
@@ -565,21 +563,13 @@ From within a real python, where ``SomePackage`` *is* installed globally, but is
565563

566564
$ pip install --user SomePackage
567565
[...]
568-
Requirement already satisfied (use --upgrade to upgrade)
569-
570-
$ pip install --user --upgrade SomePackage
571-
[...]
572566
Successfully installed SomePackage
573567

574568

575569
From within a real python, where ``SomePackage`` *is* installed globally, and is the latest version::
576570

577571
$ pip install --user SomePackage
578572
[...]
579-
Requirement already satisfied (use --upgrade to upgrade)
580-
581-
$ pip install --user --upgrade SomePackage
582-
[...]
583573
Requirement already up-to-date: SomePackage
584574

585575
# force the install
@@ -657,7 +647,7 @@ You can then install from the archive like this::
657647

658648
$ tempdir=$(mktemp -d /tmp/wheelhouse-XXXXX)
659649
$ (cd $tempdir; tar -xvf /path/to/bundled.tar.bz2)
660-
$ pip install --force-reinstall --ignore-installed --upgrade --no-index --no-deps $tempdir/*
650+
$ pip install --force-reinstall --ignore-installed --no-index --no-deps $tempdir/*
661651

662652
Note that compiled packages are typically OS- and architecture-specific, so
663653
these archives are not necessarily portable across machines.

0 commit comments

Comments
 (0)