test: assert every Colab project installs all three samplers - #166
Merged
Merged
Conversation
The Colab bootstrap installs with `pip install *packages --no-deps`, so any sampler absent from the list never lands and the notebook cell constructing that search dies with `ModuleNotFoundError` at fit time. That is how #164's bug reached users: `dynesty` and `emcee` were missing from `_SHARED_EXTRAS` and HowToFit chapter 1 tutorials 4 (dynesty), 5 and 6 (emcee) died on Colab. #164 fixed the list but shipped no test — `TestRegistry` asserted only `packages[0] == "autonerves"`, so nothing stops a future edit dropping a sampler again. Adds `TestRegistry.test_every_project_installs_every_sampler`: for every `_PROJECTS` entry ("autofit", "autogalaxy", "autolens", "howtofit", "howtogalaxy", "howtolens") the resolved `packages` list must contain `dynesty`, `emcee` and `nautilus-sampler`. Matched on requirement name with the version specifier split off, so a future re-pin does not break the test. Test-only; `autonerves/setup_colab.py` is untouched. Closes #165 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011DMhAYrJ6m2spkTVEWcSKg
8 tasks
This was referenced Sep 14, 2026
Closed
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
Adds the regression test that #164 shipped without.
The Colab bootstrap installs its package list with
pip install *packages --no-deps, so a sampler that is not named in the list never lands — nothingarrives transitively via
autofit.dynestyandemceewere missing, andevery Colab notebook running
af.DynestyStaticoraf.Emceedied withModuleNotFoundErrorat fit time, across all six_PROJECTSentries(observed in HowToFit chapter 1 tutorials 4, 5 and 6).
#164 (merged,
8336939) fixed the list. It did not add a test:TestRegistryasserted onlyspec["packages"][0] == "autonerves", so nothingstopped a future edit dropping a sampler again — which is exactly how the bug
arose. This PR closes that gap.
TestRegistry.test_every_project_installs_every_samplerasserts that forevery key in
_PROJECTS("autofit", "autogalaxy", "autolens", "howtofit","howtogalaxy", "howtolens") the resolved
packageslist containsdynesty,emceeandnautilus-sampler. It matches on the requirement name withany version specifier split off, so a future re-pin does not break it.
Release caveat — the main point of this PR's context. Colab notebooks
pip install autonervesfresh on every run, so #164's fix reaches users onlyonce a new
autonervesis released to PyPI. Merging this PR (or #164)changes nothing user-visible; Colab users keep hitting the
ModuleNotFoundErroruntil that release ships.autonerves/setup_colab.pyis untouched by this PR. The existingemcee>=3.1.6/dynesty==2.1.5pins track PyAutoFit'spyproject.tomlandare left exactly as #164 shipped them; the
_SAMPLERSregrouping floated inthe issue plan was deliberately not taken, as unrequested churn on
freshly-merged code — the test asserts on the resolved
packages, so itholds either way if that refactor is ever made.
--no-depsruntime-requirement checkBecause of
--no-deps, each named sampler's own runtime requirements mustalready exist in a stock Colab image:
dynesty==2.1.5emcee>=3.1.6numpy(h5py/scipy only under theextrasextra)nautilus-sampler==1.0.4numpy>=1.18.0,scipy>=1.4.0,scikit-learn>=0.22.0,threadpoolctl>=3.0.0Nothing further needs adding to the install list.
Flagged follow-up (not fixed here)
setup_colab.pypinsnautilus-sampler==1.0.4, while PyAutoFit'spyproject.tomldeclaresnautilus-sampler==1.0.5. Every other samplerspecifier in the list matches autofit exactly, so this one looks like drift
rather than intent. Because the install is
--no-deps, Colab therefore gets1.0.4 against an autofit that expects 1.0.5.
Deliberately left alone: this PR is test-only and the new assertion matches on
package name, so it passes either way. Worth its own prompt.
API Changes
None — test-only changes.
Test Plan
python3 -m pytest test_autonerves/test_setup_colab.py -q→ 21 passedpython3 -m pytest test_autonerves -q→ 184 passed (183 before this PR)dynesty,emcee,nautilus-samplerfrom a copy of the registry makes the new assertion fail (it is not a
tautology); substituting
dynesty==9.9.9and a bare unpinnedemceekeeps it passing (a future re-pin will not break it).
Closes #165.
Generated by the PyAutoLabs agent workflow.
🤖 Generated with Claude Code
https://claude.ai/code/session_011DMhAYrJ6m2spkTVEWcSKg