[Distutils] Metadata 2.0: Is there a formal spec for a requirement?

Donald Stufft donald at stufft.io
Tue Sep 16 13:02:00 CEST 2014


Specifiers are defined in PEP 440 (the >=1.0 parts), however PEP 426 combines
those with the package names to get “foo >=1.0”. The packaging library implements
the specifier part.

> On Sep 16, 2014, at 6:59 AM, Paul Moore <p.f.moore at gmail.com> wrote:
> 
> I feel as though I must be missing something obvious, but is there an
> actual specification of the syntax and semantics of a requirement
> anywhere? I've scanned through the PEP, and while there is a spec for
> the environment marker mini-language, there isn't one for a
> requirement. (As a check I hadn't missed anything obvious, I did a
> text search for the operator ">=" which *is* a valid operator in a
> requirement, and it's not present in a syntax definition or anything
> equivalent.
> 
> I ask because I'm looking for a way to find a way of matching a set of
> package/version details against a requirement, and I was coming up
> blank. So I was going to write my own, and then I found that there's
> no spec :-(
> 
> Surely having a spec for a requirement has to be part of the sign-off
> requirements for Metadata 2.0?
> 
> Digging a bit further, there is (of course, doh!) the pkg_resources
> requirement parser. But even if that is definitive, I think it should
> be integrated into the Metadata 2.0 spec, or at the very least
> referenced from there (and just having a reference risks the
> possibility of setuptools accidentally making changes outside of the
> PEP process).
> 
> Paul
> 
> [1] Pip's code is too complex to factor out the bits I want, and
> distlib's version matcher seems to support a different syntax if the
> docs are correct.
> _______________________________________________
> Distutils-SIG maillist  -  Distutils-SIG at python.org
> https://mail.python.org/mailman/listinfo/distutils-sig

---
Donald Stufft
PGP: 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA

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


More information about the Distutils-SIG mailing list