uv
uv copied to clipboard
handle constraints on indirect dependencies
if I have this requirements.in
virtualenv
and this requirements.txt
distlib==0.3.8
# via virtualenv
filelock==3.8.0
# via virtualenv
platformdirs==2.6.2
# via virtualenv
virtualenv==20.16.5
then pip-compile requirements.in and uv pip compile requirements.in -o requirements.txt do the same thing (no functional changes to the txt file) so everything is great
if I add this constraints.txt
filelock==3.8.0
and rm requirements.txt, then pip-compile requirements.in -c constraints.txt produces
distlib==0.3.8
# via virtualenv
filelock==3.8.0
# via
# -c constraints.txt
# virtualenv
platformdirs==3.11.0
# via virtualenv
virtualenv==20.21.1
pip-compile picked the last version of virtualenv that supported the old filelock (20.22.0 requires filelock>=3.11)
however,
$ uv pip compile requirements.in -c constraints.txt -v
[...]
0.008705s 3ms DEBUG uv_resolver::resolver Searching for a compatible version of virtualenv (*)
0.008872s 4ms DEBUG uv_resolver::resolver Selecting: virtualenv==20.25.0 (virtualenv-20.25.0-py3-none-any.whl)
uv_resolver::resolver::get_dependencies package=virtualenv, version=20.25.0
uv_resolver::resolver::distributions_wait package_id=virtualenv-20.25.0
0.009378s 0ms DEBUG uv_client::cached_client Found fresh response for: https://files.pythonhosted.org/packages/83/22/54b1180756d2d6194bcafb7425d437c3034c4bff92129c3e1e633079e2c4/virtualenv-20.25.0-py3-none-any.whl
error: There are conflicting versions for `filelock`: `filelock>=3.12.2, <4` does not intersect with `filelock==3.8.0`
Interesting, thank you for the clear report!
Ah yeah, ok, I see the issue here.
Have a fix but needs a few more test cases.
Hit this as well in my experimentation if you want another real-world case. A one-liner repro:
# Doesn't work
uv pip compile <(printf '%s\n' 'psycopg[c]>=3') -c <(printf '%s\n' 'psycopg==3.1.13' 'psycopg-c==3.1.13')
# Works
uv pip compile <(printf '%s\n' 'psycopg[c]>=3') -o <(printf '%s\n' 'psycopg==3.1.13' 'psycopg-c==3.1.13')
Thank you! I'm hoping to fix it today.
Should be fixed in v0.1.7 (out now).