-
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
Allow single constraints and overrides to be passed via the CLI #9614
Comments
This proposal applies to both the |
You could always check for a file first and then fall back to see if it's a valid version specifier (that includes an operator, e.g. |
This is the behavior we have historically avoided. We don't want the CLI behavior to change based on the state of the file system. |
Okay but >>> from packaging.requirements import Requirement
>>> Requirement('constraints.txt')
<Requirement('constraints.txt')> And that is likely to be the name of a file, so I guess document this carefully on what the boundary conditions are between choosing a file or a requirement. |
One last thing, the one use case to be aware of here is when specifying an always falsey environment marker, e.g. |
Yeah so that's why I said we'd require a version specifier. A constraint without a version specifier doesn't do anything.
Good point! |
Yeah, I guess we'd say: if it includes |
Do you mean |
Yes, sorry. (Edited.) |
@zanieb -- Just noticed one problem here... The values are technically space-delimited, so you can do |
Alas. I'm not sure what to do about that. As a minor note, it's One alternative option: we could align on the name in the |
The
--constraint
and--override
flags should be updated to allow single constraints (in addition to the current behavior of accepting a file path), e.g.,--constraint "foo>=0.1"
. In the--constraint
case, this is mostly unambiguous — if there's a version specifier then we can treat it as a constraint. It is possible to have a file with that name, but it seems very unlikely in practice. In the--override
case, we do allow overriding a dependency to have no specifiers, e.g.,--override foo
. I'm not sure if we should allow this via this interface? It seems nice to avoid the ambiguity. Historically, we've avoided inspecting the file system to determine the behavior of arguments and I think that is a good goal to maintain.Previous discussion at
uv run
#4973 (comment)--override
not supported byuv run
#4824 (comment)--constraints
and--overrides
inuv tool install
#9547 (comment)The text was updated successfully, but these errors were encountered: