From f8abb35f1460b46731a56f87d14fca39021079c8 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 24 Aug 2026 19:39:10 +0000 Subject: [PATCH] ci+docs: consume Heart's canonical arcticpy install; fix the documented recipe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The arcticpy install recipe had drifted into four shell copies across the CTI repos with no single owner — this workflow's copy was annotated "Recipe mirrors autocti_workspace_test/.github/scripts/smoke_install.sh", acknowledging the copy-paste in a comment rather than factoring it out. Heart now owns it as a composite action. - .github/workflows/wiki-currency.yml: the inline recipe becomes `uses: PyAutoLabs/PyAutoHeart/.github/actions/install-arcticpy@main`. The "Recipe mirrors …" comment goes with it. - skills/ac_setup_environment.md: this skill is the assistant's answer to what it calls the #1 setup failure, and its recipe was incomplete in three ways. All three were reproduced against a clean build of arcticpy 2.6: * setuptools/wheel missing. --no-build-isolation does not read arcticpy's build-system.requires, so build deps must already be installed; without setuptools the build dies at `BackendUnavailable: Cannot import 'setuptools.build_meta'`. Python 3.12+ venvs no longer ship it. * scipy/matplotlib missing. --no-deps suppresses arcticpy's runtime dependencies, but arcticpy/__init__.py imports read_noise, which imports both at import time — so a good build still fails at `import arcticpy`. * The verification command was wrong. arcticpy exposes no __version__ attribute, so the documented `print(arcticpy.__version__)` raises AttributeError on a perfectly healthy install. Now reads importlib.metadata, with an explicit note so the assistant does not misdiagnose that AttributeError as a broken arcticpy. The skill's "canonical, tested sequence" pointer moves from autocti_workspace_test's smoke_install.sh (which no longer carries a recipe) to Heart's action, which every CTI repo's CI actually runs. skills/*.md are symlinked from .claude/skills/ (git mode 120000), so this edit covers both surfaces. Refs PyAutoLabs/PyAutoHeart#170 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_018nDAxBEavkzb6Zkz1cYHef --- .github/workflows/wiki-currency.yml | 15 +++++----- skills/README.md | 2 +- skills/ac_setup_environment.md | 46 ++++++++++++++++++++++------- 3 files changed, 45 insertions(+), 18 deletions(-) diff --git a/.github/workflows/wiki-currency.yml b/.github/workflows/wiki-currency.yml index ede93ef..9df3aca 100644 --- a/.github/workflows/wiki-currency.yml +++ b/.github/workflows/wiki-currency.yml @@ -113,16 +113,17 @@ jobs: # wheel that would grade the modern docs vacuously. # # arcticpy (the C++ arctic clocking code) is a hard import of autocti but - # not a pip dependency in EITHER mode: its sdist is source-only (needs - # libgsl-dev + cython) and its own requirements downgrade numpy below 2.0, - # so it is installed no-build-isolation / no-deps first. Recipe mirrors - # autocti_workspace_test/.github/scripts/smoke_install.sh. + # not a pip dependency in EITHER mode. Its install recipe is owned + # centrally by PyAutoHeart rather than copied here — this step used to + # carry a copy, annotated "Recipe mirrors + # autocti_workspace_test/.github/scripts/smoke_install.sh", which is + # exactly the duplication the action removes. + - name: Install arcticpy (source-only C++ sdist) + uses: PyAutoLabs/PyAutoHeart/.github/actions/install-arcticpy@main + - name: Install the stack (source @ main, or a pinned release) run: | python -m pip install --upgrade pip setuptools wheel - sudo apt-get update && sudo apt-get install -y libgsl-dev - pip install numpy cython - pip install arcticpy==2.6 --no-build-isolation --no-deps VER="${{ inputs.stack_version }}" if [ -n "$VER" ]; then diff --git a/skills/README.md b/skills/README.md index 417c04b..d314073 100644 --- a/skills/README.md +++ b/skills/README.md @@ -41,7 +41,7 @@ grown in use. - [`ac_setup_environment.md`](./ac_setup_environment.md) — install and verify the PyAutoCTI stack, **including arcticpy** (the C++ arctic clocking code `import autocti` needs but pip won't install). The #1 setup failure; covers the - libgsl-dev + numpy/cython + arcticpy recipe and the numpy-downgrade trap. + libgsl-dev + build-deps + arcticpy recipe and the numpy-downgrade trap. ### The CTI calibration pipeline diff --git a/skills/ac_setup_environment.md b/skills/ac_setup_environment.md index 81212e1..b19d973 100644 --- a/skills/ac_setup_environment.md +++ b/skills/ac_setup_environment.md @@ -1,6 +1,6 @@ --- name: ac_setup_environment -description: Install and verify the PyAutoCTI stack, including arcticpy — the C++ arctic clocking code that `import autocti` requires but pip will not install for you. The #1 setup failure. Covers the libgsl-dev + numpy/cython + arcticpy recipe, the numpy-downgrade trap, a no-root header workaround, and the environment/version drift check. +description: Install and verify the PyAutoCTI stack, including arcticpy — the C++ arctic clocking code that `import autocti` requires but pip will not install for you. The #1 setup failure. Covers the libgsl-dev + build-deps + arcticpy recipe, the numpy-downgrade trap, a no-root header workaround, and the environment/version drift check. --- # Setting up the PyAutoCTI environment @@ -37,37 +37,63 @@ normally: autoarray/autofit stack that expects numpy ≥ 2. So arcticpy is installed *after* numpy is already in place, with dependency -resolution and build isolation both turned off. +resolution and build isolation both turned off. Turning those two off is what +makes the recipe fiddly, because each one has to be paid back by hand: + +- `--no-build-isolation` — pip builds in the current environment and does **not** + read arcticpy's `build-system.requires`, so every **build** dependency must + already be installed. arcticpy declares none of them, and `setuptools` is the + one people miss: without it the build dies at `BackendUnavailable: Cannot + import 'setuptools.build_meta'`. Python 3.12+ venvs no longer ship setuptools, + so this bites on any fresh modern venv. +- `--no-deps` — pip installs no **runtime** dependencies either. `arcticpy/__init__.py` + imports `read_noise`, which imports `scipy` and `matplotlib` at import time, so + without them a perfectly good build still fails at `import arcticpy` with + `ModuleNotFoundError`. ## The recipe -The order matters. numpy and cython must exist before arctic builds, and +The order matters: the build dependencies must exist before arctic builds, and arctic must be installed `--no-deps` so it cannot drag numpy back down. ```bash # 1. GSL headers + a C++ toolchain (system-wide; needs sudo). sudo apt-get update && sudo apt-get install -y libgsl-dev -# 2. numpy + cython first, so arctic has what it needs to build against. +# 2. build dependencies. setuptools and wheel are NOT optional here — +# --no-build-isolation will not supply them. +pip install --upgrade pip setuptools wheel pip install numpy cython -# 3. arctic itself — no build isolation (uses the numpy just installed), +# 3. runtime dependencies --no-deps will suppress but arcticpy imports anyway. +pip install scipy matplotlib + +# 4. arctic itself — no build isolation (uses the numpy just installed), # no deps (so it cannot pull an old numpy). pip install arcticpy==2.6 --no-build-isolation --no-deps -# 4. the PyAutoCTI stack. +# 5. the PyAutoCTI stack. pip install autocti ``` Then confirm: ```bash -python -c "import arcticpy, autocti; print('arctic', arcticpy.__version__, '| autocti', autocti.__version__)" +python -c "import arcticpy, autocti; from importlib.metadata import version; print('arctic', version('arcticpy'), '| autocti', autocti.__version__)" ``` -The CI-hardened form of exactly this recipe lives in -`autocti_workspace_test:.github/scripts/smoke_install.sh` — cite it when a user -wants the canonical, tested sequence. +**`arcticpy` has no `__version__` attribute.** `print(arcticpy.__version__)` +raises `AttributeError` on a completely healthy install — read the distribution +metadata instead, as above. If a user reports that error, they do not have a +broken arcticpy; they have the wrong verification command. + +The CI-hardened form of exactly this recipe is the canonical, tested sequence — +cite it when a user wants one: + + PyAutoHeart:.github/actions/install-arcticpy/action.yml + +Every CTI repo's CI consumes that action, so it is the recipe that is actually +exercised on every run. It also carries the single `arcticpy==2.6` pin. ## No root? Extract the GSL headers locally