Skip to content

Commit 9bc2489

Browse files
committed
Merge branch 'main' of https://github.com/bazel-contrib/rules_python into fix.symlink.shared.libs.directly
2 parents 946364d + 5c13539 commit 9bc2489

File tree

8 files changed

+1142
-22
lines changed

8 files changed

+1142
-22
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ END_UNRELEASED_TEMPLATE
131131
* {obj}`//python:features.bzl%features.headers_abi3` can be used to
132132
feature-detect the presense of the above.
133133
* (toolchains) Local toolchains can use a label for the interpreter to use.
134+
* (pypi) Support for environment marker handling and `experimental_index_url` handling for
135+
Windows ARM64 for Python 3.11 and later
136+
([#2276](https://github.com/bazel-contrib/rules_python/issues/2276)).
134137

135138
{#v1-6-3}
136139
## [1.6.3] - 2025-09-21

MODULE.bazel

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,35 @@ pip = use_extension("//python/extensions:pip.bzl", "pip")
171171
]
172172
]
173173

174+
[
175+
pip.default(
176+
arch_name = cpu,
177+
config_settings = [
178+
"@platforms//cpu:{}".format(cpu),
179+
"@platforms//os:windows",
180+
"//python/config_settings:_is_py_freethreaded_{}".format(
181+
"yes" if freethreaded else "no",
182+
),
183+
],
184+
env = {"platform_version": "0"},
185+
marker = "python_version >= '3.13'" if freethreaded else "python_version >= '3.11'",
186+
os_name = "windows",
187+
platform = "windows_{}{}".format(cpu, freethreaded),
188+
whl_abi_tags = ["cp{major}{minor}t"] if freethreaded else [
189+
"abi3",
190+
"cp{major}{minor}",
191+
],
192+
whl_platform_tags = whl_platform_tags,
193+
)
194+
for cpu, whl_platform_tags in {
195+
"aarch64": ["win_arm64"],
196+
}.items()
197+
for freethreaded in [
198+
"",
199+
"_freethreaded",
200+
]
201+
]
202+
174203
pip.parse(
175204
hub_name = "rules_python_publish_deps",
176205
python_version = "3.11",

examples/BUILD.bazel

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,28 @@ lock(
2828
],
2929
python_version = "3.9.19",
3030
)
31+
32+
lock(
33+
name = "bzlmod_requirements_3_11",
34+
srcs = ["bzlmod/requirements.in"],
35+
out = "bzlmod/requirements_lock_3_11.txt",
36+
args = [
37+
"--emit-index-url",
38+
"--universal",
39+
"--python-version=3.11",
40+
],
41+
python_version = "3.11",
42+
)
43+
44+
lock(
45+
name = "bzlmod_requirements_3_11_windows",
46+
srcs = ["bzlmod/requirements.in"],
47+
out = "bzlmod/requirements_windows_3_11.txt",
48+
args = [
49+
"--emit-index-url",
50+
"--python-platform",
51+
"windows",
52+
"--python-version=3.11",
53+
],
54+
python_version = "3.11",
55+
)

examples/bzlmod/MODULE.bazel

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,13 @@ pip.default(
169169
env = {
170170
"platform_version": "0",
171171
},
172+
# Windows ARM64 support has been added only on 3.11 and above, hence, constrain
173+
# the availability of the platform for those python versions.
174+
marker = "python_version >= '3.11'",
172175
os_name = "windows",
173176
platform = "windows_aarch64",
174177
whl_abi_tags = [], # default to all ABIs
175-
whl_platform_tags = ["win_amd64"],
178+
whl_platform_tags = ["win_arm64"],
176179
)
177180

178181
# To fetch pip dependencies, use pip.parse. We can pass in various options,
@@ -206,14 +209,6 @@ pip.parse(
206209
"sphinxcontrib-serializinghtml",
207210
],
208211
},
209-
# You can use one of the values below to specify the target platform
210-
# to generate the dependency graph for.
211-
experimental_target_platforms = [
212-
# Specifying the target platforms explicitly
213-
"cp39_linux_x86_64",
214-
"cp39_linux_*",
215-
"cp39_*",
216-
],
217212
extra_hub_aliases = {
218213
"wheel": ["generated_file"],
219214
},
@@ -239,30 +234,34 @@ pip.parse(
239234
"sphinxcontrib-serializinghtml",
240235
],
241236
},
242-
# You can use one of the values below to specify the target platform
243-
# to generate the dependency graph for.
244-
experimental_target_platforms = [
245-
# Using host python version
246-
"linux_*",
247-
"osx_*",
248-
"windows_*",
249-
# Or specifying an exact platform
250-
"linux_x86_64",
251-
# Or the following to get the `host` platform only
252-
"host",
253-
],
254237
hub_name = "pip",
255238
python_version = "3.10",
256239
# The requirements files for each platform that we want to support.
257240
requirements_by_platform = {
258241
# Default requirements file for needs to explicitly provide the platforms
259242
"//:requirements_lock_3_10.txt": "linux_*,osx_*",
243+
"//:requirements_windows_3_10.txt": "windows_x86_64",
244+
},
245+
# These modifications were created above and we
246+
# are providing pip.parse with the label of the mod
247+
# and the name of the wheel.
248+
whl_modifications = {
249+
"@whl_mods_hub//:requests.json": "requests",
250+
"@whl_mods_hub//:wheel.json": "wheel",
251+
},
252+
)
253+
pip.parse(
254+
hub_name = "pip",
255+
python_version = "3.11",
256+
requirements_by_platform = {
257+
# Default requirements file for needs to explicitly provide the platforms
258+
"//:requirements_lock_3_11.txt": "linux_*,osx_*",
260259
# This API allows one to specify additional platforms that the users
261260
# configure the toolchains for themselves. In this example we add
262261
# `windows_aarch64` to illustrate that `rules_python` won't fail to
263262
# process the value, but it does not mean that this example will work
264263
# on Windows ARM.
265-
"//:requirements_windows_3_10.txt": "windows_x86_64,windows_aarch64",
264+
"//:requirements_windows_3_11.txt": "windows_x86_64,windows_aarch64",
266265
},
267266
# These modifications were created above and we
268267
# are providing pip.parse with the label of the mod

0 commit comments

Comments
 (0)