[Distutils] Comments on PEP 426

Oscar Benjamin oscar.j.benjamin at gmail.com
Wed Sep 4 13:37:08 CEST 2013


On 4 September 2013 12:20, Paul Moore <p.f.moore at gmail.com> wrote:
> On 4 September 2013 12:05, Oscar Benjamin <oscar.j.benjamin at gmail.com> wrote:
>> Also would this be sufficient to decouple pip and setuptools (a
>> reasonable goal in itself)? Or does pip depend on setuptools in more
>> ways than the distutils monkey-patching?
>
> I've not got round to reviewing the code (it's on my list) but I think
> it would be sufficient. There is a fair amount of internal pip use of
> *pkg_resources* (for versions, requirements parsing, and such like)
> but that's a somewhat different matter - it would be trivial to
> extract and vendor pkg_resources if we so wished.
>
> We may still need the "inject setuptools" hack in certain cases,
> simply because pure-distutils packages simply don't provide that
> interface out of the box. And that may be a major issue because
> there's no obvious way to detect when a project needs that hack
> without the project saying so, or us making an assumption. But it's
> much less of a technical issue at that point.

What I meant was: If distutils gained the minimal missing setuptools
commands then would that be sufficient to decouple setuptools and pip.
I guess you've answered that above as "probably".

I don't know what commands pip requires but for the sake of argument
let's imagine that it's bdist_wheel and egg_info. Then if distutils as
of Python 3.4 (more realistically 3.5...) gained those commands then
pip would be able to know very easily whether it needed to inject
setuptools:

if sys.version_info < (3, 4):
    inject_setuptools()

Or perhaps

from distutils.somewhere import cmdclasses

if not ('bdist_wheel' in cmdclasses and 'egg_info' in cmdclasses):
    inject_setuptools()


Oscar


More information about the Distutils-SIG mailing list