-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
uv add should use ^ instead of >= when adding dependencies to pyproject.toml #10247
Comments
Loosely a duplicate of #6783 There's a very strong argument for not including upper bounds when publishing libraries. I think in applications, an upper bound can be nice. There is further discussion linked in the referenced issue. |
@zanieb Can you point me to this? I am unable to find it |
This caret-notation, made popular by poetry, is one of the most diabolical anti-patterns in the python-world. It also conflates the notions of abstract and concrete dependencies.
Also a major new release does not mean "guaranteed backward incompatibility".
That is not what it means. But how can you test this new major release, if that packages flat-out refuses to install in your venv? Specifying minimum-version on the other hand, means that the code likely does to work and there is no intention to fix that. Try to read it like "intended to support" If your package uses newer language-constructs introduced in python3.10, then use
Only specify an upper bound, it you don't intend to support 3.11.
If your package uses python2.7, and you don't the any intention to support python 3, use
I never liked this caret notation, as the mathematical meaning is not intuitively clear:
|
I don't make the distinction between a python-library or a python-application, as long as there is a lock-file. For me an application is
In scripts with inline metadata, distributed without a lock-file, the upper bounds make sense. |
I agree the default lower bound constraint is enough for library. I also think there is value in adding an option like |
To add / remove dependencies i use the
uv add
anduv remove
commands and i prefer not to editpyproject.toml
manually.When i do something like
uv add requests
i see the following addition inpyproject.toml
The
>=
looks super scary as it semantically means my project will not break even if requests releases a major version. Yes, i know there is auv.lock
file to ensure reproducible builds but i prefer the following when i douv add requests
I believe poetry on several other semver tools use something like
^2.32.3
which is basically the equivalent of>=2.32.3,<3
The text was updated successfully, but these errors were encountered: