-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Feature request: updating dependency version in a lockfile #7019
Comments
I comment on some future upgrade options at #6781 (comment) However, it sounds like you're looking for constraints or overrides: |
I saw the constraints and overrides in the documentation, but it looks like a too big hammer for this use-case, I think. Here I mostly just want to take a one-time snapshot of an existing package environment. Also, in general, I'm not sure how to use the |
The workaround I generally recommend here is to snapshot the environment, add the versions as constraints, run |
Yeah, that's exactly the workaround I described in the issue. Thanks for confirming that there probably isn't a better way for now 👍 |
Another related use-case that I encountered today is that dependabot told me to update a version of a transitive dependency in my lockfile. In Rust, I would do |
I think this should be possible today with: |
Ooh, that's it, thank you! I thought that I tried this before, not sure why I thought it doesn't work. This is essentially It would be nice to add some more visible information about this to the documentation, because I only found |
@Kobzol that'd be great, thanks! |
Hi! While migrating an existing Python project to
uv
, I encountered a situation where a command similar tocargo update --precise
would be quite useful. Essentially, I would like to have the option to telluv
to set a package version (usually of a transitive dependency, one that is not specified independencies
) in a lockfile to a specific version (that is semver compatible with the other dependencies).I have the following use-case (related to #7018): I'm porting an existing Python project using a
requirements.txt
lockfile touv
. Let's say that I have a root dependencya
that depends on a transitive dependencyb>2.1
, and the latest published version ofb
is2.3
. However, in my existing Python environment, I'm usingb==2.2
, and I want to continue doing that. In theory, according to semver,2.3
is compatible with2.2
, but theory is not always practice (especially in the world of Python package management :) ).If I want to move to
uv
, I'll generate a new project, setdependencies = ["a==xyz"]
and generate a lockfile. However,uv
will forcefully set the version ofb
to2.3
, the newest compatible version. I haven't found any way to telluv
to set a specific version of the transitive dependency (aside from manually modifying the lockfile, but that's really not a good solution).Workaround
What I found to work is to do
uv add b==2.2
, which will update the lockfile, and then manually delete"b==2.2"
from thedependencies
array. This seems to work fine, but it would be nice ifuv
allowed me to do this in a more straightforward way, e.g. with something likeuv lock update b=2.2
.Related issue
A bit similar to #6794, but I'm looking for a way to set the version of a specific package to a specific version, not just update everything.
The text was updated successfully, but these errors were encountered: