LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

uv-lock

Resolve and lock project dependencies

TLDR

Create or update the lockfile
$ uv lock
copy
Upgrade all packages to latest compatible versions
$ uv lock --upgrade
copy
Upgrade a specific package to its latest version
$ uv lock --upgrade-package [package]
copy
Check if the lockfile is up-to-date without modifying it
$ uv lock --check
copy
Lock with a specific Python version
$ uv lock --python [3.12]
copy

SYNOPSIS

uv lock [options]

DESCRIPTION

uv lock resolves project dependencies declared in pyproject.toml and writes exact pinned versions to a uv.lock file. The lockfile ensures reproducible installations across environments. Run after modifying pyproject.toml dependencies.Locking is automatic when running uv sync, uv run, or uv add, but can be run explicitly to update the lockfile without installing packages.

PARAMETERS

--upgrade

Allow all packages to be upgraded to their latest compatible versions.
--upgrade-package pkg
Allow a specific package to be upgraded.
--check
Check if the lockfile is up-to-date; error if it needs updating.
--frozen
Use the existing lockfile without checking if it is up-to-date.
--locked
Assert that the lockfile matches pyproject.toml; error otherwise.
--no-sources
Ignore the tool.uv.sources table when resolving dependencies.
--python VERSION
Resolve for a specific Python version.

SEE ALSO

uv(1), uv-sync(1), uv-add(1)

Copied to clipboard
Kai