Checks whether the uv.lock file is consistent with pyproject.toml.
This is a non-modifying check that returns TRUE or FALSE.
Details
This function runs uv lock --check which verifies that:
A
uv.lockfile existsThe lockfile is consistent with the current
pyproject.toml
If either condition is not met, the function returns FALSE.
Unlike lock(), this function never modifies the lockfile.
See also
lock()to create or update the lockfilelock_exists()to check only for existence
Examples
with_temp_project({
init()
# No lockfile yet
check_lock()
# Create lockfile
lock()
# Now it's up-to-date
check_lock()
# Add a dependency (lockfile becomes stale)
add("requests")
check_lock()
# Update the lockfile
lock()
check_lock()
})
#> Error: ! command is not a string (length 1 character)