Closed tgandor closed 4 years ago
Can you please confirm your platform, Python and nbstripout version?
I'm sorry but I've been working in a setup where I wanted to commit the cell outputs together with the notebooks recently. In the next few days I'll set up nbstripout again and try to reproduce this.
Windows10 == 1809 Python == 3.8.1 nbstripout == 0.3.7
--- a/arrays_strings/rotation/rotation_challenge.ipynb
+++ b/arrays_strings/rotation/rotation_challenge.ipynb
@@ -165,9 +165,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.5.0"
+ "version": "3.8.1"^M
}
},
"nbformat": 4,
- "nbformat_minor": 0
+ "nbformat_minor": 1^M
}
What is your Git config setting for core.autocrlf
and core.safecrlf
?
What is your Git config setting for
core.autocrlf
andcore.safecrlf
?
$ git config core.autocrlf
input
$ git config core.safecrlf
\<no output>
I don't have access to a Windows system to reproduce this and I don't have a good idea what might cause this behaviour and if it's working as intended or not.
Does nbstripout
change this behavious i.e. when you change a notebook without having nbstripout
installed and then git add
it, does git diff --cached
show the ^M
?
@amard33p any update on this?
@amard33p any update on this?
@kynan Sorry this was quite a while back. I have since switched Google Colab for Jupyter notebooks. It serves my purpose.
https://github.com/kynan/nbstripout/pull/126 looks promising though...can't verify it.
@ooiM has this been addressed by #126? Can we close this?
@kynan Yes, I think the problem was solved.
I installed
nbstripout
without arguments (locally) in the repository.Then I added a "dirty" notebook, say with
git add myNb.ipynb
.Ok, doing a check with
git diff --cached
- I don't see outputs or metadata (OK!), but all the inserted lines have a "^M" (carriage return) in the diff view.I ran
nbstripout myNb.ipynb
and git status showed no changes. Even so, I re-rangit add myNb.ipynb
and thengit diff --cached
showed a lot of newlines.I also have
nbdime
installed, so I saw that the[diff ipynb]
(or sth like that) section in.git/config
and deleted it. The ugly JSON diffs with ^M disappeared, and the structured nbdime diff shows no appended newlines (but - it may actually mask the problem).I can't be sure what is at fault here:
I'd like to know, if this is a false alarm, or actual whitespace pollution to the repository.