Skip to content

Strip notebook outputs and add nbstripout pre-commit hook#240

Merged
zfergus merged 2 commits into
mainfrom
strip-notebook-outputs
Jul 7, 2026
Merged

Strip notebook outputs and add nbstripout pre-commit hook#240
zfergus merged 2 commits into
mainfrom
strip-notebook-outputs

Conversation

@zfergus

@zfergus zfergus commented Jul 7, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds the nbstripout pre-commit hook so notebook output cells (execution counts, embedded plot JSON/images) no longer get committed on every re-run.
  • Strips existing output from all 13 tracked notebooks to match what the hook now enforces.

Output-heavy notebooks were bloating diffs and repo size for no rendering benefit — several embed Plotly figures (application/vnd.plotly.v1+json) with no image/png/text/html fallback, which GitHub's notebook viewer doesn't render anyway.

Test plan

  • pre-commit run nbstripout --all-files runs clean (no further changes) after this PR
  • Contributors run pre-commit install locally so the hook applies to future commits

🤖 Generated with Claude Code

zfergus and others added 2 commits July 7, 2026 16:28
Prevents large, noisy diffs from notebook output cells (execution
counts, embedded plot JSON/images) getting committed on every re-run.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Applies the new nbstripout hook retroactively so existing notebooks
match what pre-commit will now enforce going forward.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 7, 2026 20:29
@zfergus
zfergus merged commit bfa4703 into main Jul 7, 2026
1 of 3 checks passed
@zfergus
zfergus deleted the strip-notebook-outputs branch July 7, 2026 20:31
Copilot stopped reviewing on behalf of zfergus due to an error July 7, 2026 20:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR standardizes Jupyter notebooks by clearing execution artifacts (outputs/execution counts) and adds a pre-commit hook to keep notebooks stripped going forward.

Changes:

  • Added nbstripout to pre-commit hooks.
  • Cleared notebook cell outputs and set execution_count to null across multiple notebooks.
  • Removed some non-essential notebook metadata fields (e.g., orig_nbformat) and adjusted cell metadata/IDs in places.

Reviewed changes

Copilot reviewed 7 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
notebooks/tangent_basis_grad.ipynb Clears execution artifacts; also rewrites cell IDs to numeric strings.
notebooks/physical_barrier.ipynb Clears outputs/execution counts; removes some cell metadata and notebook-level fields.
notebooks/ee_mollifier_shape_derivative.ipynb Clears outputs/execution counts.
notebooks/distances.ipynb Clears outputs/execution counts; removes orig_nbformat.
notebooks/closest_point_grad.ipynb Clears outputs/execution counts; removes orig_nbformat.
notebooks/area_weights.ipynb Clears outputs/execution counts; removes orig_nbformat.
notebooks/adhesion.ipynb Clears outputs/execution counts and large embedded outputs.
.pre-commit-config.yaml Adds nbstripout hook to enforce stripping notebooks on commit.
Comments suppressed due to low confidence (1)

notebooks/physical_barrier.ipynb:1

  • This change drops existing cell metadata (previously included scrolled: true). If the goal is purely to strip execution artifacts, avoid removing UI/authoring metadata because it can change how the notebook is presented when opened. Consider adjusting the notebook-cleaning workflow (or nbstripout configuration) to only clear outputs and execution counts while preserving cell metadata fields.
{

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +5 to +6
"execution_count": null,
"id": "0",
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.

2 participants