[Distutils] FINAL DRAFT: Dependency specifier PEP

Paul Moore p.f.moore at gmail.com
Tue Nov 17 14:53:52 EST 2015


On 17 November 2015 at 18:43, Robert Collins <robertc at robertcollins.net> wrote:
>> By including the URL syntax, we're mandating that conforming
>> implementations *have* to trap malformed URLs early, and can't defer
>> that validation to the URL library being used to process the URL.
>
> I don't understand how we're mandating that.

urlspec       = '@' wsp* <URI_reference>

combined with

 URI_reference = <URI | relative_ref>
 URI           = scheme ':' hier_part ('?' query )? ( '#' fragment)?
(etc)

implies that conforming parsers have to validate that what follows '@'
must conform to the URI definition. So they have to reject @:::::
because ::::: is not a valid URI. But why bother? It's extra work, and
given that all an implementation will ever do with the URI_reference
is pass it to a function that treats it as a URI, and that function
will do all the validation you need.

I'd argue that the spec can simply say

URI_reference = <string with no whitespace>

The discussion of how a urlspec is used can point out that the string
will be assumed to be a URI.

A library that parsed any non-whitespace string as a URI_reference
would be just as useful for all practical purposes, and much easier to
write (and test!) But it would technically be non-conformant to this
PEP.

Personally, I don't actually care all that much, as I probably won't
ever write a library that implements this spec. The packaging library
will be fine for me. But given that the point of writing the
interoperability PEPs is to ensure people *can* write alternative
implementations, I'm against adding complexity and implementation
burden that has no practical benefit.

Paul


More information about the Distutils-SIG mailing list