rules_pycross icon indicating copy to clipboard operation
rules_pycross copied to clipboard

pycross cannot disambiguate between different versions of the same package in uv.lock

Open aw632 opened this issue 1 month ago • 1 comments

I haven't had time to produce a minimal example, but, suppose:

  1. You have a pyproject.toml that supports Python >=3.10,<3.14
  2. You add numpy as a dependency
  3. uv will resolve two versions of numpy, one for Python <3.12 and one for Python >=3.12, and have two numpy packages in uv.lock with 2 different versions.
  4. You run Pycross for Python 3.10
  5. Pycross pulls the wrong numpy version, not the one intended for Python 3.10, and the bazel build fails.

We should support resolution markers here:

[[package]]
name = "numpy"
version = "2.3.4"
source = { registry = "https://pypi.org/simple" }
resolution-markers = [
    "python_full_version >= '3.13' and platform_machine == 'aarch64' and sys_platform == 'linux'",
    "python_full_version == '3.12.*' and platform_machine == 'aarch64' and sys_platform == 'linux'",
    "python_full_version >= '3.13' and platform_machine != 'aarch64' and sys_platform == 'linux'",
    "python_full_version == '3.12.*' and platform_machine != 'aarch64' and sys_platform == 'linux'",
    "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'",
    "python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux'",
]

aw632 avatar Nov 06 '25 05:11 aw632

My guess is something is getting lost when translating from uv to Pycross' internal model. Scenarios like this are why I generate target names using package name + version (like here).

jvolkman avatar Nov 06 '25 20:11 jvolkman