astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
19.94k stars 591 forks source link

uv pip compile --universal gives contradictory versions of same packages #6269

Closed notatallshaw-gts closed 1 week ago

notatallshaw-gts commented 3 weeks ago

Affected versions: uv 0.2.30 to uv 0.3.0+

Steps to reproduce:

  1. Create requirements.in:
alembic==1.8.1
ipython>=8.4.0
pylint>=2.14.5
  1. Create constraints.txt:
dill==0.3.1.1
exceptiongroup==1.0.0rc8
  1. Run the uv command:
$ uv pip compile requirements.in -c constraints.txt --universal --python-version 3.10 --annotation-style line 2>/dev/null | grep "astroid=="
astroid==2.13.5           # via pylint
astroid==3.2.4 ; python_full_version < '3.11'  # via pylint

Which, if you try and install on Python 3.10 gives you:

  × No solution found when resolving dependencies:
  ╰─▶ Because you require astroid==2.13.5 and astroid{python_full_version < '3.11'}==3.2.4, we can conclude that your requirements are unsatisfiable.
charliermarsh commented 3 weeks ago

I'll look now.

notatallshaw-gts commented 3 weeks ago

Very slightly changing the requirements.in or constraints.txt, or moving the constraints into the requirements produces the correct:

astroid==2.13.5 ; python_full_version >= '3.11'  # via pylint
astroid==3.2.4 ; python_full_version < '3.11'  # via pylint
charliermarsh commented 3 weeks ago

Wow very interesting!

charliermarsh commented 3 weeks ago

It looks like #6268 fixes this.

BurntSushi commented 3 weeks ago

@charliermarsh How are you so fast?!?! Indeed, I just confirmed it's fixed in #6268 too:

$ cargo r --manifest-path ~/astral/uv/Cargo.toml -p uv -- pip compile requirements.in -c constraints.txt --universal --python-version 3.10 --annotation-style line 2>/dev/null | grep "astroid=="
astroid==2.13.5 ; python_full_version >= '3.11'  # via pylint
astroid==3.2.4 ; python_full_version < '3.11'  # via pylint
zanieb commented 3 weeks ago

He has two clones of the repo so he can do twice as much!

charliermarsh commented 3 weeks ago

Correct