[Distutils] A portable version of pip

Vinay Sajip vinay_sajip at yahoo.co.uk
Mon Oct 21 15:25:05 CEST 2013


I did a bit of work looking at running pip from a .zip using pyzzer, a little while ago. What were the fixes to pip which you mentioned? There were a number of places where pip needed changing:

1. How it handles cacert.pem when running from a .zip (default_cert_path in pip/locations.py)
2. Identifying the running pip rather than any installed pip
3. Expecting an installed setuptools to check its version to confirm that wheels can be supported
4. The wheel build code, which uses subprocess, assumes running from the file system

>From what I can see 2 and 3 have been addressed in recent changes, but I couldn't tell from a quick reading whether 1 has been addressed (there have certainly been code changes in this area) or whether 4 has been addressed.

Regards,

Vinay Sajip

--------------------------------------------
On Mon, 21/10/13, Paul Moore <p.f.moore at gmail.com> wrote:

 Subject: [Distutils] A portable version of pip
 To: "Distutils" <distutils-sig at python.org>
 Date: Monday, 21 October, 2013, 11:39
 
 With all of the current interest in
 bundling pip with the Python
 distribution, I had a sudden thought. Vinay has developed a
 package
 called pyzzer (https://pypi.python.org/pypi/pyzzer) that
 bundles up
 Python modules into runnable single-file executables.
 
 Using a command
 
     pyzzer -m pip:main -l t64 -o pipsa.exe -s
 "#!python" -r <path-to-pip>\pip
 
 you can build a single-file executable version of pip that
 can install
 wheels (it can't install sdists until setuptools is
 installed, because
 installing sdists depends on having setuptools at install
 time).
 
 The -s "#!python" is not needed on Unix as the default is
 "#!/usr/bin/env python". Also the -l t64 is a Windows
 requirement to
 get an exe - you can produce a cross-platform pyz archive
 without it
 (see the pyzzer docs for details).
 
 This requires the latest development version of pip (which
 contains a
 fix for running pip from an uninstalled zipfile) and the
 following
 patch to pip\__init__.py:
 
 Change:
 
 from pip import cmdoptions
 
 to:
 
 import pip.cmdoptions
 cmdoptions = pip.cmdoptions
 
 This fixes a recursive-import issue - I'll update pip "real
 soon now"
 (TM) for this.
 
 This is just an experiment at the moment - I've done minimal
 testing
 but it seems to work as I'd expect. It may be worth thinking
 about,
 though - either as an alternative to bundling (a bit late, I
 know) or
 as a way of providing pip for earlier versions of Python.
 
 Hope this is of interest.
 
 Paul
 _______________________________________________
 Distutils-SIG maillist  -  Distutils-SIG at python.org
 https://mail.python.org/mailman/listinfo/distutils-sig
 


More information about the Distutils-SIG mailing list