astral-sh/uv

Add dependency with "equal" version by default?

Closed this issue · 1 comments

Question

Right now if you add a dependency from UV, it will add with ">=" syntax of latest version.

e.g. if I type: uv add matplotlib
then in pyproject.toml, I will have: matplotlib>=3.10.7

I want by default if I type: uv add matplotlib
then it get latest version and add to pyproject.toml as: matplotlib==3.10.7

Is there anyway to achieve it by default?

Keep in mind that:

  • I don't want to type uv add matplotlib==3.10.7 (as it doesn't make sense that I need to check what is the current version number)
  • I don't want to use uv.lock as pyproject.toml alonne should be able enough to lock version.

I think my question similar to this suggestion/idea: #6781 (comment)

Platform

Windows 11

Version

uv 0.8.13 (ede75fe 2025-08-21)

You can do --bounds=exact or:

[tool.uv]
add-bounds = "exact"

I generally recommend against using this since it's problematic for libraries and redundant with uv.lock for applications, but it does what you describe.