uv sync --locked vs. --frozen when pyproject.toml changes
Use uv sync --locked when a changed project file should make CI fail until the lockfile is refreshed. Use --frozen when you intend to install from the saved lockfile without checking whether it matches the project metadata.
Change one dependency and run both commands
We used uv 0.11.21 on macOS and created a throwaway project with no dependencies. After generating uv.lock, we added packaging>=24 to the dev dependency group without refreshing the lockfile. Both sync commands ran offline.
uv sync --locked --offline exited with status 1 and reported that the lockfile needed updating. A byte comparison confirmed that the lockfile stayed unchanged. uv sync --frozen --offline finished successfully. A subsequent import check showed that packaging was absent from the project environment.
Choose which guarantee your build needs
If a pull request edits dependencies, run uv sync --locked in CI to catch stale lockfiles. Review changes to pyproject.toml and uv.lock together. For a stage deliberately consuming a saved lockfile, --frozen uses the versions in that file without checking for metadata drift. A successful frozen sync verifies that the recorded environment could be installed in that run.