Repository navigation
Add nbstripout pre-commit hook to strip notebook outputs - #52
Merged
e-koch merged 3 commits intoSep 2, 2026
Merged
Conversation
Uses the same setup as radio-astro-tools/uvcombine: an nbstripout pre-commit hook plus a CI job that fails if a notebook with outputs is pushed.
This notebook still had outputs committed, which the new nbstripout pre-commit check correctly flags. Strip it so the whole repo is consistent and CI passes.
These notebooks predate nbformat's cell "id" requirement, so several cells had no id at all. nbformat's validator auto-assigns sequential ids on write in that case, which nbstripout's CI check then flags as a diff. Run the same pinned nbstripout hook locally so the committed files already match what CI expects. No cell content changed.
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.
Summary
.pre-commit-config.yamlrunning the nbstripout hook, and apre-commitGitHub Actions workflow that fails CI if a notebook with outputs is pushed — the same setup already used inradio-astro-tools/uvcombine.pip install pre-commit nbstripout && pre-commit install).All notebooks currently tracked on
masterthat are part of the published site are already output-free, so this only adds enforcement going forward (it does not touchSpectralCube_Examples.ipynb, which is not part of the built site and does carry outputs).Test plan
pre-commit run --files <notebook-with-outputs>that the hook strips cell outputs and execution counts as expected.pre-commitCI workflow runs successfully once merged.