feat: setup_colab registry for all 6 notebook repos, GPU/env fixes, tag-pinned clones - #120
Merged
Conversation
_PROJECTS registry covers all six notebook repos (autofit/autogalaxy/ autolens workspaces + HowToFit/HowToGalaxy/HowToLens) behind a public setup(project) entry point; for_autolens/for_autogalaxy wrappers keep their signatures and for_autofit/for_howto* are added. Fixes: GPU detection now accumulates across devices and handles an empty device list (was last-device-wins + UnboundLocalError); XLA_FLAGS is no longer mutated at import time (jax_wrapper remains the canonical local channel; the flag is set only inside the Colab setup path); the workspace clone is --depth 1 and pinned to the tag matching the installed release, with default-branch fallback. Adds the module's first unit tests. Part of PyAutoLabs/PyAutoHands#124 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Jammy2211
pushed a commit
that referenced
this pull request
Jul 23, 2026
The `check_version` fixtures were pinned to April 2026 values and the colab mock returned `2026.7.6.649` — one of the accidental run_number releases that was yanked from PyPI. Re-anchor them on current, installable values. These are arbitrary sentinels; nothing reads a real release. What matters is the deltas, not the absolute dates (`_STALENESS_WINDOW_DAYS = 30`): | Fixture | Old | New | Delta | |---|---|---|---| | base workspace version | 2026.4.13.6 | 2026.7.22.1 | anchor | | within-window library | 2026.4.20.1 | 2026.7.29.1 | +7d <= 30 -> silent | | beyond-window library | 2026.6.1.1 | 2026.9.9.1 | +49d > 30 -> warns | | colab mock version | 2026.7.6.649 | 2026.7.22.1 | off the yanked release | Unchanged deliberately: `2025.1.1.1` (the "much older" mismatch sentinel) and `2027.1.1.1` (far-future sentinel proving `minimum_library_version` is the floor). A blanket find-replace collapses these into the base value and breaks the mismatch/ordering tests — verified, it fails exactly 3 tests. `__version__` is deliberately NOT touched. Releases are wheels+tags only (PyAutoBuild#118/#120): `release.yml` seds the version into the build tree and never commits back to any main, so main's `__version__` is expected to lag and hand-bumping it re-establishes the pattern #120 removed. 151 passed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jul 23, 2026
Jammy2211
added a commit
that referenced
this pull request
Jul 23, 2026
The `check_version` fixtures were pinned to April 2026 values and the colab mock returned `2026.7.6.649` — one of the accidental run_number releases that was yanked from PyPI. Re-anchor them on current, installable values. These are arbitrary sentinels; nothing reads a real release. What matters is the deltas, not the absolute dates (`_STALENESS_WINDOW_DAYS = 30`): | Fixture | Old | New | Delta | |---|---|---|---| | base workspace version | 2026.4.13.6 | 2026.7.22.1 | anchor | | within-window library | 2026.4.20.1 | 2026.7.29.1 | +7d <= 30 -> silent | | beyond-window library | 2026.6.1.1 | 2026.9.9.1 | +49d > 30 -> warns | | colab mock version | 2026.7.6.649 | 2026.7.22.1 | off the yanked release | Unchanged deliberately: `2025.1.1.1` (the "much older" mismatch sentinel) and `2027.1.1.1` (far-future sentinel proving `minimum_library_version` is the floor). A blanket find-replace collapses these into the base value and breaks the mismatch/ordering tests — verified, it fails exactly 3 tests. `__version__` is deliberately NOT touched. Releases are wheels+tags only (PyAutoBuild#118/#120): `release.yml` seds the version into the build tree and never commits back to any main, so main's `__version__` is expected to lag and hand-bumping it re-establishes the pattern #120 removed. 151 passed. Co-authored-by: Jammy2211 <JNightingale2211@gmail.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
3 tasks
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
Generalizes
autoconf/setup_colab.pyfrom two hand-duplicated helpers into a single_PROJECTSregistry covering every Colab-enabled notebook repo (autofit/autogalaxy/autolens workspaces + HowToFit/HowToGalaxy/HowToLens), behind a publicsetup(project)entry point. PyAutoBuild's notebook generation (PyAutoLabs/PyAutoHands#125) injects a setup cell callingsetup_colab.setup("<project>")into every generated notebook, so this module becomes the single runtime bootstrap for all ~489 published notebooks.Part of PyAutoLabs/PyAutoHands#124 (Colab maturity, phase 1).
Release coupling: merge together with the PyAutoBuild injection PR — injected notebook cells call
setup_colab.setup(), which reaches users via the next autoconf release (notebooks are only regenerated at release time, so ordering is safe by construction).API Changes
Added a public
setup(project, raise_error_if_not_gpu=False)entry point andfor_autofit/for_howtofit/for_howtogalaxy/for_howtolenswrappers;for_autolens/for_autogalaxykeep their exact signatures and defaults. Behaviour fixes: importing the module no longer setsXLA_FLAGS(was clobbering user env on everyimport autoconf); GPU detection considers all devices and tolerates an empty device list; the workspace clone is shallow and pinned to the installed release's tag (default branch fallback).See full details below.
Test Plan
python -m pytest test_autoconf/— 132 passed (15 new intest_setup_colab.py: registry shape, wrapper delegation, clone tag/fallback logic with mocked subprocess, GPU-detection regressions on stub devices, no-import-side-effects guard, outside-Colab no-op)Full API Changes (for automation & release notes)
Added
setup_colab.setup(project: str, raise_error_if_not_gpu: bool = False)— bootstrap any ofautofit|autogalaxy|autolens|howtofit|howtogalaxy|howtolenssetup_colab.for_autofit(raise_error_if_not_gpu=False)setup_colab.for_howtofit(raise_error_if_not_gpu=False)setup_colab.for_howtogalaxy(raise_error_if_not_gpu=False)setup_colab.for_howtolens(raise_error_if_not_gpu=False)Changed Behaviour
import autoconf.setup_colabno longer mutatesos.environ["XLA_FLAGS"]; the flag is set only inside the Colab setup path. Local users are unaffected:autoconf/__init__importsjax_wrapper, which owns setting the flag — the removed module-level line was redundant.check_jax_using_gpuaccumulates accelerator status across all devices (was: last device enumerated wins) and returns True on an empty device list (was:UnboundLocalError).--depth 1and pinned to the git tag matching the installed release of the project's top package (importlib.metadata.version), falling back to the default branch when the tag is missing (e.g. dev installs). Previously: full-depth clone ofmainHEAD (version skew vs the pip-installed release).Migration
setup_colab.for_autolens(...)/for_autogalaxy(...)work unchanged.🤖 Generated with Claude Code