Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 9 additions & 53 deletions .github/workflows/build-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.10"
python-version: "3.13"
cache: "pip"
cache-dependency-path: pyproject.toml

Expand All @@ -39,7 +39,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.10"
python-version: "3.13"
cache: "pip"
cache-dependency-path: pyproject.toml

Expand All @@ -56,55 +56,12 @@ jobs:
run: |
darglint src --strictness=short --ignore-raise=ValueError

tests-jax-latest:
tests:
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Checkout repository
uses: actions/checkout@v5
strategy:
matrix:
python-version: ["3.10", "3.13"]

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: pyproject.toml

- name: Setup environment
run: |
python -m pip install --upgrade pip
pip install ".[tests,dev]"

- name: Run Python tests
run: |
pytest --cov=agjax tests

tests-jax-0_4_35:
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: pyproject.toml

- name: Setup environment
run: |
python -m pip install --upgrade pip
pip install --upgrade "jax[cpu]==0.4.35"
pip install ".[tests,dev]"

- name: Run Python tests
run: |
pytest --cov=agjax tests

tests-jax-0_4_27:
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Checkout repository
Expand All @@ -113,21 +70,20 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.10"
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: pyproject.toml

- name: Setup environment
run: |
python -m pip install --upgrade pip
pip install --upgrade "jax[cpu]==0.4.27"
pip install ".[tests,dev]"

- name: Run Python tests
run: |
pytest --cov=agjax tests

test_docs:
test-docs:
runs-on: ubuntu-latest
timeout-minutes: 3
needs: [pre-commit]
Expand All @@ -138,7 +94,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.10'
python-version: '3.13'
cache: "pip"
cache-dependency-path: pyproject.toml

Expand Down
17 changes: 8 additions & 9 deletions tests/experimental/test_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,12 @@
import autograd.numpy as npa
import jax
import jax.numpy as jnp
import jaxlib
import numpy as onp
from parameterized import parameterized

from agjax import utils
from agjax.experimental import wrapper

if hasattr(jaxlib, "xla_extension"):
JaxError = jaxlib.xla_extension.XlaRuntimeError
else:
JaxError = jaxlib._jax.XlaRuntimeError

TEST_FNS_AND_ARGS = (
( # Basic scalar-valued function, real outputs.
Expand Down Expand Up @@ -79,7 +74,7 @@ def fn(x, y):
)
with self.assertRaisesRegex(ValueError, "Found out of bounds"):
wrapped(1.0, 2.0)
with self.assertRaisesRegex(JaxError, "Found out of bounds"):
with self.assertRaisesRegex(jax.errors.JaxRuntimeError, "Found out of bounds"):
jax.grad(wrapped)(1.0, 2.0)

@parameterized.expand(([2], [-3]))
Expand All @@ -94,7 +89,7 @@ def fn(x, y):
)
with self.assertRaisesRegex(ValueError, "Found out of bounds"):
wrapped(1.0, 2.0)
with self.assertRaisesRegex(JaxError, "Found out of bounds"):
with self.assertRaisesRegex(jax.errors.JaxRuntimeError, "Found out of bounds"):
jax.grad(wrapped)(1.0, 2.0)

@parameterized.expand(([(1, 1)], [(1, -1)]))
Expand All @@ -121,9 +116,13 @@ def fn(x, y):
)
with self.assertRaisesRegex(ValueError, "At least one differentiable output"):
wrapped(1.0, 2.0)
with self.assertRaisesRegex(JaxError, "At least one differentiable output"):
with self.assertRaisesRegex(
jax.errors.JaxRuntimeError, "At least one differentiable output"
):
jax.grad(wrapped)(1.0, 2.0)
with self.assertRaisesRegex(JaxError, "At least one differentiable output"):
with self.assertRaisesRegex(
jax.errors.JaxRuntimeError, "At least one differentiable output"
):
jax.value_and_grad(wrapped)(1.0, 2.0)

@parameterized.expand(TEST_FNS_AND_ARGS)
Expand Down