Add nbstripout
Add nbstripout as a pre-commit-hook. nbstripout is configured to remove everything except the cell outputs. I've also run it against all the files.
Check out this pull request on ![]()
See visual diffs & provide feedback on Jupyter Notebooks.
Powered by ReviewNB
Codecov Report
Merging #644 (44a08c5) into master (3772a89) will increase coverage by
0.06%. The diff coverage isn/a.
@@ Coverage Diff @@
## master #644 +/- ##
==========================================
+ Coverage 80.39% 80.45% +0.06%
==========================================
Files 77 77
Lines 10597 10634 +37
==========================================
+ Hits 8519 8556 +37
Misses 2078 2078
| Impacted Files | Coverage Δ | |
|---|---|---|
| alibi/explainers/tests/test_ale.py | 100.00% <0.00%> (ø) |
|
| alibi/explainers/ale.py | 64.57% <0.00%> (+4.27%) |
:arrow_up: |
This slightly changes our example notebooks as there are no more execution counts besides cells (i.e. [1] becomes [ ]), this is probably not an issue per-se, but as this is as pre-commit hook then it will not be used by everyone so we will end up with a mix of real and null execution counts in the docs. Is there an option to keep the execution counts?
This slightly changes our example notebooks as there are no more execution counts besides cells (i.e.
[1]becomes[ ]), this is probably not an issue per-se, but as this is as pre-commit hook then it will not be used by everyone so we will end up with a mix of real andnullexecution counts in the docs. Is there an option to keep the execution counts?
Hmm True, Although if not everyone uses this then they're we'll still end up with the other stuff, like the pycharm data in the notebooks? I had left the execution count stuff out as it was annoying editing the notebooks so the execution count was in the correct order. I almost want to suggest going the other way and adding tests to check the notebooks have been cleaned? This would push developers to use the pre-commit hook/clean them themselves. Maybe this isn't necessary though.
-
nbstripoutdoesn't actually remove metadata introduced by pycharm. - It can be run so as not to submit changes to the notebooks using
nbstriptout run --dry-runbut seemingly this option doesn't work with the--keep-outputsoption.
In order to remove the pycharm metadata in #583 I just wrote a quick script that does so using nbformat. I've committed it here as potentially it's a simpler solution.