From 3b485d7643459c96ba938a04db91f6c9a238dd8a Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Thu, 30 Apr 2026 20:00:49 +0100 Subject: [PATCH 1/3] feat(python-version): support Python 3.9-3.14, first-class 3.12/3.13 Wide-support / narrow-first-class model for Python versions across the PyAuto family. Python 3.12 and 3.13 remain the recommended versions. 3.9, 3.10, 3.11, 3.14 install cleanly but emit a loud bypassable warning at import time. JAX moved to optional [jax] extra gated on python_version >= '3.11' (so 3.9/3.10 users get numpy-only mode without install failures). Coordinated change across PyAutoConf, PyAutoArray, PyAutoFit, PyAutoGalaxy, PyAutoLens, PyAutoBuild, and the 6 workspace repos. See sibling PRs on the feature/python-version-policy branch in each repo. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/main.yml | 2 +- autogalaxy/plot/plot_utils.py | 14 ++++++++++++++ autogalaxy/util/plot_utils.py | 14 ++++++++++++++ pyproject.toml | 18 +++++++++++++----- 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index eaa49f3b..55800f27 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.12', '3.13'] + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14'] steps: - name: Checkout PyAutoConf uses: actions/checkout@v2 diff --git a/autogalaxy/plot/plot_utils.py b/autogalaxy/plot/plot_utils.py index 55cfae95..8c5cc57b 100644 --- a/autogalaxy/plot/plot_utils.py +++ b/autogalaxy/plot/plot_utils.py @@ -333,6 +333,8 @@ def _critical_curves_method(): Returns ``"marching_squares"`` (the default) or ``"zero_contour"``. Any unrecognised value falls back to ``"marching_squares"`` with a warning. + If ``"zero_contour"`` is requested but ``jax_zero_contour`` is not installed + (e.g. Python <3.11), falls back to ``"marching_squares"`` with a warning. """ from autoconf import conf @@ -347,6 +349,18 @@ def _critical_curves_method(): f"'{method}'. Falling back to 'marching_squares'." ) return "marching_squares" + + if method == "zero_contour": + try: + import jax_zero_contour # noqa: F401 + except ImportError: + logger.warning( + "critical_curves_method='zero_contour' requested, but " + "jax_zero_contour is not installed (Python <3.11 ships without " + "the [jax] extra). Falling back to 'marching_squares'." + ) + return "marching_squares" + return method diff --git a/autogalaxy/util/plot_utils.py b/autogalaxy/util/plot_utils.py index 55cfae95..8c5cc57b 100644 --- a/autogalaxy/util/plot_utils.py +++ b/autogalaxy/util/plot_utils.py @@ -333,6 +333,8 @@ def _critical_curves_method(): Returns ``"marching_squares"`` (the default) or ``"zero_contour"``. Any unrecognised value falls back to ``"marching_squares"`` with a warning. + If ``"zero_contour"`` is requested but ``jax_zero_contour`` is not installed + (e.g. Python <3.11), falls back to ``"marching_squares"`` with a warning. """ from autoconf import conf @@ -347,6 +349,18 @@ def _critical_curves_method(): f"'{method}'. Falling back to 'marching_squares'." ) return "marching_squares" + + if method == "zero_contour": + try: + import jax_zero_contour # noqa: F401 + except ImportError: + logger.warning( + "critical_curves_method='zero_contour' requested, but " + "jax_zero_contour is not installed (Python <3.11 ships without " + "the [jax] extra). Falling back to 'marching_squares'." + ) + return "marching_squares" + return method diff --git a/pyproject.toml b/pyproject.toml index b7f6c22e..e6866266 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ dynamic = ["version"] description="Open-Source Multi Wavelength Galaxy Structure & Morphology" readme = { file = "README.rst", content-type = "text/x-rst" } license = { text = "MIT" } -requires-python = ">=3.12" +requires-python = ">=3.9" authors = [ { name = "James Nightingale", email = "James.Nightingale@newcastle.ac.uk" }, { name = "Richard Hayes", email = "richard@rghsoftware.co.uk" }, @@ -18,8 +18,12 @@ classifiers = [ "Topic :: Scientific/Engineering :: Physics", "Natural Language :: English", "Operating System :: OS Independent", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13" + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14" ] keywords = ["cli"] dependencies = [ @@ -27,8 +31,7 @@ dependencies = [ "autoarray", "colossus==1.3.1", "astropy>=5.0,<=7.2.0", - "nautilus-sampler==1.0.5", - "jax_zero_contour" + "nautilus-sampler==1.0.5" ] [project.urls] @@ -46,7 +49,12 @@ local_scheme = "no-local-version" [project.optional-dependencies] -optional=[ +jax = [ + "autoconf[jax]", + "jax_zero_contour; python_version >= '3.11'" +] +optional = [ + "autogalaxy[jax]", "numba", "pynufft", "ultranest==3.6.2", From 9b4b19cf78aec196237a16aedd456042884cee0c Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Thu, 30 Apr 2026 20:14:58 +0100 Subject: [PATCH 2/3] ci: narrow per-PR matrix to 3.12/3.13; install [optional] uniformly Per-PR CI now tests only the first-class Python versions (3.12, 3.13). Wide-span 3.9-3.14 verification moves to PyAutoBuild's python_matrix.yml workflow (weekly + on-demand). Install commands now always use the [optional] extra so JAX is available on both 3.12 and 3.13 (the conftest.py eager `import jax` was failing on 3.13 because the previous CI only added [optional] for 3.12). Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/main.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 55800f27..97227f3f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14'] + python-version: ['3.12', '3.13'] steps: - name: Checkout PyAutoConf uses: actions/checkout@v2 @@ -70,13 +70,7 @@ jobs: pip3 install setuptools pip3 install wheel pip3 install pytest coverage pytest-cov - if [ "${{ matrix.python-version }}" = "3.12" ]; then - pip install ./PyAutoConf ./PyAutoFit ./PyAutoArray ./PyAutoGalaxy - pip install "./PyAutoArray[optional]" "./PyAutoGalaxy[optional]" - else - pip install ./PyAutoConf ./PyAutoFit ./PyAutoArray ./PyAutoGalaxy - pip install numba - fi + pip install ./PyAutoConf ./PyAutoFit "./PyAutoArray[optional]" "./PyAutoGalaxy[optional]" - name: Run tests run: | export ROOT_DIR=`pwd` From 5cac996049aeda633149c81fda01c7d5f1dc4379 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Thu, 30 Apr 2026 20:18:33 +0100 Subject: [PATCH 3/3] deps: drop ultranest from optional extra (removed as dep, was breaking 3.13 install) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ultranest==3.6.2 was already removed as an actual library dep some time ago — no autogalaxy/autolens code imports it. The dangling pin in the [optional] extra was breaking 3.13 install because ultranest 3.6.2's Cython source uses np.int_t (removed in newer numpy), so wheel build fails. Cut from PyAutoGalaxy and PyAutoLens optional extras. Co-Authored-By: Claude Opus 4.7 (1M context) --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e6866266..2c5178cf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,7 +57,6 @@ optional = [ "autogalaxy[jax]", "numba", "pynufft", - "ultranest==3.6.2", "zeus-mcmc==2.5.4", "getdist==1.4" ]