Skip to content

pip_parse: requirements_by_platform: allow custom defined platforms #2548

@hariom-qure

Description

@hariom-qure

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!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy