Subject: Re: [PATCHv2] Re: pypi importer outputs strange character series in optional dependency case.

From: Ricardo Wurmus <[email-masked]>
Date: Mon, 10 Jun 2019 11:12:03 +0200

Maxim Cournoyer <[email-masked]> writes:

> While I agree that a regexp is a bigger hammer than basic string
> manipulation, I see some merit to it here:
>
> 1) We can be assured of conformance with upstream, again, per PEP-0508.
> 2) It is easier to extend; we might want to add parsing for the version
> spec in order to disregard dependencies specified for Python < 3, for
> example.
>
> The use of the PEP-0508 grammar to define the regexp is useful to detail
> in a more human-friendly language the components of the regexp.  We
> could have otherwise used the more cryptic regexp for Python
> distribution names:
>
> --8<---------------cut here---------------start------------->8---
> ^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$
> --8<---------------cut here---------------end--------------->8---
>
> So I guess that what I'm saying is that I prefer this approach to using
> string-index with invalid characters, for the reasons above.
>
> [0]  https://www.python.org/dev/peps/pep-0508/

Okay, sounds good.  Please make sure to note this in a comment, so that
I won’t be asking myself this same question in a year :)

--
Ricardo