[Distutils] PEP 440 ad PEP 508 requirement formats

Nick Coghlan ncoghlan at gmail.com
Sat Jan 16 10:46:59 EST 2016


On 16 January 2016 at 00:12, Paul Moore <p.f.moore at gmail.com> wrote:
> Pip refers to PEP 440 when defining the format of a requirement (see
> https://pip.pypa.io/en/stable/reference/pip_install/#requirement-specifiers).
> But PEP 508 *also* defines a requirement - the title implies that it's
> for dependency specification, but the content of the PEP says "the
> language defined is a compact line based format which is already in
> widespread use in pip requirements files".
>
> So what's the relationship between PEP 440 and PEP 508? Which one is
> the definitive definition of what is a "requirement"? The "packaging"
> library implements specifiers which conform (according to the docs) to
> PEP 440.

As Donald already noted, 508 is the higher level specification, that
includes 440 by reference to cover the "version specifier" section of
a full dependency specifier

The key parts that 508 adds above and beyond 440 are:

- package names (the current rules were previously only given in the 426 draft)
- extras
- environment markers

The main benefit of keeping the two levels separate is that there's a
*lot* of arcana in PEP 440 around version ordering and how that
relates to version comparison operators that you don't really need to
think about when working at the level of processing a list of
dependency specifiers.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Distutils-SIG mailing list