Skip to content
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
24 changes: 13 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
steps:
- uses: actions/checkout@v6
with: { fetch-depth: 0, filter: "blob:none" }
- uses: astral-sh/setup-uv@v7
- uses: astral-sh/setup-uv@v8.2.0
- name: Get test environments
id: get-envs
run: |
Expand All @@ -39,6 +39,8 @@ jobs:
test:
name: Tests
needs: get-environments
permissions:
id-token: write # for codecov OIDC
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -52,7 +54,7 @@ jobs:
steps:
- uses: actions/checkout@v6
with: { fetch-depth: 0, filter: "blob:none" }
- uses: astral-sh/setup-uv@v7
- uses: astral-sh/setup-uv@v8.2.0
with:
python-version: ${{ matrix.env.python }}
- name: create environment
Expand All @@ -63,27 +65,29 @@ jobs:
# https://github.com/codecov/codecov-cli/issues/648
uvx hatch run ${{ matrix.env.name }}:coverage xml
rm test-data/.coverage
- uses: codecov/codecov-action@v5
- uses: codecov/codecov-action@v7
with:
name: ${{ matrix.env.name }}
fail_ci_if_error: true
files: test-data/coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
use_oidc: true
bench:
name: CPU Benchmarks
permissions:
id-token: write # for codspeed OIDC
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with: { fetch-depth: 0, filter: "blob:none" }
- uses: actions/setup-python@v6
with:
python-version: '3.14'
- uses: astral-sh/setup-uv@v7
- uses: astral-sh/setup-uv@v8.2.0
- run: uv pip install --system --group=test -e .[full]
- uses: CodSpeedHQ/action@v3
- uses: CodSpeedHQ/action@v4
with:
mode: simulation
run: pytest -m benchmark --codspeed -n auto
token: ${{ secrets.CODSPEED_TOKEN }}
import:
name: Import Tests
runs-on: ubuntu-latest
Expand All @@ -93,7 +97,7 @@ jobs:
- uses: actions/setup-python@v6
with:
python-version: '3.14'
- uses: astral-sh/setup-uv@v7
- uses: astral-sh/setup-uv@v8.2.0
- run: uv pip install --system -e .
- run: python -c 'import fast_array_utils as fau; print(fau.__all__)'
- run: uv pip install --system -e .[testing]
Expand All @@ -106,9 +110,7 @@ jobs:
steps:
- uses: actions/checkout@v6
with: { fetch-depth: 0, filter: "blob:none" }
- uses: j178/prek-action@v1
with:
working-directory: ${{ github.workspace }}
- uses: j178/prek-action@v2
pass:
name: All Checks
if: always()
Expand Down
5 changes: 3 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repos:
- id: trailing-whitespace
- id: no-commit-to-branch
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.15
rev: v0.15.16
hooks:
- id: ruff-check
args: [--fix, --exit-non-zero-on-fix]
Expand All @@ -29,7 +29,7 @@ repos:
pass_filenames: false
additional_dependencies:
- anndata>=0.12
- array-api-compat>=1.13
- array-api-compat>=1.13,!=1.15.0 # https://github.com/data-apis/array-api-compat/issues/436
- dask>=2026.1
- h5py>=3.15
- jax>=0.10
Expand All @@ -40,6 +40,7 @@ repos:
- scikit-learn>=1.8
- scipy-stubs>=1.17
- sphinx>=9
- types-array-api>=1.3
- types-docutils>=0.22
- zarr>=3.1
ci:
Expand Down
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
},
"python.testing.pytestArgs": ["-vv", "--color=yes", "-m", "not benchmark"],
"python.testing.pytestEnabled": true,
"python-envs.defaultEnvManager": "flying-sheep.hatch:hatch",
"python-envs.defaultPackageManager": "flying-sheep.hatch:hatch",
"python-envs.defaultEnvManager": "pypa.hatch:hatch",
"python-envs.defaultPackageManager": "pypa.hatch:hatch",
}
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ urls.Documentation = "https://icb-fast-array-utils.readthedocs-hosted.com/"
entry-points.pytest11.fast_array_utils = "testing.fast_array_utils.pytest"

[dependency-groups]
dev = [ "types-array-api", "types-docutils" ]
test = [
"anndata",
"fast-array-utils[full]",
"jax",
"jaxlib",
"scikit-learn",
{ include-group = "dev" },
{ include-group = "test-min" },
]
doc = [
Expand Down
3 changes: 2 additions & 1 deletion src/fast_array_utils/stats/_generic_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
if TYPE_CHECKING:
from typing import Any, Literal

from array_api.latest import Array as AArray
from numpy.typing import DTypeLike, NDArray

from ..typing import CpuArray, DiskArray, GpuArray
Expand Down Expand Up @@ -111,7 +112,7 @@ def _generic_op_dask(


@generic_op.register(types.HasArrayNamespace)
def _generic_op_array_api[A: types.HasArrayNamespace](
def _generic_op_array_api[A: AArray[object, object]](
x: A,
/,
op: Ops,
Expand Down
5 changes: 3 additions & 2 deletions src/fast_array_utils/stats/_power.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@


if TYPE_CHECKING:
from array_api.latest import Array as AArray
from numpy.typing import DTypeLike

from fast_array_utils.typing import CpuArray, GpuArray
Expand All @@ -36,11 +37,11 @@ def _power_numpy_cupy(x: np.ndarray, n: int, /, dtype: DTypeLike | None = None)


@_power.register(types.HasArrayNamespace)
def _power_array_api(x: types.HasArrayNamespace, n: int, /, dtype: DTypeLike | None = None) -> types.HasArrayNamespace:
def _power_array_api[A: AArray[object, object]](x: A, n: int, /, dtype: DTypeLike | None = None) -> A:
import array_api_compat

xp = array_api_compat.array_namespace(x)
return xp.pow(x, n) if dtype is None else xp.pow(xp.astype(x, dtype), n) # type: ignore[no-any-return]
return xp.pow(x, n) if dtype is None else xp.pow(xp.astype(x, dtype), n)


@_power.register(types.CSBase | types.CupyCSMatrix)
Expand Down
Loading