feat: autofit[nss] install extra (Phase 4 of nss_first_class_sampler)#1277
Merged
Conversation
Adds a `[project.optional-dependencies] nss` extra so `pip install autofit[nss]` becomes the single safe install command for af.NSS, replacing the multi-step install saga documented in FINDINGS_v3.md. The extra pins three deps in dependency order: - `fastprogress<1.1` — fastprogress 1.1.5 transitively pulls python-fasthtml + starlette + uvicorn + httpx + websockets (none needed at runtime). - `blackjax @ git+https://github.com/handley-lab/blackjax.git@ef45acd2f` — the nss-required fork pinned to the May 2026 "Merge PR #60 — double_compile" commit. Locally validated through the entire Phase 1-3 nss_first_class_sampler work. HEAD as of pin time (5dbf89a9) adds `numpy>=1.25` which conflicts with autofit's `anesthetic==2.8.14` (numpy<2.0); bump both pins together. - `nss @ git+https://github.com/yallup/nss.git@69159b0f` — current HEAD; byte-identical to the locally-validated install. Approach picked from the Phase 4 prompt's option matrix: Option C (pip extra with pinned URL deps). The original prompt recommended Option A (full vendoring, ~1300 LOC). Investigation revealed modern pip 23+ handles URL-direct deps cleanly, so the lighter Option C path works without ongoing re-vendor maintenance burden. Updates the af.NSS ImportError message to reference the new install command. Adds a CI workflow that runs a fresh-venv install + import smoke on every PR + a weekly cron — catches both local pyproject.toml regressions and upstream drift past the pinned SHAs. Closes #1276 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Jammy2211
pushed a commit
that referenced
this pull request
May 17, 2026
…inline) The Tests workflow has been red on `main` since 2026-05-16 09:48 UTC, the moment PR #1277 merged the `autofit[nss]` install extra. The 12 tests under `test_autofit/non_linear/search/nest/nss/` hit the script's own ImportError guard on `af.NSS()` because the CI install step only installs `[optional]`. A naïve fix (combine `[optional,nss]` into one pip install) hit a real dependency conflict — both extras pin `blackjax` but to different versions: - [optional] pins `blackjax>=1.2.0` (mainline, PyPI) - [nss] pins handley-lab fork @ ef45acd2 (~0.1.0b1.dev85+) The fork carries the `blackjax.ns.adaptive.init` entrypoint that mainline 1.2.x lacks, so it's not a "use the older one" merge — they're genuinely incompatible. pip rightly refuses `[optional,nss]` with `ResolutionImpossible`. Resolution: split into parallel jobs. - `unittest`: installs `[optional]` and runs the full test suite EXCLUDING `test_autofit/non_linear/search/nest/nss/`. This keeps `test_blackjax_nuts.py` (which requires mainline blackjax 1.2+) green. - `unittest_nss` (new): installs `[nss]` alone in a fresh env and runs ONLY the NSS test suite. Matrix is python 3.12 / 3.13 to match the main `unittest` job. Both jobs need to pass for the `Tests` workflow to be green. The existing `nss_install_smoke.yml` workflow stays as the weekly-cron upstream-drift canary on the [nss] git pins; this new job is the PR/push-time test gate. Fixes the failing Tests check observed on runs 25958838630 (#1277 merge), 25959492149 (#1278 merge), 25998822676 (#1280 revert merge), and 25999018708 (the first attempt at this fix that revealed the extras conflict). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 4 of the
nss_first_class_samplerroadmap —pip install autofit[nss]is now the single command that installsaf.NSSand all its dependencies. Replaces the multi-step install saga documented inz_projects/profiling/FINDINGS_v3.md. Closes #1276.Approach (Option C from the prompt's matrix)
The original Phase 4 prompt recommended Option A — full vendoring of ~1300 LOC of
nss+blackjax/nsinto PyAutoFit. Investigation revealed modern pip 23+ handles URL-direct deps cleanly, so the lighter Option C path (pip extra with pinned git+ URLs) works without ongoing re-vendor maintenance burden. Verified empirically on a fresh venv.The pin choice matters
Initial try with HEAD of
handley-lab/blackjax(5dbf89a9) failed: HEAD addsnumpy>=1.25which conflicts with PyAutoFit'sanesthetic==2.8.14(numpy<2.0). Pinned toef45acd2finstead — the May 2026 "Merge PR #60 — double_compile" commit, which is what was installed locally and validated through the entire Phase 1-3 work. The same anesthetic cap will release when Python 3.13 anesthetic>=2.9 takes over; revisit the blackjax pin in that bump.What's in the extra
The
fastprogress<1.1pin avoids fastprogress 1.1.5's transitive pull ofpython-fasthtml+starlette+uvicornetc. The two URL deps win the resolver fight against mainline blackjax via pip's direct-URL precedence.CI
New workflow at
.github/workflows/nss_install_smoke.yml:pull_request(catches local pyproject.toml regressions before merge).0 3 * * 0cron (Sundays 03:00 UTC — catches upstream drift past the pinned SHAs).pip install -e PyAutoFit[nss], then a Python smoke that importsautofit,nss.ns,blackjax.ns.adaptive(asserting the fork'sinitattribute exists), and instantiatesaf.NSS().Test plan
pytest test_autofit— 1258 passed, 1 skipped (1252 baseline + 6 NSS unit tests from Phase 2-3; no regression).python -m venv /tmp/nss_install_smoke && pip install -e PyAutoFit[nss]on Python 3.12 — completes in ~3 minutes, installsblackjax 0.1.0b1.dev85+gef45acd2f,nss 0.1.0,jax 0.7.1,numpy 1.26.4, and the rest of the transitive tree without dependency conflicts.import autofit as af; af.NSS(n_live=10, ...)succeeds end-to-end.blackjax.ns.adaptive.initexists (canonical check for the handley-lab fork).pytest.raises(ImportError, match=...)regex.API Changes
Pure additive at the install layer (
autofit[nss]extra). The af.NSSImportErrormessage changes to reference the new install command. No code-API changes.See full details below.
Full API Changes (for automation & release notes)
Added
autofit[nss]install extra inPyAutoFit/pyproject.toml. Pullsfastprogress<1.1+handley-lab/blackjaxfork at SHAef45acd2f+yallup/nssat SHA69159b0f.Changed Behaviour
autofit.NSS.__init__ImportErrormessage now referencespip install autofit[nss]instead of the manualpip install git+https://...recipe. Pre-feat: autofit[nss] install extra (Phase 4 of nss_first_class_sampler) #1276 message regex (af.NSS requires the optional \nss` package`) still matches.Migration
Users who previously followed the manual install recipe from FINDINGS_v3.md can switch to
pip install autofit[nss]. No action required for existing installs — both paths produce a workingaf.NSS.🤖 Generated with Claude Code