-
Notifications
You must be signed in to change notification settings - Fork 539
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
exp: multi-arch whl_library in bzlmod #1625
Changes from 46 commits
e97a75b
ea0f2ba
bc41145
e29ae54
393446b
3aa23a2
1e9f6fd
d78f282
ff2d000
b82ac46
75be4c7
c01e65a
5b637cb
42f916d
825d28d
1b91882
0401d77
f65d6ad
0751ad8
764d453
484a061
242d960
6eb77fd
1c0d38b
89b9a79
5ba4606
0db226f
c1eba5e
2871a7c
aff93fa
f698068
ccf6154
8300db1
f8dabc1
d484d61
574aff6
32b8d7d
a54873e
8e4ac60
c4e9524
3cb70b2
ccd5d79
1bd46fb
6ad2035
5fb780d
cb91638
a3d6078
b272578
6ce5d11
2b9c686
241f93a
9b24bd9
ea160ce
350d006
44b995e
02a00bc
1af04ea
2dd0791
eda65d4
86747f7
b19e9dd
655e400
1d71aae
7e60f55
28d5b9d
a82d3d7
5f65e16
0afe5b3
a759cf6
4daddcf
636806b
3d6e8bd
4840d42
1a97810
169a4c1
a4af2bb
a923fdb
b7e31db
2aeda3b
e778402
12a428e
844913a
f8319c3
79cf3a5
dd201b0
7392dcd
333f35f
abf60c1
5fa7077
6fad811
9dca6aa
91a73b8
e32cb68
d66b27b
51474e4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
6.0.0 | ||
7.0.0 | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
bazel-* | ||
MODULE.bazel.lock |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,15 @@ use_repo(python, "python_3_10", "python_3_9", "python_versions") | |
# You are able to set a hub name, so that you can have different modifications of the same | ||
# wheel in different pip hubs. | ||
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip") | ||
pip.experimental_target_platforms( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. first thought: this looks like more than just configuring platforms? Looks like more general pip overrides. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I'll finalize the naming later. |
||
enabled = True, | ||
# Specify PyPI indexes in the order of preference. If the package is not found in the first | ||
# index, it will be looked up in the next one, which means that it makes it useful to order | ||
# the index URLs by the number of packages it contains. | ||
extra_index_urls = [], | ||
# Specify the main PyPI index URL to use. This is value the default. | ||
index_url = "https://pypi.org/simple", | ||
) | ||
|
||
# Call whl_mods.create for the requests package. | ||
pip.whl_mods( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Copyright 2022 The Bazel Authors. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
"""Helpers copied from http_file source to be reused here. | ||
|
||
The implementation below is copied directly from Bazel's implementation of `http_archive`. | ||
Accordingly, the return value of this function should be used identically as the `auth` parameter of `http_archive`. | ||
Reference: https://github.com/bazelbuild/bazel/blob/6.3.2/tools/build_defs/repo/http.bzl#L109 | ||
""" | ||
|
||
# TODO @aignas 2023-12-18: use the following instead when available. | ||
# load("@bazel_tools//tools/build_defs/repo:utils.bzl", "get_auth") | ||
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "read_netrc", "read_user_netrc", "use_netrc") | ||
|
||
def get_auth(rctx, urls): | ||
"""Utility for retrieving netrc-based authentication parameters for repository download rules used in python_repository. | ||
|
||
Args: | ||
rctx (repository_ctx): The repository rule's context object. | ||
urls: A list of URLs from which assets will be downloaded. | ||
|
||
Returns: | ||
dict: A map of authentication parameters by URL. | ||
""" | ||
if rctx.attr.netrc: | ||
netrc = read_netrc(rctx, rctx.attr.netrc) | ||
elif "NETRC" in rctx.os.environ: | ||
netrc = read_netrc(rctx, rctx.os.environ["NETRC"]) | ||
else: | ||
netrc = read_user_netrc(rctx) | ||
return use_netrc(netrc, urls, rctx.attr.auth_patterns) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright 2023 The Bazel Authors. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
"A small utility to create a label usable internally" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Er, huh? What's this? It looks like its trying to...get a reference to... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, this is one of the ways for us to construct a label that we can pass to repositories created by pip. This would be unneeded if bazelbuild/bazel#19055 was fixed in 7.1.0 and we used it. |
||
|
||
_this = str(Label("//:unknown")) | ||
|
||
def label(label): | ||
"""This function allows us to construct labels to pass to rules.""" | ||
prefix, _, _ = _this.partition("//") | ||
prefix = prefix + "~pip~" | ||
return Label(label.replace("@", prefix)) |
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.
Is this a new minimum version? I'm not sure we can bump to 7 -- we still need to support 6. We can bump this to 6.4, though.