[Distutils] PEP439 and upgrading pip
Nick Coghlan
ncoghlan at gmail.com
Fri Jun 14 03:53:51 CEST 2013
On 14 June 2013 11:05, Richard Jones <richard at python.org> wrote:
> On 10 June 2013 06:43, Marcus Smith <qwcode at gmail.com> wrote:
>>
>> maybe this was covered before, but I'm looking for clarification on how
>> pip upgrades are to work under PEP439.
>>
>> I see 3 relevant bits right now:
>>
>> 1) "attempts to import pip machinery. If it can then the pip command
>> proceeds as normal"
>>
>> i.e., once it has a pip installed, it doesn't automatically upgrade on
>> subsequent imports.
>
>
> That's the intention. I've modified that paragraph:
>
> """
> The Python installation includes an executable called "pip3" (see PEP 394
> for
> naming rationale etc.) that attempts to import pip machinery. If it can
> then
> the pip command proceeds as normal. If it cannot it will bootstrap pip by
> downloading the pip implementation wheel file. Once installed, the pip
> command proceeds as normal. Once the bootstrap process is complete the
> "pip3"
> command is no longer the bootstrap but rather the full pip command.
> """
The fact that pip just ships a setuptools entry point wrapper as
/usr/bin/pip makes this easier. The difference between the stdlib
bootstrap script and the ordinary script is that the bootstrap one
will:
1. Import pip directly rather than using the pkg_resources entry point mechanism
2. Fallback to retrieving pip from PyPI if that fails
3. Invoke pip.main directly rather than using the pkg_resources entry
point mechanism
>> 3) "Manual installation of the pip implementation will be supported
>> through the manual download of the wheel file and "pip3 install <downloaded
>> wheel file>. This installation will not perform standard pip installation
>> steps of saving the file to a cache directory or updating any local database
>> of installed files.""
>>
>> I guess this means "manual upgrades" as well?
>> this special logic is to be inside pip itself? or an override of "install"
>> in the bootstrap (that detects when it's a pip wheel)?
>
>
> I've modified this section to read:
>
> """
> Some users may have no Internet access suitable for fetching the pip
> implementation file. Manual installation of the pip implementation will be
> supported through the manual download of the wheel file and "pip3 install
> <downloaded wheel file>". This installation - since it uses only the
> bootstrap
> code - will not perform standard pip installation steps of saving the file
> to
> a cache directory or updating any local database of installed files.
> """
>
> These changes will be online soon.
I've come to doubt the wisdom of omitting the metadata or using a
default install location that differs from pip's default location.
Once we download the pip wheel file, we should be able to unpack it to
a secure temporary directory and use it to install itself. That means
we should be able to do a full install of pip by default, rather than
anything that hides the metadata. Updating it later then becomes the
same as updating any other pip installed distribution.
The Linux distros can deal with it by either preinstalling pip as part
of the python packages, or just leave the bootstrap script out of the
Python packages and provide a distinct python-pip package as they do
now. "sudo yum install python-pip" and "sudo apt-get install
python-pip" are already pretty easy ways to bootstrap pip - it's
Windows that really needs the help, and a "it's just like any other
pip maintained package" approach is highly desirable there.
The only trick would be ensuring the pip wheel console script doesn't
collide with the bootstrap script, but worst case, we just special
case that directly in pip.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Distutils-SIG
mailing list