Open grzegorz700 opened 1 month ago
This question is maybe better focused outside this plugin, but have you tried https://github.com/deshaw/nbstripout-fast? With this, nbdime does not show timestamps diff nor commit them.
Thank you for the library reference. nbstripout-fast is good for this purpose to speed it up, and remove one of the drawbacks of this partial solution. I'll update the post with the second quicker solution as well. It's hard to say/find the best place to track this type of problem. However, most discussions cover mostly removing outputs from cells, not metadata. This extension produces a substantial amount of frequently changing metadata, so I've decided to put this problem with my partial solution here.
Feel free to close this issue, if you want. I wrote my post to help others because I didn't find any good solution in other places/issues/stacks to this particular sub-problem. So now, I hope it'll be possible to find it easier, regardless of whether it is closed or not.
this extension produces a substantial amount of frequently changing metadata
This extension produces no metadata actually - its just a renderer. For simplicity, we simply turn on an option to produce it in JupyterLab itself.
When we use this extension with git-based sytems it produces 10(5*2) lines of diffs per every changed cell.
This problem is well known without any perfect solution. Based on the many reference solutions, including the list from stackoverflow and a good advice https://github.com/jupyterlab/jupyterlab/issues/9444#issuecomment-743992307 and other stackoverflow solutions. I propose my partial workaround setup.
Partial workaround:
We could use this extension without massive diffs is based on two stages:
Prevent from pushing to git.
.gitattributes
file in the root of your repository:.gitattributes
file:or
git config filter.clean_meta_ipynb.clean "nbstripout-fast --keep-output --keep-count --textconv"
jupyter --paths
or we could try with the more precise exclusion like:
"/cells/*/metadata":['execution']
.Drawbacks:
nbstripout-fast
)I put it that solution, especially for people who want to use this extension without the need to remove other info from notebooks (e.g. outputs).
However, I would love to see a better solution.