Skip to content

Declare directly-imported dependencies; cap numpy<2.5 - #1145

Open
AlexanderFengler wants to merge 1 commit into
mainfrom
drift/2026-08-05-numpy-cap
Open

Declare directly-imported dependencies; cap numpy<2.5#1145
AlexanderFengler wants to merge 1 commit into
mainfrom
drift/2026-08-05-numpy-cap

Conversation

@AlexanderFengler

@AlexanderFengler AlexanderFengler commented Aug 6, 2026

Copy link
Copy Markdown
Member

Closes #1144

  • Declares the seven packages src/hssm imports directly but never declared (arviz, jax, numpy, pandas, pymc, pytensor, xarray) — until now their versions arrived transitively via bambi/numpyro with no floor and no cap, which is exactly how the numpy 2.5 breakage landed unbounded.
  • Adds a temporary numpy>=2.0,<2.5 cap: numpy 2.5 removed np.row_stack, which the freshly-resolved Linux CI stack (pytensor 3.2.4 path) still calls, failing tests/addm/test_addm_builder.py on every fresh resolve of unchanged main (drift: numpy 2.5 broke the fast suite on fresh resolves (row_stack removed) #1144). The cap comment in pyproject.toml links the issue; once this merges, the spine's package radar tracks the cap as a standing ceiling-crossed event, so lifting it when upstream is fixed cannot be forgotten.
  • Floors chosen at the majors the codebase already assumes (pymc≥6 / arviz≥1 from the 0.4.0 migration, jax≥0.7.0 matching the cuda extras, numpy≥2.0 matching ssm-simulators); all sit well below today's resolutions.

Commands run: uv lock resolves cleanly (288 packages; numpy → 2.4.6, pymc 6.2.0 / pytensor 3.2.4 unchanged from the last green run — lockfile not committed, HSSM resolves fresh by design).

First mechanical healing PR of the drift-homeostasis rollout (see #1143); rebasing/rerunning #1143 after this merges should turn its run_tests legs green.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated runtime dependency requirements to specify supported minimum versions.
    • Added a compatibility constraint for NumPy versions.
    • Documented dependency sources and compatibility guidance.

Closes #1144

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Runtime dependency constraints

Layer / File(s) Summary
Dependency declarations
pyproject.toml
Adds minimum versions for ArviZ, JAX, pandas, PyMC, PyTensor, and xarray. Constrains NumPy to >=2.0,<2.5. Documents dependency provenance and compatibility considerations.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: cpaniaguam, digicosmos86, krishnbera

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the direct dependency declarations and NumPy version cap.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch drift/2026-08-05-numpy-cap

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pyproject.toml`:
- Around line 38-39: Validate the dependency pairing represented by the jax and
jaxonnxruntime entries in pyproject.toml: test the onnx2jax.py import path with
the resolved versions, or constrain jax to a range verified compatible with
jaxonnxruntime>=0.3.0. Preserve the jaxonnxruntime dependency because it remains
actively imported.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6b629d87-7daf-4f2c-9866-a382364416ee

📥 Commits

Reviewing files that changed from the base of the PR and between 8114267 and d414947.

📒 Files selected for processing (1)
  • pyproject.toml

Comment thread pyproject.toml
Comment on lines +38 to 39
"jax>=0.7.0",
"jaxonnxruntime>=0.3.0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

for path in pyproject.toml src/hssm tests; do
  if [ -e "$path" ]; then
    rg -n -C 4 'jaxonnxruntime|import jax|from jax' "$path" || true
  fi
done

python - <<'PY'
import json
from urllib.request import urlopen

for package, version in (("jaxonnxruntime", "0.3.0"), ("jax", "0.7.0")):
    with urlopen(f"https://pypi.org/pypi/{package}/{version}/json") as response:
        info = json.load(response)["info"]
    print(package, version)
    print(*info.get("requires_dist", []), sep="\n  ")
PY

Repository: lnccbrown/HSSM

Length of output: 33346


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "pyproject deps:"
sed -n '1,70p' pyproject.toml

echo
echo "onnx2jax imports and jaxonnxruntime usage:"
sed -n '35,50p' src/hssm/distribution_utils/onnx_utils/onnx2jax.py
rg -n 'def make_jax_func|call_onnx|jaxonnxruntime|onnx2jax' src tests pyproject.toml || true

echo
echo "lock/env files:"
git ls-files | rg '(^|/)(uv|poetry|pip).*lock|requirements.*\.txt|conda-lock|environment\.yml|pyproject\.toml$'

Repository: lnccbrown/HSSM

Length of output: 4593


Verify the JAX and jaxonnxruntime compatibility contract.

jaxonnxruntime is still imported by src/hssm/distribution_utils/onnx_utils/onnx2jax.py, so the dependency is not stale. Its 0.3.0 release predates the jax>=0.7.0 requirement and does not declare a tested compatible jax range, so this import path needs to be tested with the resolved versions or constrained to a tested JAX range.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pyproject.toml` around lines 38 - 39, Validate the dependency pairing
represented by the jax and jaxonnxruntime entries in pyproject.toml: test the
onnx2jax.py import path with the resolved versions, or constrain jax to a range
verified compatible with jaxonnxruntime>=0.3.0. Preserve the jaxonnxruntime
dependency because it remains actively imported.

@digicosmos86

Copy link
Copy Markdown
Collaborator

This is mostly a duplicate of #1137. Also declaring versions of transitive dependencies transfers the burden to us for managing the versions of these dependencies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

drift: numpy 2.5 broke the fast suite on fresh resolves (row_stack removed)

2 participants