[Distutils] Comments on PEP 426
Paul Moore
p.f.moore at gmail.com
Sun Sep 8 15:59:24 CEST 2013
On 8 September 2013 12:44, Oscar Benjamin <oscar.j.benjamin at gmail.com> 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).
I may be wrong here, I haven't tried it, but I assumed that having
both setup.py and setuptools try to register an egg-info command would
cause a clash. But as you point out the user's cmdclass is explicitly
specified in the setup call, so maybe it would just work.
>> 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?
Precisely that. setuptools produces an egg format directory then.
>> 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.
Fair point. As I say, it's not a showstopper, even if there *is* a
need to do something, pip could likely do whatever's needed.
Paul
More information about the Distutils-SIG
mailing list