uv and uv.lock in Python
Introduction
Only one file changed in the repository, uv.lock: about 119 added lines and none deleted. This is a catch-up update of the lock file: the project manifest already required a package for browser tests (playwright >= 1.40), but the lock file had not pinned it before this change. Below we will analyse what exactly was added and why.
What uv.lock is
uv.lock is a generated file of exact dependency versions. The project manifest sets broad constraints of the form playwright >= 1.40, while the lock file pins the exact versions, hashes and wheel URLs for all platforms. Thanks to this, installation on another machine gives the same set of packages as the change author has. The rule is simple: the manifest describes what is needed, the lock file describes what is actually installed.
What changed
The change is fully additive, in three parts:
1. In the project dependencies section an entry appeared,
playwright, and in the metadata the
constraint playwright >= 1.40.
2. Three new package sections were added:
playwright 1.63.0,
greenlet 3.5.6 and
pyee 13.0.1.
3. For each package the source
(package registry), exact version, hashes and the list of wheels
for different OSes and architectures are pinned.
There are no deletions or version changes of existing packages.
New packages
playwright 1.63.0 - browser automation
(used by the interface tests with dictionary pages).
In the lock file it has two dependencies:
greenlet and pyee.
greenlet 3.5.6 - a primitive for lightweight coroutines,
which playwright uses internally.
This is the largest part of the change:
the package has many wheels for different Python versions,
OSes and architectures, so it accounts for most of the
added lines.
pyee 13.0.1 - an event emitter implementation.
Its only dependency is
typing-extensions, which was already in the lock file,
so nothing separate was added for it.
How to repeat the check
View the change summary:
git diff --stat
View only the names of the new packages:
git diff -- container/uv.lock | grep "^+name"
Regenerate the lock file after editing the manifest:
uv lock
Check that the environment builds:
uv sync
All the paths above are conditional: the repository may be located in any directory, for example
~/projects/demo
Why this is safe
The change only adds pins, it deletes nothing and does not change the versions of packages already in use (pytest, requests and the rest stayed as they were). So the existing tests and checks cannot break because of a version change: the dependency set for them is the same. The only new effect is that the browser testing tool is now installed reproducibly together with its transitive dependencies.
Article author: Andrei Olegovich