diff --git a/.github/actions/install-arcticpy/action.yml b/.github/actions/install-arcticpy/action.yml index 218707fa..5bc5b015 100644 --- a/.github/actions/install-arcticpy/action.yml +++ b/.github/actions/install-arcticpy/action.yml @@ -5,7 +5,9 @@ description: >- CI consumes this action rather than carrying its own copy. # The recipe, the reasoning behind its two awkward pip flags, and the single -# `arcticpy==2.6` pin all live in `install_arcticpy.sh` beside this file. This +# arcticpy pin (currently a pinned jkeger/arctic GitHub commit building 2.7 — a +# stopgap until 2.7 is on PyPI, PyAutoHeart#372) all live in +# `install_arcticpy.sh` beside this file. This # action is a thin CI wrapper over it — read that script, not this, to # understand or change what gets installed. # @@ -20,7 +22,9 @@ inputs: description: >- Override the arcticpy version to build. Leave EMPTY (the default) to use the organism's pin, which lives in exactly one place — the - ARCTICPY_VERSION default at the top of install_arcticpy.sh. Bump it there. + ARCTICPY_VERSION / ARCTICPY_SOURCE defaults at the top of + install_arcticpy.sh (currently a pinned GitHub commit of 2.7). A value + (e.g. 2.6) builds that version from PyPI instead. Bump the pin there. A default here would be a second copy of the pin, which is the thing #170 removed. required: false @@ -50,7 +54,7 @@ runs: # these steps. That is deliberate: `heart/smoke.py` prepares the same # arcticpy for the LOCAL smoke runner, and a composite action cannot be # invoked from Python. A shell script is the one shape both consumers can - # execute, so the recipe and the `2.6` pin stay in exactly one place — + # execute, so the recipe and the arcticpy pin stay in exactly one place — # which is the whole point of #170 (it replaced four divergent copies). # # `github.action_path` is the directory this action was downloaded into, so diff --git a/.github/actions/install-arcticpy/install_arcticpy.sh b/.github/actions/install-arcticpy/install_arcticpy.sh index f3c3b196..5fba54a6 100755 --- a/.github/actions/install-arcticpy/install_arcticpy.sh +++ b/.github/actions/install-arcticpy/install_arcticpy.sh @@ -2,7 +2,18 @@ # # install_arcticpy.sh — THE canonical arcticpy install for the whole organism. # -# This file is the single home of the recipe and of the `arcticpy==2.6` pin. +# This file is the single home of the recipe and of the organism's arcticpy pin. +# +# STOPGAP (2026-11-26, PyAutoHeart#372): the pin is currently a GitHub COMMIT, +# not a PyPI release. arcticpy 2.7 (numpy 2 / Cython 3 support, upstream PRs +# #73 + #75) is merged into jkeger/arctic main but cannot be published to PyPI +# for now, so the default builds it from source at a pinned commit +# (ARCTICPY_SOURCE below). That needs `git` on PATH — present on GitHub-hosted +# runners and on Colab; a local `pyauto-heart smoke` run now needs git and +# github.com access instead of PyPI. To REVERT once 2.7 is on PyPI: set the ARCTICPY_VERSION +# default back to a PyPI version (`2.7`), and the git source stops being used. +# See the Mind draft +# draft/maintenance/pyautoheart/arcticpy_pin_bump_after_upstream_release.md. # Two consumers execute these exact bytes: # # * CI — `.github/actions/install-arcticpy/action.yml` (the composite action @@ -22,8 +33,9 @@ # # * its PyPI distribution is a source-only C++ sdist — it needs libgsl-dev # headers and a toolchain to build, and there is no wheel; -# * its own requirements downgrade numpy below 2.0, which breaks a modern -# PyAuto stack. +# * its own requirements (up to 2.6) downgrade numpy below 2.0, which breaks +# a modern PyAuto stack. 2.7's metadata now allows numpy<3, but this +# stopgap keeps --no-deps anyway so the recipe stays the proven one. # # So it is built with --no-build-isolation (reusing the numpy already present # instead of resolving its own) and --no-deps (so it cannot drag numpy back @@ -51,8 +63,14 @@ # # ENVIRONMENT CONTRACT (all optional; defaults match the previous action) # -# ARCTICPY_VERSION arcticpy version to build. Default 2.6. -# THE single pin for the organism — bump it HERE. +# ARCTICPY_VERSION PyPI arcticpy version to build. Default EMPTY, +# which means "build ARCTICPY_SOURCE instead". A value +# (e.g. 2.6, or 2.7 once published) installs +# `arcticpy==` from PyPI. +# ARCTICPY_SOURCE pip URL used when ARCTICPY_VERSION is empty. Default +# git+https://github.com/jkeger/arctic@ +# (2.7). Together with ARCTICPY_VERSION, THE single pin +# for the organism — bump it HERE. # ARCTICPY_INSTALL_GSL "true"/"false". Install libgsl-dev via apt. # Default true. `false` means "GSL is already present", # and the script PROVES that rather than assuming it. @@ -75,7 +93,13 @@ set -euo pipefail -ARCTICPY_VERSION="${ARCTICPY_VERSION:-2.6}" +ARCTICPY_VERSION="${ARCTICPY_VERSION:-}" +ARCTICPY_SOURCE="${ARCTICPY_SOURCE:-git+https://github.com/jkeger/arctic@6f5153582aca00b7b0cc11ab04b2c58a7502400d}" +if [ -n "$ARCTICPY_VERSION" ]; then + ARCTICPY_SPEC="arcticpy==${ARCTICPY_VERSION}" +else + ARCTICPY_SPEC="arcticpy @ ${ARCTICPY_SOURCE}" +fi ARCTICPY_INSTALL_GSL="${ARCTICPY_INSTALL_GSL:-true}" ARCTICPY_SUDO="${ARCTICPY_SUDO:-true}" PYTHON="${PYTHON:-python}" @@ -119,9 +143,11 @@ fi echo "==> Installing arcticpy build dependencies" # --no-build-isolation reads NOTHING from arcticpy's build-system requires, so -# these must be present before the build starts. +# these must be present before the build starts. 2.7 builds against numpy>=2, +# Cython>=3 and setuptools>=64; the floors make an older Cython already in the +# environment get upgraded rather than silently reused. "$PYTHON" -m pip install --upgrade pip setuptools wheel -"$PYTHON" -m pip install numpy cython +"$PYTHON" -m pip install "numpy>=2" "cython>=3" echo "==> Installing arcticpy runtime dependencies" # --no-deps suppresses these, but arcticpy/read_noise.py imports both at import @@ -135,7 +161,7 @@ echo "==> Installing arcticpy runtime dependencies" # only inside an already-built stack. "$PYTHON" -m pip install scipy matplotlib -echo "==> Building and installing arcticpy ${ARCTICPY_VERSION}" +echo "==> Building and installing ${ARCTICPY_SPEC}" # --no-cache-dir: the wheel built here links the MACHINE's libgsl by soname, so # a copy cached in ~/.cache/pip is only valid on the image that built it. CI # caches that directory across runs (smoke-tests.yml) with no image identity in @@ -144,7 +170,7 @@ echo "==> Building and installing arcticpy ${ARCTICPY_VERSION}" # "libgsl.so.27: cannot open shared object file" (PyAutoHeart#330). Always # building fresh costs ~15 s and makes a system-library change impossible to # mask. Only this install opts out: the others are image-independent wheels. -"$PYTHON" -m pip install "arcticpy==${ARCTICPY_VERSION}" \ +"$PYTHON" -m pip install "$ARCTICPY_SPEC" \ --no-build-isolation --no-deps --no-cache-dir echo "==> Verifying arcticpy imports" diff --git a/.github/workflows/arcticpy-action.yml b/.github/workflows/arcticpy-action.yml index f7c78edf..6bae755f 100644 --- a/.github/workflows/arcticpy-action.yml +++ b/.github/workflows/arcticpy-action.yml @@ -21,7 +21,7 @@ on: workflow_dispatch: inputs: version: - description: "arcticpy version to test (default: the action's own pin)" + description: "PyPI arcticpy version to test (default: the action's own pin, currently a pinned GitHub commit of 2.7)" required: false type: string @@ -51,10 +51,12 @@ jobs: uses: ./.github/actions/install-arcticpy with: # Pass the dispatch input straight through. It used to fall back to a - # literal '2.6', which was a second copy of the pin: bumping the pin + # literal version, which was a second copy of the pin: bumping the pin # would not have changed what this self-test built, so the test would # have gone on proving the OLD version worked. Empty means "use the - # action's own default", i.e. the one pin in install_arcticpy.sh. + # action's own default", i.e. the one pin in install_arcticpy.sh + # (currently the pinned jkeger/arctic commit building 2.7; a value + # here builds that version from PyPI instead). version: ${{ inputs.version }} - name: Report the version the action installed diff --git a/heart/smoke.py b/heart/smoke.py index 6c4e8381..1399d3cd 100644 --- a/heart/smoke.py +++ b/heart/smoke.py @@ -376,7 +376,7 @@ def _install_environment( #: `pip check` lines that a CTI environment ALWAYS produces, and must. #: -#: arcticpy declares ``numpy~=1.21`` but is installed with ``--no-deps`` on +#: arcticpy <= 2.6 declares ``numpy~=1.21`` but is installed with ``--no-deps`` on #: purpose: honouring that requirement downgrades numpy below 2.0 and breaks the #: rest of the PyAuto stack. The dependency metadata therefore stays permanently #: unsatisfied, and ``pip check`` reports it every single time: @@ -387,6 +387,9 @@ def _install_environment( #: after building it, which would make `arcticpy: true` useless. The exception is #: deliberately narrow -- one package, one requirement -- so a real conflict, in #: arcticpy or anything else, still fails the preflight. +#: +#: arcticpy 2.7 (the current pin) allows numpy<3 and no longer triggers this; +#: the exception stays for the ARCTICPY_VERSION=2.6 PyPI override. _ARCTICPY_EXPECTED_CONFLICT = re.compile( r"^arcticpy \S+ has requirement numpy\S+, but you have numpy \S+\.?$" ) diff --git a/tests/test_smoke.py b/tests/test_smoke.py index 1e12d46c..748f5bc3 100644 --- a/tests/test_smoke.py +++ b/tests/test_smoke.py @@ -2,6 +2,7 @@ import json import os +import re import subprocess from pathlib import Path @@ -571,6 +572,12 @@ def test_shipped_arcticpy_installer_exists_and_is_the_only_pin(): assert smoke.ARCTICPY_INSTALLER.is_file() body = smoke.ARCTICPY_INSTALLER.read_text() assert 'ARCTICPY_VERSION="${ARCTICPY_VERSION:-' in body + assert 'ARCTICPY_SOURCE="${ARCTICPY_SOURCE:-' in body + # The git source must be pinned to a full commit, never a moving branch. + assert re.search( + r'ARCTICPY_SOURCE="\$\{ARCTICPY_SOURCE:-git\+https://github\.com/jkeger/arctic@[0-9a-f]{40}\}"', + body, + ), "ARCTICPY_SOURCE must pin a full 40-hex commit" def test_arcticpy_build_never_reuses_a_pip_cached_wheel(): @@ -587,7 +594,7 @@ def test_arcticpy_build_never_reuses_a_pip_cached_wheel(): installs = [ line for line in logical.splitlines() - if "pip install" in line and '"arcticpy==' in line + if "pip install" in line and '"$ARCTICPY_SPEC"' in line ] assert len(installs) == 1, installs assert "--no-cache-dir" in installs[0].split()