Skip to content

fix: gate autofit[jax] to python>=3.11 in the jax extra - #532

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/autogalaxy-jax-marker
Jul 27, 2026
Merged

fix: gate autofit[jax] to python>=3.11 in the jax extra#532
Jammy2211 merged 1 commit into
mainfrom
feature/autogalaxy-jax-marker

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Follow-up to #530, raised by an independent Codex review of that commit.

The gap

#530 pointed autogalaxy[jax] at autofit[jax] so optax follows the jax chain. PyAutoFit#1426 then marked autofit's own optax entry python_version >= '3.11', after an unmarked optax sent pip to resolution-too-deep and took every 3.9 leg of python_matrix red.

But that fix lives on autofit's main. Any released autofit still expands autofit[jax] to an unmarked optax — confirmed straight from PyPI:

autofit 2026.7.27.1  ->  'optax>=0.2.5; extra == "jax"'      # no marker

So autogalaxy[jax] was only safe when autofit came from a source checkout. That is exactly why CI went green while the released chain stayed exposed: python_matrix installs all five libraries with -e ./PyAuto*, so it resolves autofit from source and can never exercise this path.

Live exposure is narrow — installing autogalaxy/autolens from git main with [jax] on Python 3.9/3.10 — because today's PyPI users get released autogalaxy, which does not chain to autofit[jax] yet, and the next release ships both libraries at the same version. But the window is real until then, and the fix is one line.

Change

-    "autofit[jax]",
+    "autofit[jax]; python_version >= '3.11'",

Now every member of the jax extra carries the same gate, so the extra is a clean no-op below 3.11 — exactly the pre-#530 behaviour — and correct on 3.11+ whichever autofit version pip resolves.

API Changes

None. Packaging metadata only, and strictly narrowing. autogalaxy[jax] on 3.11+ resolves exactly as #530 intended; on 3.9/3.10 it resolves exactly as it did before #530.

Verification

Built wheel metadata from this branch:

Requires-Dist: autofit[jax]; python_version >= "3.11" and extra == "jax"
Requires-Dist: jax_zero_contour<3.0.0,>=2.0.0; python_version >= "3.11" and extra == "jax"

Marker evaluation, both entries:

autofit           {'3.9': False, '3.10': False, '3.11': True, '3.12': True}
jax_zero_contour  {'3.9': False, '3.10': False, '3.11': True, '3.12': True}

Lesson

Marker parity within an extra is load-bearing, and a source-installed CI matrix cannot verify a released dependency chain. An extra that mixes gated and ungated entries is only as correct as the version of its sibling that happens to resolve.

Follow-up to #530, from an independent Codex review of that commit.

#530 pointed autogalaxy[jax] at autofit[jax] so optax follows the jax chain.
PyAutoFit#1426 then marked autofit's own optax entry python>=3.11 after an
unmarked optax took every 3.9 CI leg red with resolution-too-deep.

But that fix lives on autofit's main. Any *released* autofit still expands
autofit[jax] to an unmarked optax — confirmed against PyPI:

    autofit 2026.7.27.1 -> 'optax>=0.2.5; extra == "jax"'   (no marker)

So autogalaxy[jax] was only safe when autofit came from a source checkout,
which is precisely why CI went green while the released chain stayed exposed.
CI installs all five libraries with -e, so it could never have caught this.

Marking the entry here makes the chain correct whichever autofit version pip
resolves, and restores exact pre-#530 behaviour below 3.11: every member of
the extra now carries the same gate, so the extra is a clean no-op there.

Verified in the built wheel metadata — both jax-extra entries evaluate
False on 3.9/3.10 and True on 3.11/3.12.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Jammy2211
Jammy2211 merged commit 34e82e2 into main Jul 27, 2026
5 checks passed
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Jul 27, 2026
Jammy2211 pushed a commit that referenced this pull request Aug 9, 2026
…s here)

The negative-redshift finding is filed on PyAutoLens#532 because the reporter
reached it through `al.Galaxy` — but `al.Galaxy` IS `ag.Galaxy`, and both the
class and its redshift assignment live in this repo, so the guard belongs here
rather than in a Tracer-level check that would miss a bare Galaxy construction.

The `Tracer(galaxies=...)` half of #532 stays in PyAutoLens.

Zero and tiny redshifts stay accepted: 0.0 legitimately places a galaxy at the
observer, and 1e-12 is degenerate but not invalid.

Adds a deliberate guard-rail test pinning today's permissive z_lens > z_source
behaviour, so phase 4 of the audit cannot quietly turn it into an error while
the question is still open with the reporter.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013PgqSCLTemK5bApVAwhVM4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending-release PR queued for the next release build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant