Open alonme opened 3 years ago
all files are always printed as if they would be changed
Can you clarify what you mean? What are "all files" here?
Yes, sorry for being unclear.
every file that is passed to nbstripout will print.
Dry run: would have stripped {file}
this happens even if a strip a file and then right after that run a dry run.
my expectation is that only files that would have been changed if a "wet run" would have been used - would be printed
OK, I see what you mean. It is a fair point, but not trivial to support unfortunately: it would mean checking if applying nbstripout
would have created a diff, which we don't currently have an easy way to do.
I'll add it as a feature request to the backlog.
Thanks.
Just so i understand - what is the current value of the dry-run option?
It will tell you which files are in scope / would be touched. I agree that your definition is more useful.
Could this be related to this other issue? https://github.com/kynan/nbstripout/issues/160
@joaonc only tangentially. This request is about turning --dry-run
into an "actual" dry run and only report if any changes would have been made.
@alonme Would you be interested in implementing this?
I am facing trouble here, I'll want to give this a try at implementing this @kynan
@swateek sure! You'd need to change this line to not overwrite the notebook and then in the following if args.dry_run:
block you'd need to check if any changes were applied and then only output if there is a diff. You should also do this for the Zeppelin notebook type above. Is this enough to get you started?
let me try this out!
I noticed that when using dry_run, all files are always printed as if they would be changed.
Looking at the code briefly, it does seem like this is what happens.