Update .ipynb notebooks from .py in pre-commit hook #504
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey,
I guess this feature was discussed previously in order to get rid of the additional commit from bot and directly "sync" the
.ipynb
notebooks with the.py
files.In this commit I add two
pre-commit
hooks:--update
argument writes to the cell content and does not modify the cell-id and output. The fact that cell-id is not modified makes the changes independent from time or pc. However, the--update
also preserves the cell output. Therefore the 2nd hook below is required..ipynb
notebooks. This check is needed for correct work ofjupytext
but will also be a sign for a user before commit that all changes in the notebooks will be deleted.This allows further delete the whole action section dedicated to the pip env setup, conversion, commit and push of the notebooks. I believe that this will make the procedure much more transparent and easier. As far as I understand we are also secured with the
pre-commit
tests running in CI to be sure that nobody will possibly commit to the project without necessarypre-commit
hooks executed.Cheers
Leonid