Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ END_UNRELEASED_TEMPLATE
* {obj}`//python:features.bzl%features.headers_abi3` can be used to
feature-detect the presense of the above.
* (toolchains) Local toolchains can use a label for the interpreter to use.
* (pypi) Support for environment marker handling and `experimental_index_url` handling for
Windows ARM64 for Python 3.11 and later
([#2276](https://github.com/bazel-contrib/rules_python/issues/2276)).

{#v1-6-3}
## [1.6.3] - 2025-09-21
Expand Down
29 changes: 29 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,35 @@ pip = use_extension("//python/extensions:pip.bzl", "pip")
]
]

[
pip.default(
arch_name = cpu,
config_settings = [
"@platforms//cpu:{}".format(cpu),
"@platforms//os:windows",
"//python/config_settings:_is_py_freethreaded_{}".format(
"yes" if freethreaded else "no",
),
],
env = {"platform_version": "0"},
marker = "python_version >= '3.13'" if freethreaded else "python_version >= '3.11'",
os_name = "windows",
platform = "windows_{}{}".format(cpu, freethreaded),
whl_abi_tags = ["cp{major}{minor}t"] if freethreaded else [
"abi3",
"cp{major}{minor}",
],
whl_platform_tags = whl_platform_tags,
)
for cpu, whl_platform_tags in {
"aarch64": ["win_arm64"],
}.items()
for freethreaded in [
"",
"_freethreaded",
]
]

pip.parse(
hub_name = "rules_python_publish_deps",
python_version = "3.11",
Expand Down
25 changes: 25 additions & 0 deletions examples/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,28 @@ lock(
],
python_version = "3.9.19",
)

lock(
name = "bzlmod_requirements_3_11",
srcs = ["bzlmod/requirements.in"],
out = "bzlmod/requirements_lock_3_11.txt",
args = [
"--emit-index-url",
"--universal",
"--python-version=3.11",
],
python_version = "3.11",
)

lock(
name = "bzlmod_requirements_3_11_windows",
srcs = ["bzlmod/requirements.in"],
out = "bzlmod/requirements_windows_3_11.txt",
args = [
"--emit-index-url",
"--python-platform",
"windows",
"--python-version=3.11",
],
python_version = "3.11",
)
43 changes: 21 additions & 22 deletions examples/bzlmod/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,13 @@ pip.default(
env = {
"platform_version": "0",
},
# Windows ARM64 support has been added only on 3.11 and above, hence, constrain
# the availability of the platform for those python versions.
marker = "python_version >= '3.11'",
os_name = "windows",
platform = "windows_aarch64",
whl_abi_tags = [], # default to all ABIs
whl_platform_tags = ["win_amd64"],
whl_platform_tags = ["win_arm64"],
)

# To fetch pip dependencies, use pip.parse. We can pass in various options,
Expand Down Expand Up @@ -206,14 +209,6 @@ pip.parse(
"sphinxcontrib-serializinghtml",
],
},
# You can use one of the values below to specify the target platform
# to generate the dependency graph for.
experimental_target_platforms = [
# Specifying the target platforms explicitly
"cp39_linux_x86_64",
"cp39_linux_*",
"cp39_*",
],
extra_hub_aliases = {
"wheel": ["generated_file"],
},
Expand All @@ -239,30 +234,34 @@ pip.parse(
"sphinxcontrib-serializinghtml",
],
},
# You can use one of the values below to specify the target platform
# to generate the dependency graph for.
experimental_target_platforms = [
# Using host python version
"linux_*",
"osx_*",
"windows_*",
# Or specifying an exact platform
"linux_x86_64",
# Or the following to get the `host` platform only
"host",
],
hub_name = "pip",
python_version = "3.10",
# The requirements files for each platform that we want to support.
requirements_by_platform = {
# Default requirements file for needs to explicitly provide the platforms
"//:requirements_lock_3_10.txt": "linux_*,osx_*",
"//:requirements_windows_3_10.txt": "windows_x86_64",
},
# These modifications were created above and we
# are providing pip.parse with the label of the mod
# and the name of the wheel.
whl_modifications = {
"@whl_mods_hub//:requests.json": "requests",
"@whl_mods_hub//:wheel.json": "wheel",
},
)
pip.parse(
hub_name = "pip",
python_version = "3.11",
requirements_by_platform = {
# Default requirements file for needs to explicitly provide the platforms
"//:requirements_lock_3_11.txt": "linux_*,osx_*",
# This API allows one to specify additional platforms that the users
# configure the toolchains for themselves. In this example we add
# `windows_aarch64` to illustrate that `rules_python` won't fail to
# process the value, but it does not mean that this example will work
# on Windows ARM.
"//:requirements_windows_3_10.txt": "windows_x86_64,windows_aarch64",
"//:requirements_windows_3_11.txt": "windows_x86_64,windows_aarch64",
},
# These modifications were created above and we
# are providing pip.parse with the label of the mod
Expand Down
Loading