feat(pypi): store PyPI results as facts v2#3654
feat(pypi): store PyPI results as facts v2#3654aignas wants to merge 15 commits intobazel-contrib:mainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly upgrades the PyPI package resolution process by introducing a sophisticated caching system. It enables the storage of PyPI index query results as 'facts' within the Bazel lock file, which will enhance build reproducibility and minimize external network dependencies. The changes also introduce granular control over package versions retrieved from the cache, allowing for more precise dependency management. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
| # Each line follows the following pattern | ||
| # <a href="https://...#sha256=..." attribute1="foo" ... attributeN="bar">filename</a><br /> | ||
| # | ||
| # Sometimes the lines may be split, so we should seek until `<br />` |
There was a problem hiding this comment.
What I meant here is that yank reason sometimes spans multiple lines. It would be best to build a small tokenizing parser here.
There was a problem hiding this comment.
Code Review
This pull request introduces a significant feature to store PyPI query results as facts in the lock file, aiming to improve performance on subsequent runs. However, a critical security vulnerability exists in the handling of yanked packages: the parsing logic in parse_simpleapi_html.bzl ignores the data-yanked status if the reason provided by the index is empty. This violates the PyPI Simple Repository API specification and could lead to the installation of vulnerable packages. Furthermore, a critical bug in the new in-memory caching implementation prevents it from storing any data.
5c03595 to
8206cf5
Compare
8206cf5 to
b90cc51
Compare
This PR adds functionality needed to write data that we find useful on the
SimpleAPI responses to the lock file. I.e. this will no longer connect to
the network if it can find the necessary information in the lock file.
Improvements that could be done but I don't have time right now for (but
contributions are welcome):
sha256in addition toversionto do the filteringwhat we need to pull from the lock file. Whilst theoretically this could improve
how quickly we find things, not sure how better it would be in practise.
metadata_urlis thereand write the
Requires-Distto theMODULE.bazel.lockfile as facts.Superseeds #3559
Fixes #2731