[Distutils] FINAL DRAFT: Dependency specifier PEP

Paul Moore p.f.moore at gmail.com
Tue Nov 17 13:10:26 EST 2015


On 17 November 2015 at 17:32, Robert Collins <robertc at robertcollins.net> wrote:
>> The only place where URIs are used seem to be the "urlspec" rule, and
>> probably you can accept any opaque string there.
>
> Uhm, why are you making this suggestion? What problem will we solve by
> using a proxy rule?

I think the point here is syntax vs semantics. It is simpler to parse
if we make the *syntax* state that an opaque string is allowed here.
The *semantics* can then say that the string is to be handled as a
URL, meaning that any string that isn't a valid URL will fail when we
try to pass it to urllib or whatever.

The only advantage of *parsing* it as a URL is that we get to reject
foo::::/bar:baz as a syntax error. But we'd still reject foo:/bar as
an invalid URL (unknown protocol) later in the processing, so why
bother trying to trap the specific error of "doesn't look like a URL"
early?

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.

Paul


More information about the Distutils-SIG mailing list