Lockfiles¶
A lockfile records the exact set of artifacts a build consumes, pinned so the build is reproducible. kivyforge writes one lockfile per target.
One lockfile per platform¶
kivyforge lock resolves your dependencies for a single target and writes
pylock.<platform>.toml next to pyproject.toml:
pylock.ios.tomlpylock.android.tomlpylock.macos.tomlpylock.linux.tomlpylock.windows.toml
The filename identifies the platform; no field inside the file does. Each
lockfile is a PEP 751 document: its
standard [[packages]] section follows the PEP 751 format. kivyforge's own
build-specific pins, such as the Python runtime and native artifacts, live in a
single [tool.kivyforge] extension table.
What a lock pins¶
Every artifact is pinned by URL and SHA-256, so a later build fetches byte-for-byte the same file or fails. A lock records:
- the resolved Python wheels for the target's platform tags;
- the prebuilt Python runtime for the target;
- any native artifacts, such as iOS xcframeworks, Android
.aarand.jarlibraries, and the Android runtime for each ABI.
Drift: when to re-lock¶
A lock records a SHA-256 hash of its lock inputs: the parts of
pyproject.toml it was resolved from. Those are [project].dependencies and
requires-python, plus the target's Python version, architectures, OS floor,
package indexes, find_links, exclude, and native libraries. When one of
them changes, the lock is out of date. kivyforge calls this drift.
Everything else, such as comments, signing, icons, the display name, or another
platform's settings, is read on every build and never makes a lock stale.
- Re-lock with
kivyforge lock -p PLATFORM, replacingPLATFORMwith the target name. If the lock is already in sync,lockleaves it unchanged; add--updateto re-resolve anyway. A re-lock keeps the versions already in the lock and moves only the packages the change requires. If the locked versions cannot be kept,lockfails withKF-LOCK-PINS-CONFLICT; runkivyforge lock -p PLATFORM --updateto take the newest version each specifier allows. build,run, andpackagerefuse to use a drifted lock. They exit with code 4 andKF-LOCK-DRIFT(orKF-LOCK-MISSINGwhen there is no lock), rather than building something stale.- In CI, run
kivyforge lock --checkas a pre-flight. It re-resolves, keeping the locked versions, writes nothing, and exits with code 4 if the result differs from the lock on disk. A new upstream release alone does not fail it.
See Manage dependencies and re-lock for the workflow.
Committing locks¶
Whether to commit a lockfile is your choice. Committing it makes CI builds
reproducible and makes lock --check meaningful. Most kivyforge examples do not
commit their locks, because the lock can be regenerated. A few on-device test
examples commit theirs deliberately.