Repository navigation
feat(notebooks): add shared environment-bootstrap module and drift-check tooling - #65
Merged
Merged
Conversation
…eck tooling machinevision-toolbox-python 2.2.0 shipped a broken JupyterLite "Try it Now" demo: tqdm was added as a real dependency but never added to the one notebook's hand-maintained micropip install list, and nothing tested it before release. More generally, 13 of 16 notebooks each carried their own slightly-drifted, hand-pasted copy of the Colab-install snippet. Introduces a single source of truth (_mvtb_nb_bootstrap.py) for installing the toolbox across local Jupyter, Google Colab, and JupyterLite/Pyodide, a generator (sync_bootstrap.py) that regenerates each notebook's marked bootstrap cell from it, and a pure-stdlib output-clearer (clear_outputs.py). A plain git hook (.githooks/pre-commit, not the pre-commit framework -- see docs/notebooks/README.md for why) applies both silently at commit time; a docs.yml CI step is the backstop for machines without the hook installed. No notebooks are migrated to the marker cell yet -- that's a follow-up change. This lands the tooling and its tests only. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Security | 1 minor 17 high 1 critical 1 medium |
🟢 Metrics 57 complexity · 4 duplication
Metric Results Complexity 57 Duplication 4
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
4 tasks done
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
docs/notebooks/_mvtb_nb_bootstrap.py, a single source of truth for installing the toolbox across local Jupyter, Google Colab, and JupyterLite/Pyodide, replacing the pattern of 13+ notebooks each hand-pasting their own slightly-drifted Colab-install snippet.sync_bootstrap.py(regenerates each notebook's marked bootstrap cell from the template) andclear_outputs.py(pure-stdlib output clearing) — both support--checkfor CI and explicit file args for the commit hook..githooks/pre-commit, a plain git hook (not thepre-commitframework — seedocs/notebooks/README.mdfor why) that applies both fixes silently at commit time and re-stages the result.docs.ymlCI step running both scripts in--checkmode as the backstop for machines without the hook installed.tests/test_notebook_bootstrap.pycovering the generator/clearer logic directly (marker detection, fix vs. check mode, idempotency).This was prompted by machinevision-toolbox-python 2.2.0 shipping a broken JupyterLite "Try it Now" demo —
tqdmwas added as a real dependency but never added to the one notebook's hand-maintained micropip install list, and nothing tested it before release.Not included, deliberately: no notebooks are migrated to use the marker cell yet — that's a follow-up change, so this PR is reviewable as tooling-only.
Test plan
pytest tests/test_notebook_bootstrap.py— 10/10 passruff checkclean on all new filessync_bootstrap.py --check/clear_outputs.py --checkagainst the realdocs/notebooks/— correctly report nothing to do (no notebooks migrated yet).githooks/pre-commitdirectly against a real staged commit — confirmed it doesn't touch the 16 existing notebooks it shouldn'tast.PyCF_ALLOW_TOP_LEVEL_AWAIT(matches how a real Jupyter/IPython kernel executes top-levelawaitin a cell)🤖 Generated with Claude Code