[Distutils] Comments on PEP 426

Oscar Benjamin oscar.j.benjamin at gmail.com
Sun Sep 8 13:44:13 CEST 2013


On 8 September 2013 12:07, Paul Moore <p.f.moore at gmail.com> wrote:
> On 7 September 2013 23:36, Carl Meyer <carl at oddbird.net> wrote:
>
> The *other* problem is that a custom implementation of an egg-info
> command is pretty much certain to be incompatible with pip injecting
> setuptools. And that's the big issue, injecting setuptools actively
> prevents people writing their own implementations of the relevant
> command line APIs.

What makes you say that? I haven't checked but I assumed that the pip
injecting setuptools situation wouldn't override a custom command
provided by:

setup(..., cmdclass={'egg_info': MyEggInfo}, ...)

Or is it that the action of the egg_info command is not fully
specified anywhere? AFAICT the command is reasonably stable, so
someone could implement their own without too much difficulty (not
that package authors should be expected to do this).

>>> It seems like the egg_info command is the sole
>>> reason, or did I miss something?
>>
>> Also the installation command (not having to detect what the setup.py
>> uses and decide accordingly whether to supply
>> --single-version-externally-managed)
>
> That to me is a major issue with setuptools, as it *behaves
> differently* than distutils does for the same command line. But
> setting that aside, again a setup.py could implement a custom cmdclass
> that simply ignores the --single-version-externally-managed flag on
> install. And again, doing so could easily be incompatible with
> setuptools injection.

Can you elaborate on how it behaves differently? Do you mean that when
the --single-version-externally-managed option is not provided the
install command would do something different in a setuptools setup.py
compared iht a vanilla distutils setup.py?

>> and the installed format, which I
>> already mentioned but you snipped in your reply. (Setuptools with
>> --single-version-externally-managed installs metadata in a .egg-info
>> dir, plain distutils just installs a single file of metadata, not a
>> directory; the directory gives pip a place to put the results of --record).
>
> That is an issue which hasn't been picked up on yet. But I'd argue
> that pip could easily check what version the setup.py created and
> adapt accordingly (upgrading the single-file format to the directory
> format). Sure, it doesn't, because the setuptools injection makes it
> unnecessary. But that's getting cause and effect backwards...

It wouldn't be too hard for pip to do this. The relevant code is here:
https://github.com/pypa/pip/blob/develop/pip/req.py#L643

However pip doesn't get to that point without having first called
egg_info. So the setup.py in question would have to implement
setuptools-style .egg-info format anyway unless the egg_info command
were permitted to supply metadata in a different format.


Oscar


More information about the Distutils-SIG mailing list