New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
notebook nbdime diff: Hide unchanged cells #386
Comments
I'm not sure if I follow the issue description completely. For the first screenshot, do you have two comparison images, one with "hide unchanged" checked and one unchecked? You are right that if the execution count ( |
Both screenshots are with identical setting of " You probably would agree that any changes in |
Doing some more testing it's Is there an existing ignore settings that will ignore this attribute? Thank you. |
Also is it possible to make "Hide unchanged cells" configurable to be the default On. I want this tool to be as close to diff(1) as possible, not as a may be later diff and a lot of noise. Ideally there should be just a single setting that says:
and when Thank you! |
There's a bunch of separate items here now, so I'll address them point by point. Hopefully I won't miss any!
It is configurable: Either by the
This is the flag "Extension": {
"source": true
} Or you could use
That does sound reasonable, and maybe also make it configurable.
Sure, I was just wondering if you had a screenshot of the first region, one with the checkbox checked, and one with it unchecked. I was trying to understand why the unchanged markdown cell was not being hidden. |
As I specified I already had
Your suggestion of:
does absolutely nothing - as if there is no config at all - i.e. I get all the diffs - for all types of cells. This doesn't do anything either:
Would you also please add to the documentation to always run: Thank you for working on this, Vidar. |
Did you try with the linked PR? There are some fixes in there.
Did you get an exception in the server log though? And when you say you broke it, do you mean that the JSON was invalid, or just an incorrect configuration? |
(note, that PR has been merged, so feel free to try with master) |
Part of the problem is fixed in #394. |
ok, tried with the new changes using venv build and the master branch build:
to enable nbdiff extension in the notebook - which is new. Until now this wasn't needed. Until now running:
installed both extensions (nbextension and serverextension).
Specifically: None of these does anything at all (i.e. I get all diff categories on). I tried each of these separately. I validated that they were picked by
So I'm not sure what did change. Thank you for looking into it, Vidar. If you need any information from me to help you reproduce the issues please let me know how I can assist. p.s. The user config file is still very error prone. I noticed I can write anything in there and
which is OK. But it might be good to add to the docs a note that it's the user's responsibility to run |
Replying to your points by number reference:
{
"Extension": {
"Ignore": {
"/cells/*/outputs": true,
"/cells/*/attachments": true,
"/cells/*/metadata": true,
"/cells/*": ["execution_count"]
}
}
} |
For 3, I guess that syntax can be documented better 😅 |
Great, we are making progress.
almost does it. It now perfectly ignores cells with no code-changes. However, if the code cell changed, it does show all the other stuff, which it should be ignoring, as you can see from the image: The outputs and metadata shouldn't be displayed, neither explicitly as in the last cell (output), nor in a suggestive way via the dropdown to show the diff or the blue colored indicator of change (metadata changed, output unchanged in earlier cells). So the ignore rules at the moment aren't absolute. They are true only if code cell hasn't changed, otherwise they are being ignored. I imagine there are two parts to nbdiff logic - (1) choosing which cells to diff and which not, and then (2) how to display the diff. So currently the ignore rules apply to the choosing part (1), but not to the displaying part (2). What I'm after is having just code changes, to be as close as possible to diff(1). And everything else ignored. Thank you! |
Now I was able to validate your change #394 and this setting
works identically to the setting in my comment above. So this is nice as it "speaks" a more implicit language and allows for future changes in the internals of jupyter notebook and still giving the user what they wanted. I'd rather use the latter syntax. I see that in other parts of the config you have: Back to #394. Note that the partial configuration doesn't do the same as above:
I get:
and apparently those ' |
The intention is for those nulls to default to the opposite of whatever else is defined, e.g. that if one or more fields are set to true, it defaults to false; and if one or more fields are set to false, it defaults to true. As far as I can tell, this is also the behavior I'm seeing from master. Do you have any example notebooks whose diff behave unexpectedly? |
This is far from obvious to the end-user. Since you have the logic that sets them to true/false during the execution, why not display the explicit settings to the user? |
Simply printing |
Ref #398. |
@stas00 There were several issues reported in this thread. Are there any remaining as you can see? |
Yes, this part is still unresolved: #386 (comment) |
And thank you for #398 - the config printout is now explicit and clear for Extension. I see nulls in other sections but I haven't delved into those other parts. |
|
I'm not sure what to make of it. Why would you suggest to set it to
Unless wrt the last 2 bullets of your comments 2) "cell added/removed." 3) "output unchanged" - These features are currently not very coding-friendly/optimal. I can see 2 major ways of someone using nbdime with notebooks:
At the moment falling into the 2nd category, all I want is just a simple flag --emulate-diff(1)-functionality and that would mean - please show me just the source code diff, period, no matter what happened to the content of the notebook. And please don't show me any noise, not even a suggestion of something else changing. Of course, I understand, as you suggest that perhaps the design of the features was built around a different intention. So this then belongs to the wish-list. I guess the only "tweak" that can be done easily is to replace full-outputs of non-code outputs with click-to-show UI (ala metadata), thus reducing the amount of noise. Thank you, Vidar. |
Regarding the metadata point, I was talking about the initial problem. Setting up: "SectionName": {
"metadata": false
} is equivalent to: "SectionName": {
"Ignore": {
"/metadata": true,
"/cells/*/metadata": true,
"/cells/*/outputs/*/metadata": true
}
} |
Regarding the second point, do you actually want to have the outputs stored in the repository? If not, you could use a git filter to strip the outputs. Then nbdime would never see the outputs. Otherwise, it would be a more extensive change. That doesn't mean it won't be done, just not in the short term. For now I'm pushing to get out a patch release with the small tweaks that have already been done. If you want to contribute a fix for this to speed it along, I'll be happy to help with that, but again, it would likely mean some refactoring of the code. |
I still don't follow your logic wrt metadata here: #386 (comment) if that's the configuration as you displayed it:
it should not show metadata, yet it does. And somehow you say that it's how it should be, yet, your equivalent configuration suggests the opposite - that it's set to be ignored. |
That would work. OK, so the remaining issue will be on nbdime's todo-list, correct? |
@stas00 Sorry, whenever I get back to this issue, I get lost in the different threads of conversation. If there are any issues remaining here, would you mind opening separate issues for them? I'm going to close this for now. |
I'm using nbdime-1.0.1.
http://localhost:8888/nbdime/git-difftool?base=fastai%2Fcourses%2Fdl1%2Flesson1.ipynb
Hitting: Hide unchanged cells
still shows all the code cells, changed and unchanged. The only difference is the the right column where the cell is unchanged is empty. This seems to be a bug, as it's not hiding the unchanged cells.
Perhaps the issue is that In[\d\d] is different in the original and the modified notebook. Yet if I don't hit 'Hide Unchanged cells' it doesn't display them as changed - and show to the full screen width.
Yet, it does report/hide some unchanged cells properly:
So, something is incomplete.
both snapshots are from the same diff.
Thank you!
The text was updated successfully, but these errors were encountered: