Skip to content

Add nbstripout pre-commit hook, keeping notebook outputs (#1372) - #1729

Open
shubhangithub wants to merge 1 commit into
google-deepmind:mainfrom
shubhangithub:fix/1372-nbstripout-hook
Open

Add nbstripout pre-commit hook, keeping notebook outputs (#1372)#1729
shubhangithub wants to merge 1 commit into
google-deepmind:mainfrom
shubhangithub:fix/1372-nbstripout-hook

Conversation

@shubhangithub

Copy link
Copy Markdown

Fixes #1372. Re-lands #1519, which had all 13 CI checks green (including pre-commit run -a) and a review of "once the CI passes, I'll be happy to merge", but was closed by its author. The hook config here is byte-identical to that PR's final state.

Keep-outputs verification, comparing parsed JSON before vs after for all 20 notebooks: cell sources identical, output payloads identical, image/png counts identical (e.g. freezing_parameters.ipynb 18 outputs / 12 images, unchanged). The normalization changes two things: execution_count set to null (112 cells, 5 execute_result outputs), and cell ids renumbered to sequential integers in the three notebooks that carry them (muon, rosenbrock_ademamix, linear_assignment_problem) — standard deterministic nbstripout behavior, same as #1519's config produced. The rest of the notebook diff is nbformat's standard reindentation.

pre-commit run --all-files (idempotent on second run) and ruff check . (pinned v0.9.10) pass clean locally.

@google-cla

google-cla Bot commented Jul 20, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@shubhangithub
shubhangithub force-pushed the fix/1372-nbstripout-hook branch from b7dc8cc to c597a92 Compare July 20, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add pre-commit hook that strips notebooks of metadata

1 participant