A simple executable to generate a JSON diff (similar to pixi update --json) between two pixi lockfiles.
$ pixi-diff pixi.lock.old 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"
},
// ...
pixi global install pixi-diffYou can also use this tool in a temporary environment using pixi exec:
pixi exec pixi-diff pixi.lock.old pixi.lock.newGenerate JSON diffs between pixi lockfiles
Usage: pixi-diff [OPTIONS] [BEFORE] [AFTER]
Arguments:
[BEFORE] First lockfile to be compared
[AFTER] Second lockfile to be compared
Options:
-b, --before <BEFORE> First lockfile to be compared
-a, --after <AFTER> Second lockfile to be compared
--manifest-path <MANIFEST_PATH> Pixi manifest file. Used to determine whether a dependency is explicit
-v, --verbose... Increase logging verbosity
-q, --quiet... Decrease logging verbosity
-h, --help Print help
-V, --version Print version
You can either specify both the old and new lockfile via CLI parameters:
pixi-diff pixi.lock.old pixi.lock.new
# or equivalently
pixi-diff --before pixi.lock.old --after pixi.lock.newNamed pipes can be handy for comparing lockfiles from different states in your git history:
# bash / zsh
pixi-diff <(git show HEAD~20:pixi.lock) pixi.lock
# or equivalently
pixi-diff --before <(git show HEAD~20:pixi.lock) --after pixi.lock
# fish
pixi-diff (git show HEAD~20:pixi.lock | psub) pixi.lock
# or equivalently
pixi-diff --before (git show HEAD~20:pixi.lock | psub) --after pixi.lockOr specify either the "before" or "after" lockfile via stdin:
git show HEAD~20:pixi.lock | pixi-diff --before - --after pixi.lockYou can specify the manifest path (this tool tries out pixi.toml and pyproject.toml if not specified) to add explicit: true/false to your JSON diff.
If no manifest file is found, explicit: true/false is not added to the diff.
pixi-diff pixi.lock.old pixi.lock.new --manifest-path pixi.tomlThis tool integrates with pixi-diff-to-markdown.
You can pass this tool's stdout to pixi-diff-to-markdown and generate markdown diffs this way.
$ git show HEAD~20:pixi.lock | pixi-diff --after pixi.lock | pixi-diff-to-markdown
# Explicit dependencies
...You can view this generated markdown file in your terminal using glow (available on conda-forge as glow-md).
git show HEAD~20:pixi.lock | pixi-diff --before - --after pixi.lock | pixi-diff-to-markdown | glow
# or using pixi exec
git show HEAD~20:pixi.lock | pixi exec pixi-diff --before - --after pixi.lock | pixi exec pixi-diff-to-markdown | pixi exec -s glow-md -- glow --tuiA couple of issues with this approach:
- Width is not correct in
--tuimode (charmbracelet/glow#805). Workaround: useglow --tui --width=$(tput cols) - Links are not properly rendered in
--tuimode when not reading from stdin (charmbracelet/glow#806) - Unwanted whitespace in beginning when using
--tuiwhen not reading from stdin (charmbracelet/glow#807)
You can view this generated markdown file in your terminal using md-tui (available on conda-forge).
git show HEAD~20:pixi.lock | pixi-diff --before - --after pixi.lock | pixi-diff-to-markdown | mdt
# or using pixi exec
git show HEAD~20:pixi.lock | pixi exec pixi-diff --before - --after pixi.lock | pixi exec pixi-diff-to-markdown | pixi exec -s md-tui -- mdtA couple of issues with this approach:
- md-tui does not support bold and italic links (henriklovhaug/md-tui #91)
- md-tui does not support footnotes (henriklovhaug/md-tui #162)
- md-tui does not support Windows (henriklovhaug/md-tui #168)
- md-tui does not support the
<details>tag (henriklovhaug/md-tui #169)

