-
Notifications
You must be signed in to change notification settings - Fork 544
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(pip.parse): make the pip extension reproducible if PyPI is not called #1937
Conversation
…lled With this PR we can finally have fewer lock file entries in setups which do not use the `experimental_index_url` feature yet. This is fully backwards compatible change as it relies on `bazel` doing the right thing and regenerating the lock file. Fixes bazelbuild#1643.
FYI @fmeum |
python/private/bzlmod/pip.bzl
Outdated
|
||
if bazel_features.external_deps.extension_metadata_has_reproducible: | ||
# We allow for calling the PyPI index and that will go into the MODULE.bazel.lock file | ||
return module_ctx.extension_metadata(reproducible = False) |
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 is equivalent to not returning metadata at all, so you could remove the entire block.
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.
Good point, will do.
**_extension_extra_args() | ||
) | ||
|
||
pip_internal = module_extension( |
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 needs to declare os/arch dependence.
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.
Not necessarily, since we are calling PyPI to get the right dependencies, the lock file will be the same on all platforms, so this can be removed, I'll change it so that it is the default behaviour.
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!
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
@aignas Would it be possible to get a release soon after this is merged? Bazel itself suffers from the per-os lockfile and having the extension marked as reproducible would greatly simplify the process of updating Bazel to build with Bazel 7.2.0. |
I don't have time today, and I would like to get #1837 into the release as well. If all goes well, the earliest I can do maybe tomorrow (or early next week) and Richard is on vacation this week. So early next week is probably a good worst case scenario. |
No hurry, any time next week would be perfect! |
…epo (#1837) With this change we add support for platform-specific wheel registration and doing the selection of which wheel is used at build time. This supports: - Different package versions for different platforms. - Use string_flags to configure what to fetch/select: - only whls, only sdist or auto mode. - libc version and `musl` vs `glibc` selection. - universal2 vs arch wheels for mac. - target osx version selection. Summary of changes: - The `uv pip install` would only warn the user of yanked packages but would not refuse to install them. Update our implementation to better match the same behaviour. - A previous PR has added the support for passing it in the `requirements_by_platform` and this just add the necessary code to make sure that we can also do the dependency management when parsing the `whl` `METADATA` files. - Only configure `dev_pip` deps for `linux` and `osx` platforms to not raise issues later. - Add a function for generating a `whl_library` name from a `filename`. - Add a macro for generating all config settings for a particular set of parameters. - Update `render_pkg_aliases` to also use those config settings. - Update the toolchain selection `target_settings` to use the `py_linux_libc` config setting. With this the user can register a `musl` linux toolchain if needed. We can also use similar `flag_values` to resolve #1876. - Integrate everything in the `pip` extension and setup cross-platform select statements. Work towards #1357, #260 Stacked on #1937
With this PR we can finally have fewer lock file entries in setups which
do not use the
experimental_index_url
feature yet. This is fullybackwards compatible change as it relies on
bazel
doing the rightthing and regenerating the lock file.
Fixes #1643.