-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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(pypi): lookup simple api first #26505
Conversation
lib/modules/datasource/pypi/index.ts
Outdated
} | ||
return dependency; | ||
// merge results | ||
return Object.assign({}, simpleDependencies, pypiJsonDependencies); |
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.
return Object.assign({}, simpleDependencies, pypiJsonDependencies); | |
return { | |
...simpleDependencies, | |
...pypiJsonDependencies | |
}; |
Will all pypiJsonDependencies the same information as the simple ones.
As this will overwrite releases
.
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.
You are right. Maybe concatenating the found releases is better? If I saw it correctly, the dependencies should be de-duplicated 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.
I prefer to deduplicate in the datasource
Co-authored-by: Sebastian Poxhofer <[email protected]>
This comment has been minimized.
This comment has been minimized.
simpleHostUrl, | ||
).catch((err) => { | ||
if (err.statusCode !== 404) { | ||
throw err; |
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.
This may be too aggressive. Custom registries can sometimes return weird things and we don't necessarily want to give up
// merge results | ||
return { | ||
releases: [], | ||
...simpleDependencies, | ||
...pypiJsonDependencies, | ||
}; |
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.
We should dedupe first
@Kakadus do you have any time to resume this PR? |
Closing due to inactivity and conflicts. Reopening or replacing this PR in future would be welcomed |
Changes
This rewrites the
getReleases
function of pypi datasources:First, the the simple (pypi) api is queried, then the pypijson api is retried on 404s or to enrich the metadata.
For that, I adapted the formerly named
getDependencies
functions to add their resolved data to an existing Result.Previously, the simple api was only used, if pypijson returned 404.
The unit tests stayed mostly the same, but the simple api routes needed to be mocked. Also added testcases to check that both simple and json pypi apis are used, and dependency resolution succeeds if json api is unavailable.
Context
Closes #26483.
As pypijson is used additionally, #26383 is resolved as well.
Documentation (please check one with an [x])
How I've tested my work (please select one)
I have verified these changes via: