Skip to content

Commit 8daece5

Browse files
authored
Merge pull request #9056 from brainwane/docs-migration-guide-details
Improve migration guide re: new resolver
2 parents 1bcebab + 3f4e15a commit 8daece5

File tree

4 files changed

+51
-21
lines changed

4 files changed

+51
-21
lines changed

docs/html/development/architecture/upgrade-options.rst

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
Options that control the installation process
33
=============================================
44

5-
When installing packages, pip chooses a distribution file, and installs it in
6-
the user's environment. There are many choices involved in deciding which file
7-
to install, and these are controlled by a variety of options.
5+
When installing packages, pip chooses a distribution file, and
6+
installs it in the user's environment. There are many choices (which
7+
are `still evolving`_) involved in deciding which file to install, and
8+
these are controlled by a variety of options.
89

910
.. note::
1011

@@ -122,3 +123,6 @@ necessarily resolution or what gets installed.
122123
``--constraint``
123124

124125
``--editable <LOCATION>``
126+
127+
128+
.. _still evolving: https://github.com/pypa/pip/issues/8115

docs/html/reference/pip_install.rst

+3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ pip install has several stages:
3636
3. Build wheels. All the dependencies that can be are built into wheels.
3737
4. Install the packages (and uninstall anything being upgraded/replaced).
3838

39+
Note that ``pip install`` prefers to leave the installed version as-is
40+
unless ``--upgrade`` is specified.
41+
3942
Argument Handling
4043
-----------------
4144

docs/html/user_guide.rst

+40-18
Original file line numberDiff line numberDiff line change
@@ -197,18 +197,16 @@ In practice, there are 4 common uses of Requirements files:
197197
py -m pip freeze > requirements.txt
198198
py -m pip install -r requirements.txt
199199
200-
2. Requirements files are used to force pip to properly resolve
201-
dependencies. In versions of pip prior to 20.3, pip `doesn't have
202-
true dependency resolution
203-
<https://github.com/pypa/pip/issues/988>`_, but instead simply uses
204-
the first specification it finds for a project. E.g. if ``pkg1``
205-
requires ``pkg3>=1.0`` and ``pkg2`` requires ``pkg3>=1.0,<=2.0``,
206-
and if ``pkg1`` is resolved first, pip will only use ``pkg3>=1.0``,
207-
and could easily end up installing a version of ``pkg3`` that
208-
conflicts with the needs of ``pkg2``. To solve this problem for
209-
pip 20.2 and previous, you can place ``pkg3>=1.0,<=2.0`` (i.e. the
210-
correct specification) into your requirements file directly along
211-
with the other top level requirements. Like so::
200+
2. Requirements files are used to force pip to properly resolve dependencies.
201+
pip 20.2 and earlier `doesn't have true dependency resolution
202+
<https://github.com/pypa/pip/issues/988>`_, but instead simply uses the first
203+
specification it finds for a project. E.g. if ``pkg1`` requires
204+
``pkg3>=1.0`` and ``pkg2`` requires ``pkg3>=1.0,<=2.0``, and if ``pkg1`` is
205+
resolved first, pip will only use ``pkg3>=1.0``, and could easily end up
206+
installing a version of ``pkg3`` that conflicts with the needs of ``pkg2``.
207+
To solve this problem, you can place ``pkg3>=1.0,<=2.0`` (i.e. the correct
208+
specification) into your requirements file directly along with the other top
209+
level requirements. Like so::
212210

213211
pkg1
214212
pkg2
@@ -291,7 +289,11 @@ organisation and use that everywhere. If the thing being installed requires
291289
"helloworld" to be installed, your fixed version specified in your constraints
292290
file will be used.
293291

294-
Constraints file support was added in pip 7.1.
292+
Constraints file support was added in pip 7.1. In :ref:`Resolver
293+
changes 2020` we did a fairly comprehensive overhaul, removing several
294+
undocumented and unsupported quirks from the previous implementation,
295+
and stripped constraints files down to being purely a way to specify
296+
global (version) limits for packages.
295297

296298
.. _`Installing from Wheels`:
297299

@@ -1437,17 +1439,37 @@ time to fix the underlying problem in the packages, because pip will
14371439
be stricter from here on out.
14381440

14391441
This also means that, when you run a ``pip install`` command, pip only
1440-
considers the packages you are installing in that command, and may
1441-
break already-installed packages. It will not guarantee that your
1442+
considers the packages you are installing in that command, and **may
1443+
break already-installed packages**. It will not guarantee that your
14421444
environment will be consistent all the time. If you ``pip install x``
14431445
and then ``pip install y``, it's possible that the version of ``y``
14441446
you get will be different than it would be if you had run ``pip
1445-
install x y`` in a single command. We would like your thoughts on what
1447+
install x y`` in a single command. We are considering changing this
1448+
behavior (per :issue:`7744`) and would like your thoughts on what
14461449
pip's behavior should be; please answer `our survey on upgrades that
14471450
create conflicts`_.
14481451

1449-
We are also changing our support for :ref:`Constraints Files`:
1450-
1452+
We are also changing our support for :ref:`Constraints Files`,
1453+
editable installs, and related functionality. We did a fairly
1454+
comprehensive overhaul and stripped constraints files down to being
1455+
purely a way to specify global (version) limits for packages, and so
1456+
some combinations that used to be allowed will now cause
1457+
errors. Specifically:
1458+
1459+
* Constraints don't override the existing requirements; they simply
1460+
constrain what versions are visible as input to the resolver (see
1461+
:issue:`9020`)
1462+
* Providing an editable requirement (``-e .``) does not cause pip to
1463+
ignore version specifiers or constraints (see :issue:`8076`), and if
1464+
you have a conflict between a pinned requirement and a local
1465+
directory then pip will indicate that it cannot find a version
1466+
satisfying both (see :issue:`8307`)
1467+
* Hash-checking mode requires that all requirements are specified as a
1468+
``==`` match on a version and may not work well in combination with
1469+
constraints (see :issue:`9020` and :issue:`8792`)
1470+
* If necessary to satisfy constraints, pip will happily reinstall
1471+
packages, upgrading or downgrading, without needing any additional
1472+
command-line options (see :issue:`8115` and :doc:`development/architecture/upgrade-options`)
14511473
* Unnamed requirements are not allowed as constraints (see :issue:`6628` and :issue:`8210`)
14521474
* Links are not allowed as constraints (see :issue:`8253`)
14531475
* Constraints cannot have extras (see :issue:`6628`)

news/9056.doc.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Improve migration guide to reflect changes in new resolver behavior.

0 commit comments

Comments
 (0)