@@ -1023,4 +1023,222 @@ of ability. Some examples that you could consider include:
1023
1023
* ``distlib `` - Packaging and distribution utilities (including functions for
1024
1024
interacting with PyPI).
1025
1025
1026
+ .. _`Resolver changes 2020` :
1027
+
1028
+ Changes to the pip dependency resolver in 20.2 (2020)
1029
+ =====================================================
1030
+
1031
+ pip 20.1 included an alpha version of the new resolver (hidden behind
1032
+ an optional ``--unstable-feature=resolver `` flag). pip 20.2 includes a
1033
+ robust beta of the new resolver (hidden behind an optional
1034
+ ``--use-feature=2020-resolver `` flag) that we encourage you to
1035
+ test. We will continue to improve the pip dependency resolver in
1036
+ response to testers' feedback. Please give us feedback through the
1037
+ `resolver testing survey `_. This will help us prepare to release pip
1038
+ 20.3, with the new resolver on by default, in October.
1039
+
1040
+ Watch out for
1041
+ -------------
1042
+
1043
+ The big change in this release is to the pip dependency resolver
1044
+ within pip.
1045
+
1046
+ Computers need to know the right order to install pieces of software
1047
+ ("to install `x `, you need to install `y ` first"). So, when Python
1048
+ programmers share software as packages, they have to precisely describe
1049
+ those installation prerequisites, and pip needs to navigate tricky
1050
+ situations where it's getting conflicting instructions. This new
1051
+ dependency resolver will make pip better at handling that tricky
1052
+ logic, and make pip easier for you to use and troubleshoot.
1053
+
1054
+ The most significant changes to the resolver are:
1055
+
1056
+ * It will **reduce inconsistency **: it will *no longer install a
1057
+ combination of packages that is mutually inconsistent *. In older
1058
+ versions of pip, it is possible for pip to install a package which
1059
+ does not satisfy the declared requirements of another installed
1060
+ package. For example, in pip 20.0, ``pip install "six<1.12"
1061
+ "virtualenv==20.0.2" `` does the wrong thing, “successfully” installing
1062
+ ``six==1.11 ``, even though ``virtualenv==20.0.2 `` requires
1063
+ ``six>=1.12.0,<2 `` (`defined here
1064
+ <https://github.com/pypa/virtualenv/blob/20.0.2/setup.cfg#L42-L50> `__).
1065
+ The new resolver, instead, outright rejects installing anything if it
1066
+ gets that input.
1067
+
1068
+ * It will be **stricter ** - if you ask pip to install two packages with
1069
+ incompatible requirements, it will refuse (rather than installing a
1070
+ broken combination, like it did in previous versions).
1071
+
1072
+ So, if you have been using workarounds to force pip to deal with
1073
+ incompatible or inconsistent requirements combinations, now's a good
1074
+ time to fix the underlying problem in the packages, because pip will
1075
+ be stricter from here on out.
1076
+
1077
+ This also means that, when you run a ``pip install `` command, pip only
1078
+ considers the packages you are installing in that command, and may
1079
+ break already-installed packages. It will not guarantee that your
1080
+ environment will be consistent all the time. If you ``pip install x ``
1081
+ and then ``pip install y ``, it's possible that the version of ``y ``
1082
+ you get will be different than it would be if you had run ``pip
1083
+ install x y `` in a single command. We would like your thoughts on what
1084
+ pip's behavior should be; please answer `our survey on upgrades that
1085
+ create conflicts `_.
1086
+
1087
+ We are also changing our support for :ref: `Constraints Files `:
1088
+
1089
+ * Unnamed requirements are not allowed as constraints (see :issue: `6628 ` and :issue: `8210 `)
1090
+ * Links are not allowed as constraints (see :issue: `8253 `)
1091
+ * Constraints cannot have extras (see :issue: `6628 `)
1092
+
1093
+
1094
+ How to test
1095
+ -----------
1096
+
1097
+ 1. **Install pip 20.2 ** with ``python -m pip install --upgrade pip ``.
1098
+
1099
+ 2. **Validate your current environment ** by running ``pip check ``. This
1100
+ will report if you have any inconsistencies in your set of installed
1101
+ packages. Having a clean installation will make it much less likely
1102
+ that you will hit issues when the new resolver is released (and may
1103
+ address hidden problems in your current environment!). If you run
1104
+ ``pip check `` and run into stuff you can’t figure out, please `ask
1105
+ for help in our issue tracker or chat <https://pip.pypa.io/> `__.
1106
+
1107
+ 3. **Test the new version of pip ** (see below). To test the new
1108
+ resolver, use the ``--use-feature=2020-resolver `` flag, as in:
1109
+
1110
+ ``pip install example --use-feature=2020-resolver ``
1111
+
1112
+ The more feedback we can get, the more we can make sure that the
1113
+ final release is solid. (Only try the new resolver **in a
1114
+ non-production environment **, though - it isn't ready for you to
1115
+ rely on in production!)
1116
+
1117
+ While we have tried to make sure that pip’s test suite covers as
1118
+ many cases as we can, we are very aware that there are people using
1119
+ pip with many different workflows and build processes, and we will
1120
+ not be able to cover all of those without your help.
1121
+
1122
+ - If you use pip to install your software, try out the new resolver
1123
+ and let us know if it works for you with ``pip install ``. Try:
1124
+
1125
+ - installing several packages simultaneously
1126
+ - re-creating an environment using a ``requirements.txt `` file
1127
+ - using ``pip install --force-reinstall `` to check whether
1128
+ it does what you think it should
1129
+ - using constraints files
1130
+
1131
+ - If you have a build pipeline that depends on pip installing your
1132
+ dependencies for you, check that the new resolver does what you
1133
+ need.
1134
+ - Run your project’s CI (test suite, build process, etc.) using the
1135
+ new resolver, and let us know of any issues.
1136
+ - If you have encountered resolver issues with pip in the past,
1137
+ check whether the new resolver fixes them. Also, let us know if
1138
+ the new resolver has issues with any workarounds you put in to
1139
+ address the current resolver’s limitations. We’ll need to ensure
1140
+ that people can transition off such workarounds smoothly.
1141
+ - If you develop or support a tool that wraps pip or uses it to
1142
+ deliver part of your functionality, please test your integration
1143
+ with pip 20.2.
1144
+
1145
+ 4. **Please report bugs ** through the `resolver testing survey `_.
1146
+
1147
+ Setups we might need more testing on
1148
+ ------------------------------------
1149
+
1150
+ * Windows, including Windows Subsystem for Linux (WSL)
1151
+
1152
+ * Macintosh
1153
+
1154
+ * Debian, Fedora, Red Hat, CentOS, Mint, Arch, Raspbian, Gentoo
1155
+
1156
+ * non-Latin localized filesystems and OSes, such as Japanese, Chinese, and Korean, and right-to-left such as Hebrew, Urdu, and Arabic
1157
+
1158
+ * Multi-user installations
1159
+
1160
+ * Requirements files with 100+ packages
1161
+
1162
+ * An installation workflow that involves multiple requirements files
1163
+
1164
+ * Requirements files that include hashes (:ref: `hash-checking mode `)
1165
+ or pinned dependencies (perhaps as output from ``pip-compile `` within
1166
+ ``pip-tools ``)
1167
+
1168
+ * Using :ref: `Constraints Files `
1169
+
1170
+ * Continuous integration/continuous deployment setups
1171
+
1172
+ * Installing from any kind of version control systems (i.e., Git, Subversion, Mercurial, or CVS), per :ref: `VCS Support `
1173
+
1174
+ * Installing from source code held in local directories
1175
+
1176
+ * Using the most recent versions of Python 3.6, 3.7, 3.8, and 3.9
1177
+
1178
+ * PyPy
1179
+
1180
+ * Customized terminals (where you have modified how error messages and standard output display)
1181
+
1182
+ Examples to try
1183
+ ^^^^^^^^^^^^^^^
1184
+
1185
+ Install:
1186
+
1187
+ * `tensorflow `_
1188
+ * ``hacking ``
1189
+ * ``pycodestyle ``
1190
+ * ``pandas ``
1191
+ * ``tablib ``
1192
+ * ``elasticsearch `` and ``requests `` together
1193
+ * ``six `` and ``cherrypy `` together
1194
+ * ``pip install flake8-import-order==0.17.1 flake8==3.5.0 --use-feature=2020-resolver ``
1195
+ * ``pip install tornado==5.0 sprockets.http==1.5.0 --use-feature=2020-resolver ``
1196
+
1197
+ Try:
1198
+
1199
+ * ``pip install ``
1200
+ * ``pip uninstall ``
1201
+ * ``pip check ``
1202
+ * ``pip cache ``
1203
+
1204
+
1205
+ Tell us about
1206
+ -------------
1207
+
1208
+ Specific things we'd love to get feedback on:
1209
+
1210
+ * Cases where the new resolver produces the wrong result,
1211
+ obviously. We hope there won't be too many of these, but we'd like
1212
+ to trap such bugs now.
1213
+
1214
+ * Cases where the resolver produced an error when you believe it
1215
+ should have been able to work out what to do.
1216
+
1217
+ * Cases where the resolver gives an error because there's a problem
1218
+ with your requirements, but you need better information to work out
1219
+ what's wrong.
1220
+
1221
+ * If you have workarounds to address issues with the current resolver,
1222
+ does the new resolver let you remove those workarounds? Tell us!
1223
+
1224
+ Please let us know through the `resolver testing survey `_.
1225
+
1226
+ Context and followup
1227
+ --------------------
1228
+
1229
+ As discussed in `our announcement on the PSF blog `_, the pip team are
1230
+ in the process of developing a new "dependency resolver" (the part of
1231
+ pip that works out what to install based on your requirements). Since
1232
+ this work will not change user-visible behavior described in the pip
1233
+ documentation, this change is not covered by the :ref: `Deprecation
1234
+ Policy`.
1235
+
1236
+ We're tracking our rollout in :issue: `6536 ` and you can watch for
1237
+ announcements on the `low-traffic packaging announcements list `_.
1238
+
1026
1239
.. _freeze : https://pip.pypa.io/en/latest/reference/pip_freeze/
1240
+ .. _resolver testing survey : https://tools.simplysecure.org/survey/index.php?r=survey/index&sid=989272&lang=en
1241
+ .. _our announcement on the PSF blog : http://pyfound.blogspot.com/2020/03/new-pip-resolver-to-roll-out-this-year.html
1242
+ .. _tensorflow : https://pypi.org/project/tensorflow/
1243
+ .. _low-traffic packaging announcements list : https://mail.python.org/mailman3/lists/pypi-announce.python.org/
1244
+ .. _our survey on upgrades that create conflicts : https://docs.google.com/forms/d/e/1FAIpQLSeBkbhuIlSofXqCyhi3kGkLmtrpPOEBwr6iJA6SzHdxWKfqdA/viewform
0 commit comments