Skip to content

Handle cyclic dependency in pip wheels, e.g. PyTorch 2.0 #1076

@siddharthab

Description

@siddharthab

🚀 feature request

Relevant Rules

pip_repository, whl_library and py_library

Description

rules_python does dependency resolution at the level of a wheel and sets up the entire wheel as one py_library. This difference in the level of granularity here is why we can not handle cyclic dependencies in wheels. Some pip wheels have cyclic dependencies which is valid Python, and pip handles them well. For example, the upcoming PyTorch 2.0 release has a cyclic dependency between the torch (.whl file) and pytorch-triton (.whl file) wheels.

Describe the solution you'd like

The proper solution for this would be to have more granular build units which would also be better from a sandboxing and build caching efficiency perspective. But as an intermediate solution, maybe we could install the wheels with cyclical dependencies between them into one repo (through one whl_library call) and set up the composite of such wheels as one py_library. For gazelle, a resolve directive can ensure that all packages point to the same py_library target.

Describe alternatives you've considered

An alternative could be that I manually build a composite wheel and set it up as a whl_library in my WORKSPACE.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions