Repository navigation
Close the standard's remaining gaps: tables, imports, alt text, release pin - #4
Merged
Merged
Conversation
…elease pin Four things the code standard asks for that this library did not do, each now enforced by something that fails rather than by a README line. 1. Tables reachable from anywhere (Part 4). All 14 modules found data/raw by walking up from __file__: right in a clone, wrong after `pip install git+...`, which ships no data/. Several did it inside a default argument, frozen at import time. orteach.paths.table() is now the one resolver, local first: an explicit data_dir=, then $ORTEACH_DATA (both refused if the file is missing, never skipped), then data/raw beside the code, then under the cwd, then the raw URL at the release TAG, fetched once and cached. Loaders take path=None and resolve at call time; writers write into the clone's own data/raw. tests/test_paths.py pins each rule by name. Watched to fail: a named location falling through failed two tests; the URL ahead of the local copy failed one. 2. Every import declared (Part 6). tests/test_dependencies.py parses (never imports) every import in src/, notebooks/ and tests/ and compares with pyproject.toml, which it reads rather than restates. Unknown distributions fail instead of being guessed at. tomli is declared for 3.10 instead of skipped. Watched to fail on an injected `import yaml` in a module and, separately, in a notebook. 3. A text alternative for every figure (Part 3, accessibility; WCAG 2.1 AA from 2027-04-26). The six committed figures (08 x3, 14 x3) had none. Each cell now prints a "Figure:" line saying what the image shows, computed from the same data; the dart scatter separates inside from outside by marker as well as colour. check_notebooks.py refuses any image cell without one. Watched to fail: it flagged exactly those six cells before the fix. 4. Notebooks clone the release, not main (Part 4, Part 5 "tag what you hand out"). Every setup cell gains REF and clones --branch REF. REF must equal orteach.paths.TAG, the tag the package fetches tables from; check_notebooks.py reads TAG from source and refuses a mismatch. Watched to fail on the 11 seeded notebooks before they were regenerated. README "Cutting a release" has the steps. TAG is v1.0.0, which this PR's merge commit is meant to become. All 17 notebooks re-executed. Their outputs match HEAD except the new Figure lines, a branch-and-bound node count in 06's time-limited run (the same bound; node counts under a time limit vary), and -0.0 printed as 0.0 in pooling. No prose number moved; the checker confirms. Gate: 191 passed (base); 21 in the energy venv with ORTEACH_REQUIRE_PYPSA=1; 17 notebooks and 11 seeds clean; ruff clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 27, 2026
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.
Closes the four code-standard gaps that were still open. Each one is now enforced by a test or a checker rule that fails, not by a line in the README.
Data tables can be found from anywhere. New
orteach.paths.table(). It looks in this order:$ORTEACH_DATA;data/rawbeside the code;data/rawunder the working directory;If you name a location (the first two) and the file isn't there, it raises an error instead of quietly using a different copy. Previously all 14 modules walked up from
__file__, which breaks afterpip install, and some did it in default arguments, which are evaluated at import time.Every import is declared. A new test scans the imports in
src/,notebooks/andtests/and checks them againstpyproject.toml.Every figure has a text alternative. Each figure cell now prints a
Figure:line describing what the image shows, and the checker rejects any figure cell without one. Six figures were missing it (three in notebook 08, three in notebook 14).On Colab, notebooks clone the release, not
main. The setup cell'sREFmust matchorteach.paths.TAG, and the checker enforces that.Each guard was checked by breaking it: I injected the defect it targets, confirmed the check failed, removed the defect, and confirmed it passed. The commit message has the details.
Re-execution: all 17 notebooks were re-run. The outputs match
mainapart from the newFigure:lines, one branch-and-bound node count from a time-limited solve, and one-0.0that now prints as0.0. No number quoted in the prose changed.Next: once this is merged, a games notebook (the flu and coin games) follows, then the
v1.0.0tag on the merge commit.🤖 Generated with Claude Code