Skip to content

ci: strip notebook outputs via git filter instead of pre-commit hook#9

Merged
Marius1311 merged 1 commit into
mainfrom
chore/nbstripout-filter
Jun 22, 2026
Merged

ci: strip notebook outputs via git filter instead of pre-commit hook#9
Marius1311 merged 1 commit into
mainfrom
chore/nbstripout-filter

Conversation

@Marius1311

Copy link
Copy Markdown
Member

What

Switches notebook-output stripping from the in-place nbstripout pre-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

  • Remove the nbstripout pre-commit hook.
  • Add .gitattributes: *.ipynb filter=nbstripout (+ diff=ipynb).
  • Bundle setup into the install-hooks task (pre-commit install + nbstripout --install + diff textconv); README setup is now pixi installpixi run install-hookspixi run install-kernel.
  • Enforce in CI with nbstripout --verify over tracked notebooks (catches clones that skipped install-hooks).

⚠️ Every clone (laptops, remote servers, worktrees) must run pixi run install-hooks once to activate the filter.

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>
@Marius1311 Marius1311 merged commit c5c5fe5 into main Jun 22, 2026
1 check failed
@Marius1311 Marius1311 deleted the chore/nbstripout-filter branch June 22, 2026 12:44
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.

1 participant