[Distutils] Replacing pip.exe with a Python script

Paul Moore p.f.moore at gmail.com
Tue Jul 16 12:28:19 CEST 2013

On 15 July 2013 23:21, Vinay Sajip <vinay_sajip at yahoo.co.uk> wrote:

> Paul Moore <p.f.moore <at> gmail.com> writes:
> > I think I'm coming to the conclusion that the best way forward is:
> > 1. Continue using the setuptools exe launcher, but bundle our own copy.
> Wouldn't that be the case with a bundled setuptools/pip anyway? The
> launcher
> executables are part of setuptools AFAIK.
> > 2. Modify setup.py to install our own scripts run via the exe launcher,
> which don't rely on entry points and pkg_resources.
> FYI the distlib executable launchers (not based on setuptools, but work the
> same way) and the distlib script generation approach does not require
> distlib to run. You might be able to make use of that in some way :-)

Yes, the physical executables aren't that much of an issue - grabbing them
from somewhere and bundling them is easy enough and as you say we may
already have them (I actually thought distlib included the exes, but the
version bundled with pip at the moment doesn't have them).

The fun bit is having to modify setuptools to do our own script wrapper
management, because setuptools doesn't let us customise its process to
remove the runtime dependency on a top-level pkg_resources. Having to make
project-specific customisations to distutils feels like we're going in
precisely the opposite direction from what the whole packaging process is
trying to achieve, and it makes me feel vaguely unclean having to consider
it :-)

Two thoughts for the wider audience:

1. Should pip re-vendor a newer version of distlib, so we have the exe
wrappers? We currently have 0.1.1 and 0.1.2 is on PyPI.
2. Would writing a distutils extension class in setup.py to make the exe
wrappers using the vendored distlib.scripts package be acceptable to remove
the runtime dependency on pkg_resources from the wrappers?

Note: This is just one relatively small step towards removing some of our
dependencies on an external setuptools. It's not the whole story, and it
still leaves the "upgrading a running exe wrapper" problem to address.

(This discussion may be worth migrating to pypa-dev, I'm not sure how much
the wider distutils audience cares about this level of detail - feel free
to switch lists anyone who thinks it's appropriate).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20130716/fc32c28c/attachment.html>

More information about the Distutils-SIG mailing list