n3wbie
n3wbie

Reputation: 1146

What's the difference between uv lock --upgrade and uv sync?

Being a total newbie in the python ecosystem, I'm discovering uv and was wondering if there was a difference between the following commands :
uv lock --upgrade
and
uv sync

If there's any, what are the exact usage for each of them ?

Upvotes: 0

Views: 37

Answers (1)

Gwang-Jin Kim
Gwang-Jin Kim

Reputation: 9990

uv lock commands are all about managing the uv.lock file (or creating it). But what they NOT do: upgrading the actual package versions in your environment!

The uv lock --upgrade command updates the lock file (uv.lock) by allowing package upgrades, even if they were previously pinned. But still it is a managing command for the uv.lock file and does NOT upgrade anything in the environment (package versions). It upgrades only the lock file.

uv sync commands are upgrading the actual environment and packages within ensuring the actual environment's package versions align with what’s recorded in uv.lock file.

You can get detailed info about both commands by typing:

uv help lock

or:

uv help sync

Upvotes: 1

Related Questions