This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Backport ensurepip to 2.7 (PEP 477)
Type: enhancement Stage: patch review
Components: Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: doko, dstufft, ncoghlan, ned.deily, python-dev, steve.dower
Priority: normal Keywords: needs review, patch

Created on 2014-11-09 16:58 by dstufft, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
pep-477.patch dstufft, 2014-11-09 16:58 review
pep-477-2.patch dstufft, 2014-11-09 17:17 review
pep-477-3.patch dstufft, 2014-11-11 13:24 review
pep-477-docs.patch dstufft, 2014-11-20 13:33 review
pep-477-docs-2.patch dstufft, 2014-11-20 13:55 review
Messages (21)
msg230889 - (view) Author: Donald Stufft (dstufft) * (Python committer) Date: 2014-11-09 16:58
As specified in PEP 477, this backports PEP 453 (ensurepip) to the Python 2.7 branch. Key differences from PEP 453 are:

* It is not run by default in the Makefile
* There is no venv modules, so downstream can remove it (though are asked to patch it to provide instructions redirecting people to how they should install pip).
* The ``pip`` command is installed as well as ``pipX`` and ``pipX.Y``.
* Given the above, --default-pip is hidden and no-oped and --no-default-pip is added to restore the Python 3.x behavior.

This also includes a (slightly modified to make it work on 2.x) backport of unittest.mock as test._mock_backport in order to make it reasonable to run the ensurepip tests without actually installing pip.

This patch does not include any changes to the Windows installers or to the OS X installers. I've nosey'd Ned Deily for the OS X installer changes, I'm not sure who is doing the Windows Installers now adays.

Note: The attached patch does not contain the actual .whl files which are required. This is because it makes the patch into a 2M patch and the tracker didn't like that very much. This patch can be applied and then just copy over the Lib/ensurepip/_bundled directory from Python 3.4.
msg230892 - (view) Author: Donald Stufft (dstufft) * (Python committer) Date: 2014-11-09 17:17
Second patch just fixes the docs to specify the correct behavior for 2.7 and it fixes ensurepip.bootstrap() to match the default 2.7 behavior when executing python -m ensurepip.
msg230907 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2014-11-09 20:25
The mock backport doesn't come with a license.  Please either include it in the file, or make it clear that the backport has the same license as python (?).
msg230908 - (view) Author: Donald Stufft (dstufft) * (Python committer) Date: 2014-11-09 20:25
The backport is taken from Python 3.4 so it's the same license as everything else.
msg230909 - (view) Author: Donald Stufft (dstufft) * (Python committer) Date: 2014-11-09 20:26
IOW it's literally Lib/unittest/mock.py from the 3.x series.
msg230949 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2014-11-10 09:51
mock in the Python standard library is licensed under the PSF license.
msg231024 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2014-11-11 13:08
Thanks Donald, left some review comments on Reitveld.

While I had some comments on the docs, I think the code changes all look fine - would it be worth incorporating this version immediately to make it easier to get started on the Windows and Mac OS X installer updates?
msg231025 - (view) Author: Donald Stufft (dstufft) * (Python committer) Date: 2014-11-11 13:24
I've updated the patch with Nick's comments, except for pulling in the latest versions of the documentation.
msg231026 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2014-11-11 14:20
Thanks. I suggest committing that version, so the rest of the backport
(installer integration & packaging docs backport) can proceed in parallel.
msg231030 - (view) Author: Donald Stufft (dstufft) * (Python committer) Date: 2014-11-11 16:10
Merged in https://hg.python.org/cpython/rev/592a5414fabd, I forgot to mention the issue number.

I'm going to leave this open for the docs changes, however the OSX installer and Windows installer changes should be able to be made now.
msg231077 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2014-11-12 13:49
The Windows installer integration backport is in issue 22850.

Reviewing that made me release that the parallel version section in https://docs.python.org/3/installing/#work-with-multiple-versions-of-python-installed-in-parallel may need tweaking to account for the fact that the "py" launcher only comes with Python 3.

That said, it's unlikely anyone will be wanting to switch between 2.6 and 2.7 on Windows at this point, so maybe we should just ignore it and wait and see if anyone complains.
msg231096 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2014-11-13 01:54
Ned pointed out the wording regarding the Makefile changes in PEP 477 was ambiguous.

My intent was for the changes to be backported, just with ENSUREPIP defaulting to "no" rather than "upgrade".

So that part of the backport is still on the todo list (Ned's offered to handle that in addition to the Mac OS X installer changes)
msg231201 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2014-11-15 03:05
The OS X installer integration backport has been committed in Issue22877.
msg231421 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2014-11-20 10:32
The configure and Makefile integration backport has been committed in Issue22878.  Unlike with Python 3, the default is to not install pip unless specifically enabled at configure time or on the "make altinstall" or "make install" targets.

I think that about wraps up the code changes for PEP 477.

But it looks like the documentation changes are not complete.  I noticed the following warnings while building the docs:

./Doc/library/ensurepip.rst:31: WARNING: undefined label: installing-index (if the link has no caption the label must precede a section header)
./Doc/whatsnew/2.7.rst:2631: WARNING: undefined label: installing-index (if the link has no caption the label must precede a section header)
./Doc/whatsnew/2.7.rst:2631: WARNING: undefined label: distributing-index (if the link has no caption the label must precede a section header)

It appears that part of the changes that reference the restructured "Installing Python Modules" and "Distributing Python Modules" docs (that replaced the original Distutils docs) got backported but not the docs themselves.  Nick, were you planning to do that?  If not, the references above should be fixed.
msg231423 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2014-11-20 10:58
Yes, the missing link targets are part of the pending docs changes Donald mentioned above.
msg231429 - (view) Author: Donald Stufft (dstufft) * (Python committer) Date: 2014-11-20 13:33
I've attached a patch which I believe updates the 2.x docs with what 3.x has. I ran ``make html`` and the only errors I got were in relation to pyporting which I don't believe has anything to do with this ticket. 

If someone can sanity check this for me I can go ahead and merge this and close out this ticket.
msg231431 - (view) Author: Donald Stufft (dstufft) * (Python committer) Date: 2014-11-20 13:34
Note: I removed the references to pyvenv in these docs because 2.7 doesn't have that.
msg231432 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2014-11-20 13:45
The "prior to version 3.4" question should be updated to talk about "prior to version 2.7.9" instead.

For Python 2, we may want to explicitly mention installing virtualenv (either with pip or the system package manager), as there's no pyvenv provided by default, and the instructions do still assume the use of a virtual environment (just for permissions reasons, rather than the name of the Python executable).
msg231433 - (view) Author: Donald Stufft (dstufft) * (Python committer) Date: 2014-11-20 13:55
Updated the docs patch to address Nick's comments.
msg231435 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2014-11-20 14:14
Looks good to me! :)
msg231437 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-11-20 14:40
New changeset 8bc29f5ebeff by Donald Stufft in branch '2.7':
Issue #22827: Backport the new Distributing and Instaling Docs from 3.4
https://hg.python.org/cpython/rev/8bc29f5ebeff
History
Date User Action Args
2022-04-11 14:58:10adminsetgithub: 67016
2014-11-20 17:26:34dstufftsetstatus: open -> closed
resolution: fixed
2014-11-20 14:40:21python-devsetnosy: + python-dev
messages: + msg231437
2014-11-20 14:31:10michael.foordsetnosy: - michael.foord
2014-11-20 14:14:42ncoghlansetmessages: + msg231435
2014-11-20 13:55:28dstufftsetfiles: + pep-477-docs-2.patch

messages: + msg231433
2014-11-20 13:45:27ncoghlansetmessages: + msg231432
2014-11-20 13:34:48dstufftsetmessages: + msg231431
2014-11-20 13:33:22dstufftsetfiles: + pep-477-docs.patch

messages: + msg231429
2014-11-20 10:58:46ncoghlansetmessages: + msg231423
2014-11-20 10:32:13ned.deilysetmessages: + msg231421
2014-11-15 03:05:53ned.deilysetmessages: + msg231201
2014-11-13 01:54:01ncoghlansetmessages: + msg231096
2014-11-12 13:49:57ncoghlansetmessages: + msg231077
2014-11-11 16:10:47dstufftsetmessages: + msg231030
2014-11-11 14:20:32ncoghlansetmessages: + msg231026
2014-11-11 13:24:28dstufftsetfiles: + pep-477-3.patch

messages: + msg231025
2014-11-11 13:08:04ncoghlansetmessages: + msg231024
2014-11-10 09:51:23michael.foordsetmessages: + msg230949
2014-11-09 20:26:21dstufftsetmessages: + msg230909
2014-11-09 20:25:55dstufftsetmessages: + msg230908
2014-11-09 20:25:18dokosetnosy: + michael.foord
messages: + msg230907
2014-11-09 17:17:17dstufftsetfiles: + pep-477-2.patch

messages: + msg230892
2014-11-09 17:04:47dstufftsetnosy: + steve.dower
2014-11-09 16:58:56dstufftcreate