uv icon indicating copy to clipboard operation
uv copied to clipboard

`uv pip compile` does not respect `tool.setuptools.dynamic` dependencies

Open adamtheturtle opened this issue 1 year ago • 5 comments

With the following files, pip-compile output includes the ruff dependency, uv pip compile does not:

pyproject.toml:

[project]
name = "demo-project"
version = "0.1"
dynamic = ["dependencies"]

[tool.setuptools.dynamic]
dependencies = { file = "requirements.txt" }

requirements.txt:

ruff

pip-compile includes ruff:

> pip-compile pyproject.toml
WARNING: --strip-extras is becoming the default in version 8.0.0. To silence this warning, either use --strip-extras to opt into the new default or use --no-strip-extras to retain the existing behavior.
#
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
#    pip-compile pyproject.toml
#
ruff==0.2.2

uv does not:

> uv pip compile pyproject.toml 
Resolved 0 packages in 174ms
# This file was autogenerated by uv v0.1.4 via the following command:
#    uv pip compile pyproject.toml

I expect uv's behaviour to match pip-compile's, or for the difference to be documented.

> pip-compile --version
pip-compile, version 7.4.0
> uv --version
uv 0.1.4

adamtheturtle avatar Feb 18 '24 13:02 adamtheturtle

Related: #1624

sbidoul avatar Mar 10 '24 13:03 sbidoul

I've also run into this issue and I just wanted to +1 this feature. In my case I have something like:

[tool.setuptools.dynamic]
dependencies = { file = ["requirements.in"] }

and then all the dependencies in requirements.in, which produces an empty requirements.txt file with uv but works with pip-compile.

albertotb avatar Mar 15 '24 14:03 albertotb

We will address this as discussed in https://github.com/astral-sh/uv/issues/1624

zanieb avatar Mar 15 '24 14:03 zanieb

For what it's worth, if you treat the project as a dependency, we should respect it. E.g. echo "-e ." | uv pip compile - or echo "poetry-editable @ ." | uv pip compile -. But yes, we should fix.

charliermarsh avatar Mar 15 '24 14:03 charliermarsh

I've temporarily fixed this just by using directly (which is not a big deal)

uv pip compile -o requirements.txt requirements.in

It is a little less convenient for extras, i.e.

uv pip compile -o requirements-dev.txt -c requirements.txt requirements.in requirements-dev.in

instead of (this does not work)

uv pip compile --extra dev -c requirements.txt pyproject.toml

(assuming you also have optional-dependencies.dev = { file = ["requirements-dev.in"] } in pyproject.toml)

albertotb avatar Mar 15 '24 15:03 albertotb

I'll be looking into this tomorrow.

charliermarsh avatar Mar 22 '24 04:03 charliermarsh

Now in review here: https://github.com/astral-sh/uv/pull/2633. Expect it to be supported in the next release.

charliermarsh avatar Mar 23 '24 02:03 charliermarsh