rules_pycross
rules_pycross copied to clipboard
pycross cannot disambiguate between different versions of the same package in uv.lock
I haven't had time to produce a minimal example, but, suppose:
- You have a
pyproject.tomlthat supports Python>=3.10,<3.14 - You add
numpyas a dependency uvwill resolve two versions of numpy, one for Python <3.12 and one for Python >=3.12, and have twonumpypackages inuv.lockwith 2 different versions.- You run Pycross for Python 3.10
- 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'",
]
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).