Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By just reading the code here, it's not obvious that all wheel filename parsing errors here are guaranteed to relate to an invalid version part.
Would it make sense to catch the two exception separately with a slightly different deprecation message?
Or is there a guarantee here that all exceptions are due to the version part? In that case a little comment explaining that might be useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not guaranteed but it would have to occur under the following series of events:
_
that is valid in what the regex parses as "version" but is not actually part of the versionThis would therefore have to be a currently unknown error that wheel filenames can have that packaging does not support but pip's regex was passing on anyway.
The reason I am catching both exceptions is because I did the same in #12327 and I was borrowing that code, but in that PR the code was scanning a directory that could find arbitrary names and I saw both errors in my testing.
Happy to split catching the two different exceptions up and give an appropriate message for
PackagingInvalidWheelName
.