Repository navigation
CI on a clean machine, with a licence probe and a lint pass - #1
Merged
Merged
Conversation
The standard's Part 1 rule 6 asks for tests that CI runs on a clean
machine. This repository had 181 tests and no CI at all; GitHub had never
run anything. This adds .github/workflows/ci.yml, adapted from
code-standard's templates/:
suite pytest, tools/check_notebooks.py, tools/check_seeds.py, ruff
energy the PyPSA half of tests/test_energy.py, in its own job because
PyPSA 1.3 needs pandas 3
Both log `pip freeze`, so the resolved versions are recorded with every
run (rule 3: a range is not a record).
No secrets. CI has only the size-limited licence that `pip install
gurobipy` ships. Measured locally with the licence file hidden: 174 tests
pass and exactly 7 fail, all in test_newsvendor.py, because its scenario
model is 3,002 variables against a 2,000 limit. tests/conftest.py now asks
the solver once (one variable past the limit, error 10010) and skips only
tests marked needs_full_licence, with the reason printed by -rs. Watched
both ways: with the licence, 10/10 newsvendor tests run; with it hidden,
3 pass and 7 skip.
A job that exists to run the PyPSA tests must not go green by skipping
them. tests/test_energy.py now raises at collection when
ORTEACH_REQUIRE_PYPSA=1 and PyPSA does not import; the energy job sets it.
Watched to fail with PyPSA shadowed by a stub that refuses to import: 6
skips without the variable, a collection error with it.
pyproject.toml gains ruff in dev (pinned to 0.15.x, since new minors add
rules) and an `energy` extra (pypsa, pandas 3), plus [tool.ruff] excluding
notebooks, whose inline knobs and repetition are correct by Part 4. The
14 findings ruff reported were cosmetic: unused imports (none re-exported),
semicolon-joined statements, a lambda, and `l` as a name. No behaviour
changed.
README: a statement of what the library is for, under the title, which
until now came only after the citation block; install lines; and what CI
runs and skips.
Local gate on this commit: 181 passed, 17 notebooks and 11 seeds clean,
ruff clean.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
CI read for 229cd68: both jobs green.
|
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.
Why
The code standard (Part 1 rule 6) requires tests that CI runs on a clean machine. This repo had 181 tests, but GitHub had never run any of them.
What
.github/workflows/ci.yml, adapted fromcode-standard/templates/, with two jobs:tools/check_notebooks.py,tools/check_seeds.py, thenruff check .pip freeze, so every run records what actually ran. No secrets are needed.tests/conftest.pyprobes the Gurobi licence once.pip install gurobipy(2,000 variables).ORTEACH_REQUIRE_PYPSA=1makes the energy job fail if PyPSA won't import, instead of skipping everything and going green.pyproject.toml: ruff added todev; a newenergyextra (pypsa, pandas 3); ruff excludesnotebooks/.las a variable name). No behaviour change.Evidence
The CI result for this PR is the last piece of evidence; I'll report it on this PR.
🤖 Generated with Claude Code