-
-
Notifications
You must be signed in to change notification settings - Fork 630
feat(modules_mapping): add skip_private_shared_objects parameter for hermetic gazelle file generation #3297
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
base: main
Are you sure you want to change the base?
feat(modules_mapping): add skip_private_shared_objects parameter for hermetic gazelle file generation #3297
Conversation
Fixes platform-specific inconsistency in gazelle_python_manifest where different native libraries (.so files) in platform-specific wheels caused different manifests on Linux vs macOS. Changes: - Add ignore_native_libs parameter to modules_mapping rule (default: False) - Skip .so file processing in generator.py when flag is enabled - Add comprehensive test coverage for the new functionality Usage: ```starlark modules_mapping( name = "modules_map", wheels = all_whl_requirements, ignore_native_libs = True, # Enables hermetic cross-platform builds ) ``` This solves the opencv-python-headless case and similar packages with platform-specific native libraries, enabling hermetic builds across different development platforms.
Summary of ChangesHello @AFMiziara, 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 enhancement to the 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 introduces a useful ignore_native_libs
flag to improve build hermiticity for Python projects with platform-specific native libraries. The implementation is on the right track, but I've identified a key improvement to make it fully functional across platforms like macOS by handling .dylib
files in addition to .so
files. I've also suggested updates to the documentation and tests to reflect this change. Overall, this is a valuable addition.
Another approach would be to support adding a list to ignore specific dependencies. |
Removed commented line about enabling hermetic builds.
Right now users can add regex to exclude certain entries. I assume that this is how users currently work this around. |
@aignas do you think we should keep the use of this via regex? I was thinking one day this could actually be default behavior, because these |
Summary
Adds
skip_private_shared_objects
parameter tomodules_mapping
rule to enable hermetic builds across platforms. When enabled, excludes private shared objects under.libs
directories from modules mapping, which fixes inconsistent manifest generation between Linux and macOS for packages with platform-specific dependency libraries.Problem
The
gazelle_python_manifest
generates different manifest files on different platforms due to private shared objects in.libs
directories that appear in Linux wheels but not macOS wheels.For example, with
opencv-python-headless
,numpy
and probably many others:Linux wheels contain:
macOS wheels omit these files because macOS uses system frameworks (like Accelerate) instead of bundled libraries like OpenBLAS.
These
.libs
files are private dependency libraries that are not directly imported in Python code - they exist solely for the underlying C/C++ dependencies. When the generator processes them, it creates module mappings that vary between platforms, breaking build hermiticity.