Thanks to visit codestin.com
Credit goes to github.com

Skip to content

pavelzw/pixi-diff

Repository files navigation

License CI Status Conda Platform Conda Downloads Project Chat Pixi Badge

pixi-diff demo pixi-diff demo

pixi-diff

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"
        },
// ...

Install

pixi global install pixi-diff

You can also use this tool in a temporary environment using pixi exec:

pixi exec pixi-diff pixi.lock.old pixi.lock.new

Usage

Generate 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.new

Named 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.lock

Or specify either the "before" or "after" lockfile via stdin:

git show HEAD~20:pixi.lock | pixi-diff --before - --after pixi.lock

You 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.toml

pixi-diff-to-markdown

This 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
...

View in terminal with glow

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 --tui

A couple of issues with this approach:

View in terminal with md-tui

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 -- mdt

A couple of issues with this approach:

About

Generate JSON diffs between pixi lockfiles

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages