[Python-Dev] Fwd: PEP 426 is now the draft spec for distribution metadata 2.0

Paul Moore p.f.moore at gmail.com
Tue Feb 19 21:25:30 CET 2013
On 19 February 2013 13:40, Nick Coghlan <ncoghlan at gmail.com> wrote:
>> If a tools wants to support metadata 2.0, it has to support all
>> the complicated stuff as well, i.e. handle the requires fields,
>> the environment markers and version comparisons/sorting.
>
> Which is what distutils2 can be used for now, and what distlib will
> provide without the unwanted build system infrastructure in
> distutils2.

One particular item in Metadata 2.0 which needs to be addressed is
requirements specifiers, as used in (for example) Requires-Dist. These
take forms like "DistName (>= ver)". There are a number of potential
issues here:

1. This differs from the pkg_resources format (which omits the
parentheses). Having 2 subtly different formats is not a good idea in
the long term. At the moment, pkg_resources format is used in pip
requirements (on the command line and in requirement files) as well as
in setuptools/distribute and possibly elsewhere.
2. There is currently no code that I am aware of that implements this
spec. I don't believe distlib does (yet - give Vinay 5 minutes and who
knows? :-)), pkg_resources as I said implements a different format,
and distutils2, apart from being a big dependency to cover just this
point, only matches the version (not the project name) and presumably
does so using the distutils2 version ordering (which is incompatible
with Metadata 2.0).
3. The format is fiddly to parse and process - nobody is likely to
implement it for themselves without a library that does it (especially
not when using pkg_resources is so easy).

The PEP needs a rationale as to why the pkg_resources format wasn't
used, and should suggest a migration path for projects which currently
use the pkg_resources style (such as pip's requirements files).

Paul


More information about the Python-Dev mailing list