uv icon indicating copy to clipboard operation
uv copied to clipboard

Add docs for `constraint-dependencies` and `override-dependencies`

Open Di-Is opened this issue 1 year ago • 8 comments

Add missing portions of documents reported in #6518 and #5248(Comment).

Summary

override constraint

Di-Is avatar Aug 25 '24 08:08 Di-Is

I noticed later that the current project interface (e.g. uv sync) does not read override-dependencies and constraint-dependencies from uv.toml.

Should project interface commands respect constraint-dependencies and override-dependencies in this file?

If so, this needs to be addressed in a separate issue and PR. ~~If not, the uv.toml example needs to be removed from the added documentation.~~ (No need to remove uv pip install/compile as it uses uv.toml.)

Di-Is avatar Aug 25 '24 11:08 Di-Is

I noticed later that the current project interface (e.g. uv sync) does not read override-dependencies and constraint-dependencies from uv.toml.

I believe it does, but only from the workspace root. Are you seeing otherwise?

charliermarsh avatar Aug 25 '24 11:08 charliermarsh

I believe it does, but only from the workspace root. Are you seeing otherwise?

The user-level configuration (~/.config/uv/uv.toml) might be worth respecting.

Di-Is avatar Aug 25 '24 12:08 Di-Is

For reference, it appears that cargo allows dependencies to be overridden from user-level settings.

https://doc.rust-lang.org/cargo/reference/config.html#patch

Di-Is avatar Aug 25 '24 13:08 Di-Is

I believe it does, but only from the workspace root. Are you seeing otherwise?

Sorry, I misread your answer.

uv pip install and uv pip compile respect override-dependencies and constraint-dependencies in uv.toml. I share a simple but reproducible command.

$ echo 'override-dependencies=["werkzeug==2.3.0"]' > ~/.config/uv/uv.toml
$ echo flask | uv pip compile -
~~~~
werkzeug==2.3.0
    # via
    #   --override (workspace)
    #   flask

Di-Is avatar Aug 25 '24 14:08 Di-Is

I'm not sure... I consider this "data" rather than "configuration".

charliermarsh avatar Aug 25 '24 14:08 charliermarsh

I think it's important for this to be scoped to the project to avoid different resolutions for a project per developer.

zanieb avatar Aug 25 '24 15:08 zanieb

I think it's important for this to be scoped to the project to avoid different resolutions for a project per developer.

Ok, that is correct. To avoid user confusion, I emphasized that only the setting values in pyproject.toml are valid for project interfaces(e.g. uv lock).

Di-Is avatar Aug 26 '24 11:08 Di-Is