-
-
Notifications
You must be signed in to change notification settings - Fork 639
refactor(gazelle): Generate a modules map per wheel, then merge #3415
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
refactor(gazelle): Generate a modules map per wheel, then merge #3415
Conversation
Summary of ChangesHello @thejcannon, 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 introduces a significant refactoring to how Gazelle generates its modules mapping. The core change involves splitting the mapping generation into a per-wheel process, where each Python wheel is processed independently to create its own module map. These individual maps are then consolidated by a new merging utility. This approach is intended to enhance build performance by taking advantage of Bazel's inherent concurrency and caching mechanisms, which is particularly beneficial for projects with extensive dependency trees. Highlights
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
|
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.
Code Review
This pull request refactors the module mapping generation to be per-wheel, which is a great improvement for performance and caching in large projects. The approach of generating intermediate files for each wheel and then merging them is sound and well-implemented in Bazel. The new merger.py script is clean and efficient.
I have a couple of suggestions to improve the code further. One is to make the new test for the merger more robust by using a better pattern for temporary files. The other is a minor suggestion to improve the naming of the intermediate files for better readability and debugging.
Overall, this is a solid refactoring that leverages Bazel's strengths effectively.
dougthor42
left a comment
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.
Nice! This looks like a great speed increase.
This change internally splits modules mapping generation to be per-wheel, with a final quick "merge" action at the end.
The idea is to make this process both concurrent and cached (courtesy of Bazel), which can be ideal for codebases with a large set of requirements (as many monorepos end up doing)
Note that the
generator.pyinterface changed. This seemed internal, so I didn't mark it breaking (but this change could actually just leave the generator alone, since the current implementation is fine with 1 wheel).I ran this on the work repo and saw no change in output (but as I edited a single requirement, the overall process was fast ⚡ )