Calculate Lockfile diffs#
It can happen that you want to know what changed in your lockfile after repeatedly adding and removing dependencies within a pull request. For this, you can use pavelzw/pixi-diff to calculate the differences between two lockfiles. This can be leveraged in combination with pavelzw/pixi-diff-to-markdown to generate a markdown file that shows the diff in a human-readable format. With henriklovhaug/md-tui, you can even render the markdown file in the terminal.
Install the tools globally
All of the above-mentioned tools are available on conda-forge and can be installed using pixi global install
.
pixi-diff --before pixi.lock.old --after pixi.lock.new
will output a JSON object that contains the differences between the two lockfiles similar to pixi update --json
.
$ pixi-diff --before pixi.lock.old --after pixi.lock.new
{
"version": 1,
"environment": {
"default": {
"osx-arm64": [
{
"name": "libmpdec",
"before": null,
"after": {
"conda": "https://conda.anaconda.org/conda-forge/osx-arm64/libmpdec-4.0.0-h99b78c6_0.conda",
"sha256": "f7917de9117d3a5fe12a39e185c7ce424f8d5010a6f97b4333e8a1dcb2889d16",
"md5": "7476305c35dd9acef48da8f754eedb40",
"depends": [
"__osx >=11.0"
],
"license": "BSD-2-Clause",
"license_family": "BSD",
"size": 69263,
"timestamp": 1723817629767
},
"type": "conda"
},
// ...
Named pipes can be handy for comparing lockfiles from different states in your git history:
# bash / zsh
pixi-diff --before <(git show HEAD~20:pixi.lock) --after pixi.lock
# fish
pixi-diff --before (git show HEAD~20:pixi.lock | psub) --after pixi.lock
Or specify either the "before" or "after" lockfile via stdin:
This can be integrated with pixi-diff-to-markdown
to generate a markdown file that shows the diff in a human-readable format:
pixi-diff-to-markdown in GitHub Actions updates
For other usages of pixi-diff-to-markdown
, see also our page about updating lockfiles using GitHub Actions.
You can view this generated markdown file in your terminal using md-tui
.