ci: strip notebook outputs via git filter instead of pre-commit hook#9
Merged
Conversation
Replaces the in-place nbstripout pre-commit hook (which stripped the working copy on every commit) with the nbstripout git *filter*: outputs are stripped from the committed blob while staying in the working tree, so notebooks stay rendered locally. Set up per clone via the bundled `install-hooks` task; enforced in CI with `nbstripout --verify`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Switches notebook-output stripping from the in-place
nbstripoutpre-commit hook to the nbstripout git filter.Why
The pre-commit hook rewrote the notebook on disk at every commit, so working-copy outputs were destroyed and had to be re-run. The git filter strips outputs only from the committed blob and leaves the working tree untouched — notebooks stay rendered locally, git history stays clean.
Changes
nbstripoutpre-commit hook..gitattributes:*.ipynb filter=nbstripout(+diff=ipynb).install-hookstask (pre-commit install+nbstripout --install+ diff textconv); README setup is nowpixi install→pixi run install-hooks→pixi run install-kernel.nbstripout --verifyover tracked notebooks (catches clones that skippedinstall-hooks).pixi run install-hooksonce to activate the filter.