uv
uv copied to clipboard
`uv pip compile` does not respect `tool.setuptools.dynamic` dependencies
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
Related: #1624
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.
We will address this as discussed in https://github.com/astral-sh/uv/issues/1624
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.
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)
I'll be looking into this tomorrow.
Now in review here: https://github.com/astral-sh/uv/pull/2633. Expect it to be supported in the next release.