EgoDex: nbstripout hook to keep example notebooks output-free#49
Merged
Conversation
Adds nbstripout (lint extra) and wires it into the hand-rolled precommit hook: 'make precommit' now runs 'nbstripout --verify' on datasets/*.ipynb and fails if any carries stored outputs or execution counts. 'make strip-notebooks' cleans them in place. Scoped to datasets/ so the conference/demo notebooks under notebooks/ keep their intentional rendered outputs. Re-serializes egodex_demo.ipynb in nbstripout's canonical form (indent 1, deterministic sequential cell ids) so the tool and the committed file agree — future strips are idempotent no-ops. Verified: --verify passes on the clean notebook and rejects one with outputs; second strip is a no-op. Co-Authored-By: Claude Fable 5 <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
Follow-up to #48. Keeps the example notebooks under
datasets/committed source-only, so run outputs can't creep back in.nbstripoutto thelintextra.make precommitnow runsnbstripout --verifyondatasets/**/*.ipynband fails if any carries stored outputs or execution counts.make strip-notebooksto clean them in place.egodex_demo.ipynbin nbstripout's canonical form (indent 1, deterministic sequential cell ids) so the tool and the committed file agree — future strips are idempotent no-ops.Scope
Deliberately scoped to
datasets/. Four notebooks undernotebooks/(window_functions,data-ai-summit-2024,voice_ai_analytics,reddit) currently ship with rendered outputs, which looks intentional for conference/demo material — so this doesn't touch them or break commits on them. Easy to widen theDATASET_NOTEBOOKSglob later if we want repo-wide enforcement.Verification
make precommitpasses on the clean notebook;nbstripout --verifyexits non-zero on a notebook with injected outputs (gate works).make strip-notebooksis a no-op (idempotent); notebook stays valid nbformat with 24 unique cell ids.🤖 Generated with Claude Code