-
Notifications
You must be signed in to change notification settings - Fork 542
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
feat(whl_library): generate platform-specific dependency closures #1593
Conversation
960ad4c
to
e85bd8b
Compare
python/pip_install/private/generate_whl_library_build_bazel.bzl
Outdated
Show resolved
Hide resolved
continue | ||
|
||
if not platforms: | ||
# old behaviour, where we target the host platform |
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.
Something I learned last week: Bazel has a builtin repository that tells you the host system's constraints.
load("@local_config_platform//:constraints.bzl", "HOST_CONSTRAINTS")
(Not sure where we could use this, just passing along a TIL)
I think the resultant BUILD.bazel files are good enough for it to be considered for merging. @arrdem, cc-ing you as you've spent quite some time on this topic recently and would love to hear your opinion/feedback on the change. |
37cfde3
to
f1d187c
Compare
This is to ensure that we can represent select of lists in a better way
Before this change, the dependency closures would be influenced by the host-python interpreter, this removes the influence by detecting the platforms against which the `Requires-Dist` wheel metadata is evaluated. This functionality can be enabled via `target_platforms` attribute to the `pip.parse` extension and is showcased in the `bzlmod` example. The same attribute is also supported on the legacy `pip_parse` repository rule. The detection works in the following way: - Check if the python wheel is platform specific or cross-platform (i.e., ends with `any.whl`), if it is then platform-specific dependencies are generated, which will go through a `select` statement. - If it is platform specific, then parse the platform_tag and evaluate the `Requires-Dist` markers assuming the target platform rather than the host platform. NOTE: The `whl` `METADATA` is now being parsed using the `packaging` Python package instead of `pkg_resources` from `setuptools`. Fixes bazelbuild#1591
f1d187c
to
38b3dfe
Compare
Co-authored-by: Richard Levasseur <richardlev@gmail.com>
Before this change, the dependency closures would be influenced by the
host-python interpreter, this removes the influence by detecting the
platforms against which the
Requires-Dist
wheel metadata is evaluated.This functionality can be enabled via
experimental_target_platforms
attribute to the
pip.parse
extension and is showcased in thebzlmod
example. The same attribute is also supported on the legacy
pip_parse
repository rule.
The detection works in the following way:
(i.e., ends with
any.whl
), if it is then platform-specificdependencies are generated, which will go through a
select
statement.
the
Requires-Dist
markers assuming the target platform rather thanthe host platform.
NOTE: The
whl
METADATA
is now being parsed using thepackaging
Python package instead of
pkg_resources
fromsetuptools
.Fixes #1591