Open
Description
Allow custom platforms to be added to pip_parse
We are trying to install PyTorch and PyTorch has a slightly different way for installing.
The pip command for installing pytorch+linux+cpu:
pip3 install torch --index-url https://download.pytorch.org/whl/cpu
While for a specific GPU version:
pip3 install torch --index-url https://download.pytorch.org/whl/cu121
So we have different requirements files for linux CPU and linux GPU combinations. In the code, I can see that rules_python is using the requirements file depending on the current host that its running, code is here
How do we pass custom platforms? Something like this
constraint_setting(name = "gpu")
constraint_value(
name = "gpu_cu_12_1",
constraint_setting = ":gpu",
)
constraint_value(
name = "gpu_none",
constraint_setting = ":gpu",
)
platform(
name = "lol_x86_64",
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
":gpu_none",
],
)
platform(
name = "linux_x86_64_cu_12_1",
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
":gpu_cu_12_1",
],
)
Versions
bazel: 6.2.0
rules_python: 0.40.0
Thanks!