Repository navigation
PEP 508: fix mistakes in the complete parsley grammar #3069
Description
Activity
I found another error this line:
gen_delims = ':' | '/' | '?' | '#' | '(' | ')?' | '@'
Is')?'really a delimiter?- changed the title
[-]PEP508: shouldn't pct_encoded contain two hexdigit?[/-][+]PEP508: fix mistakes in the complete parsley grammar[/+]on Mar 22, 2023 According to setction 2 of rfc3986, those are really mistakes and should be fixed
I created #3070 to address this issue
Accepted PEPs are generally considered to be historical documents. Where is the living document that carries this information?
- changed the title
[-]PEP508: fix mistakes in the complete parsley grammar[/-][+]PEP 508: fix mistakes in the complete parsley grammar[/+]on Mar 22, 2023 I only found two related peps on this topic: pep440 and pep508.
The reference page on pypa https://pip.pypa.io/en/stable/reference/requirement-specifiers refers to pep508
Ah! That page is the living document that I'm referring to, and since it cites PEP 508 as the specification, that means that this does need to be updated.
Next step: Need a subject-matter expert to confirm the correctness of the change.
- linked a pull request that will close this issuePEP 508: fix mistakes in the complete parsley grammar #3070
on Mar 22, 2023 I have another question on
versiondefinition:version = wsp* <( letterOrDigit | '-' | '_' | '.' | '*' | '+' | '!' )+>According to the regex implementation from https://github.com/pypa/packaging/blob/main/src/packaging/specifiers.py
_version_regex_str = r""" (?P<version> (?: # The identity operators allow for an escape hatch that will # do an exact string match of the version you wish to install. # This will not be parsed by PEP 440 and we cannot determine # any semantic meaning from it. This operator is discouraged # but included entirely as an escape hatch. (?<====) # Only match for the identity operator \s* [^\s;)]* # The arbitrary version can be just about anything, # we match everything except for whitespace, a # semi-colon for marker support, and a closing paren # since versions can be enclosed in them. ) | (?: # The (non)equality operators allow for wild card and local # versions to be specified so we have to define these two # operators separately to enable that. (?<===|!=) # Only match for equals and not equals \s* v? (?:[0-9]+!)? # epoch [0-9]+(?:\.[0-9]+)* # release # You cannot use a wild card and a pre-release, post-release, a dev or # local version together so group them with a | and make them optional. (?: \.\* # Wild card syntax of .* | (?: # pre release [-_\.]? (alpha|beta|preview|pre|a|b|c|rc) [-_\.]? [0-9]* )? (?: # post release (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*) )? (?:[-_\.]?dev[-_\.]?[0-9]*)? # dev release (?:\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*)? # local )? ) | (?: # The compatible operator requires at least two digits in the # release segment. (?<=~=) # Only match for the compatible operator \s* v? (?:[0-9]+!)? # epoch [0-9]+(?:\.[0-9]+)+ # release (We have a + instead of a *) (?: # pre release [-_\.]? (alpha|beta|preview|pre|a|b|c|rc) [-_\.]? [0-9]* )? (?: # post release (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*) )? (?:[-_\.]?dev[-_\.]?[0-9]*)? # dev release ) | (?: # All other operators only allow a sub set of what the # (non)equality operators do. Specifically they do not allow # local versions to be specified nor do they allow the prefix # matching wild cards. (?<!==|!=|~=) # We have special cases for these # operators so we want to make sure they # don't match here. \s* v? (?:[0-9]+!)? # epoch [0-9]+(?:\.[0-9]+)* # release (?: # pre release [-_\.]? (alpha|beta|preview|pre|a|b|c|rc) [-_\.]? [0-9]* )? (?: # post release (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*) )? (?:[-_\.]?dev[-_\.]?[0-9]*)? # dev release ) ) """When
version_cmpis '===', the regex[^\s;)]*allows any charater except '\s;)'.However, the parsley grammar only allows
[0-9a-zA-Z-_.*+!]on any condition. This is only correct for operators other than '==='Seeing as @pradyunsg has worked on this general code most recently and is active here, he might be someone else to ask for an expert opinion here (or know whom else to).
The complete parsley grammer in pep 508
My question is why
pct_encodedonly contains one hexdig? Shouldn't it bepct_encoded = '%' hexdig{2}?