Dear all,
I would like to configure Meld to follow some rules/filters during diff. A similar question has already been asked here, but it doesn’t work when the comparison is between two files.
For git I configured nbstripout
to strip outputs for Jupyter notebooks. It is working good for git diff a.ipyn b.ipynb
from terminal, but when the two files are loaded from within Meld and/or from terminal (i.e meld a.ipyn b.ipynb
) all the outputs are displayed.
On an Ubuntu 20.04 LTS system, my ~/.gitconfig
looks like:
[user]
name = me
email = me@me.com
[diff "pandoc"]
textconv=pandoc --to=markdown
prompt = false
tool = meld
[alias]
wdiff = diff --word-diff=color --unified=1
[filter "nbstripout"]
clean = \"/home/me/anaconda3/bin/python3.8\" -m nbstripout
smudge = cat
[diff "ipynb"]
textconv = \"/home/me/anaconda3/bin/python3.8\" -m nbstripout -t
[diff "git-clean-diff"]
command = git-clean-diff
[credential]
helper = cache
[difftool]
prompt = false
[difftool "meld"]
cmd = meld "$LOCAL" "$REMOTE"
my ~/.config/git/attributes
*.ipynb filter=nbstripout
*.ipynb diff=ipynb
*.ipynb diff=git-clean-diff
and finally the bash script in /bin
is
#!/bin/bash
# pass the stripped working tree file and the repo copy
# to meld for diffing
meld <(cat $1 | -m nbstripout -t) $2
As suggested in the mentioned question, I tried the commad meld <(cat a.ipynb | nbstripout) b.ipynb
alone: it correctly opens Meld and the two notebooks, but without stripping. When I git difftool a.ipynb
the outputs are still displayed.
I have tried the GUI diff tool Kompare too, but the issue remains. Am I overlooking something? Any idea on how to solve it?