Overview
Closes the last gap from the Colab maturity effort (PyAutoLabs/PyAutoBuild#124, closed): nothing actually executes the Colab bootstrap path. The setup cell is unit-tested and its no-op-outside-Colab path runs everywhere, but no CI simulates a real Colab session. This adds a check F ("Colab simulation") to Heart's verify_install suite: fresh venv → pip from PyPI → fake google.colab → the injected setup cell's code verbatim → assert clone/config/cwd → run a real notebook cell.
User-approved in-session; effective level safe (mechanical, well-specified; single-purpose).
Plan
- PyAutoHeart — new
check_f in heart/checks/verify_install.sh, following the A–E pattern (throwaway venv, PASS/FAIL/SKIP row, --report-json sidecar → readiness). Emulates Colab's base env (pip install autolens jax), installs a fake google.colab stub in the venv so the real on-Colab branch activates, executes the injected-cell code verbatim, asserts the workspace cloned + config pushed + cwd moved, then runs a genuine cell (al.Imaging.from_fits on dataset/imaging/simple). Honest SKIP when the installed autoconf predates the setup() registry (i.e. until the next release) — the check self-activates once the release ships. Docs + arg parsing + help updated; light tests (syntax + help/arg surface).
- PyAutoConf — add
workspace_dir: str | None = None override to setup_colab.setup (threaded to _colab_setup/_clone_workspace), because the registry hardcodes Colab's /content/..., which CI cannot write. Unit tests extended.
Detailed implementation plan
Affected Repositories
- PyAutoHeart (primary)
- PyAutoConf
Branch Survey
| Repository |
Current Branch |
Dirty? |
| ./PyAutoConf |
main |
clean |
| ./PyAutoHeart |
main |
clean |
Suggested branch: feature/colab-sim-verify-install
Work Classification: Library
Worktree root: ~/Code/PyAutoLabs-wt/colab-sim-verify-install/
Implementation Steps
PyAutoConf/autoconf/setup_colab.py: setup(project, raise_error_if_not_gpu=False, workspace_dir=None); override threads through _colab_setup → _clone_workspace and the conf.instance.push/os.chdir paths. Docstring notes it exists for CI simulation.
PyAutoConf/test_autoconf/test_setup_colab.py: override-threading test.
PyAutoHeart/heart/checks/verify_install.sh: register F in usage/help/arg-parse/runner; check_f() builds the venv, installs autolens jax (honouring --version / --testpypi / PIP_INDEX_ARGS), writes google/colab stub packages into site-packages, writes a Python driver to the venv dir and runs it from a scratch cwd; driver: import google.colab, bootstrap pip install autoconf --no-deps, hasattr(setup_colab, "setup") else SKIP(rc 3), setup("autolens", raise_error_if_not_gpu=False, workspace_dir=$TMP), assert cwd/config/clone, then the imaging cell. PASS/FAIL/SKIP row per suite convention.
PyAutoHeart/tests/test_verify_install_script.py: bash -n syntax check; --help lists F; unknown-arg rejection unchanged.
- Update
heart/checks/verify_install.sh header comment + skills/verify_install doc line if it enumerates checks.
Key Files
PyAutoHeart/heart/checks/verify_install.sh
PyAutoConf/autoconf/setup_colab.py / test_autoconf/test_setup_colab.py
Original Prompt
Click to expand starting prompt
See PyAutoMind/issued/colab_sim_verify_install.md.
Overview
Closes the last gap from the Colab maturity effort (PyAutoLabs/PyAutoBuild#124, closed): nothing actually executes the Colab bootstrap path. The setup cell is unit-tested and its no-op-outside-Colab path runs everywhere, but no CI simulates a real Colab session. This adds a check F ("Colab simulation") to Heart's
verify_installsuite: fresh venv → pip from PyPI → fakegoogle.colab→ the injected setup cell's code verbatim → assert clone/config/cwd → run a real notebook cell.User-approved in-session; effective level safe (mechanical, well-specified; single-purpose).
Plan
check_finheart/checks/verify_install.sh, following the A–E pattern (throwaway venv, PASS/FAIL/SKIP row,--report-jsonsidecar → readiness). Emulates Colab's base env (pip install autolens jax), installs a fakegoogle.colabstub in the venv so the real on-Colab branch activates, executes the injected-cell code verbatim, asserts the workspace cloned + config pushed + cwd moved, then runs a genuine cell (al.Imaging.from_fitsondataset/imaging/simple). Honest SKIP when the installed autoconf predates thesetup()registry (i.e. until the next release) — the check self-activates once the release ships. Docs + arg parsing + help updated; light tests (syntax + help/arg surface).workspace_dir: str | None = Noneoverride tosetup_colab.setup(threaded to_colab_setup/_clone_workspace), because the registry hardcodes Colab's/content/..., which CI cannot write. Unit tests extended.Detailed implementation plan
Affected Repositories
Branch Survey
Suggested branch:
feature/colab-sim-verify-installWork Classification: Library
Worktree root:
~/Code/PyAutoLabs-wt/colab-sim-verify-install/Implementation Steps
PyAutoConf/autoconf/setup_colab.py:setup(project, raise_error_if_not_gpu=False, workspace_dir=None); override threads through_colab_setup→_clone_workspaceand theconf.instance.push/os.chdirpaths. Docstring notes it exists for CI simulation.PyAutoConf/test_autoconf/test_setup_colab.py: override-threading test.PyAutoHeart/heart/checks/verify_install.sh: registerFin usage/help/arg-parse/runner;check_f()builds the venv, installsautolens jax(honouring--version/--testpypi/PIP_INDEX_ARGS), writesgoogle/colabstub packages into site-packages, writes a Python driver to the venv dir and runs it from a scratch cwd; driver:import google.colab, bootstrappip install autoconf --no-deps,hasattr(setup_colab, "setup")else SKIP(rc 3),setup("autolens", raise_error_if_not_gpu=False, workspace_dir=$TMP), assert cwd/config/clone, then the imaging cell. PASS/FAIL/SKIP row per suite convention.PyAutoHeart/tests/test_verify_install_script.py:bash -nsyntax check;--helplists F; unknown-arg rejection unchanged.heart/checks/verify_install.shheader comment +skills/verify_installdoc line if it enumerates checks.Key Files
PyAutoHeart/heart/checks/verify_install.shPyAutoConf/autoconf/setup_colab.py/test_autoconf/test_setup_colab.pyOriginal Prompt
Click to expand starting prompt
See
PyAutoMind/issued/colab_sim_verify_install.md.