Skip to content

Benchmark template: imports and capabilities that span a commit range - #278

Open
trexfeathers wants to merge 2 commits into
SciTools:mainfrom
trexfeathers:benchmark-template-import-safety
Open

trexfeathers wants to merge 2 commits into
SciTools:mainfrom
trexfeathers:benchmark-template-import-safety

Conversation

@trexfeathers

@trexfeathers trexfeathers commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

(posted by Claude Opus)

Two rules for the benchmark README template, both learned by having the benchmark job fail in SciTools/iris, plus one line for the MANIFEST template. Nothing here changes behaviour in any repo on its own — it is guidance plus one packaging exclusion — so the risk is that the guidance is wrong or too narrow rather than that something breaks. I would value a check on whether the second rule generalises beyond the case that prompted it.

A benchmark run checks out each commit in a range and runs one copy of the benchmark code against all of them. Benchmark code that imports a name which has since moved therefore fails on every commit before the move, which is the whole before half of a before-and-after comparison. The same holds for a capability that did not always exist: a benchmark parametrised over it has nothing to time on the older commits, and attempting it reports a failure where there is no measurement to make. The README now says to import the current name with the old one as a fallback, and to raise NotImplementedError in setup() so ASV skips an unsupported parameter — leaving the parameter in params, since removing it renames the benchmark and ASV matches results by name.

prune .hooks is unrelated and much smaller: a repo keeping git hooks there was packaging them into the sdist. It sits with the other top-level directories that never belong in one.

Where I would look first

The NotImplementedError skip. It is ASV's documented mechanism and already used elsewhere in the Iris suite, but I have only exercised it for one case — a file format that older commits cannot write. If there is a kind of capability where skipping would hide a regression rather than avoid a meaningless measurement, the wording needs narrowing.

The generalised example in the import rule. I replaced the Iris module names with mypackage.formats.* so the template stays repo-neutral, which does make it more abstract than the real case.

What I rejected

Iris's MANIFEST.in has drifted from this template in several other places — global-exclude AGENTS.md and global-exclude CLAUDE.md, include environment.yml, and prune benchmarks in its repo-specific section. None of those came from the branch that prompted this, so none is mine to push back here; they are worth their own look by someone who knows why each was added. The template also still carries exclude .flake8, which Iris has dropped, and that is a question for the same review rather than this pull request.

Verification

The import rule and the skip were both run in SciTools/iris against two commits either side of the change that broke things: on the earlier commit the unsupported parameter reports n/a beside a measured one, and the benchmark that reaches the moved import runs where it previously raised ImportError. asv compare reports no false regression. The equivalent changes to the Iris copies of both files are in SciTools/iris#7354.

Iris already carries both of these changes, in SciTools/iris#7354, so it needs no issue raising against it when this merges: @scitools-templating: please no update notification on: iris

Every other repo using these templates should still be notified. MANIFEST.in is shared with seven more, and benchmarks/README.md with iris-esmf-regrid, and none of them has seen either change.

trexfeathers and others added 2 commits October 28, 2026 17:47
A benchmark run checks out each commit in a range and runs one copy of
the benchmark code against all of them, so benchmark code that imports a
name which has since moved fails on every commit before the move - the
whole before half of a before-and-after comparison. The same holds for a
capability that did not always exist: a benchmark parametrised over it
has nothing to time on the older commits, and attempting it reports a
failure where there is no measurement to make.

The README gains both rules: import the current name with the old one as
a fallback, and raise NotImplementedError in setup() to have ASV skip an
unsupported parameter, leaving the parameter in params so the benchmark
keeps its name.

Found in SciTools/iris, where the benchmark job had been failing since
the CF loader relocated. Both rules were verified there by running two
commits either side of the change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A repo keeping git hooks in a .hooks directory was packaging them.
Listed beside the other top-level directories that never belong in an
sdist, in the section whose own comments say that naming a directory
which does not exist in a given repo does no harm.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant