-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(datasource/pypi): handle non-normalized package names for pypi simple lookup #30716
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//cc @not7cd if you have some time I would highly appreciate your feedback/review of the pypi lookup logic. |
not7cd
reviewed
Aug 12, 2024
lib/modules/datasource/pypi/__fixtures__/versions-html-with-periods.html
Outdated
Show resolved
Hide resolved
viceice
reviewed
Aug 12, 2024
not7cd
approved these changes
Aug 12, 2024
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.
LGTM
Co-authored-by: Norbert Szulc <[email protected]>
viceice
approved these changes
Aug 14, 2024
🎉 This issue has been resolved in version 38.29.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
zharinov
pushed a commit
to zharinov/renovate
that referenced
this pull request
Aug 15, 2024
…mple lookup (renovatebot#30716) Co-authored-by: Norbert Szulc <[email protected]>
kosmoz
pushed a commit
to kosmoz/renovate
that referenced
this pull request
Aug 16, 2024
…mple lookup (renovatebot#30716) Co-authored-by: Norbert Szulc <[email protected]>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Changes
This PR revises the logic for extracting the version from
extractVersionFromLinkText
. The challenge arises because the HTML tag contains both the non-normalized name and the version, making it difficult to discern where the name ends and the version begins. This issue became prominent after PR #27733/v38, where we only have the normalized name available during lookup. Thus, it's necessary to verify if the detected name matches the normalized name.The approach involves normalizing the tag text and confirming it matches the
packageName
. Once verified, the package name is removed from the non-normalized tag name using the length of the normalized name to isolate the version. It's essential to note that the normalized name can differ in length, and this discrepancy is accounted for.Additionally, the
normalizeName
function has been removed, and we now rely on the centralized implementation ofnormalizePythonDepName
, which adheres to the standard normalization procedure.We support two formats:
{name}-{version}.tar.gz
(specification){distribution}-{version}(-{build tag})?-{python tag}-{abi tag}-{platform tag}.whl
(specification)Both
name
anddistribution
correspond to thepackageName
with-
replaced by_
. A newer spec replaces.
with_
. However, since we convert back to the normalized form and transform all three characters_-.
to-
, the comparison remains unaffected.It’s also worth noting that package names with multiple instances of
.-_
reduced to-
are rare. Across all of PyPI, there are only 29 such packages, with most being empty:Context
Fixes #30712, which caused Renovate to fail to lookup pypi packages with special characters (
.
) in their name.Documentation (please check one with an [x])
How I've tested my work (please select one)
I have verified these changes via: