Skip to content

Switch to (testing.)fast-array-utils #1921

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Draft
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
16 changes: 8 additions & 8 deletions .github/workflows/test-cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
pull_request:

env:
PYTEST_ADDOPTS: "-v --color=yes"
PYTEST_ADDOPTS: "-v --color=yes -n auto --instafail"
FORCE_COLOR: "1"

defaults:
Expand All @@ -19,7 +19,7 @@ defaults:
# https://stackoverflow.com/questions/66335225/how-to-cancel-previous-runs-in-the-pr-when-you-push-new-commitsupdate-the-curre
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
cancel-in-progress: false # TODO: set to `true` again

jobs:
pytest:
Expand All @@ -34,9 +34,9 @@ jobs:
- python-version: '3.13'
dependencies-version: pre-release
test-type: strict-warning
- python-version: '3.11'
dependencies-version: minimum
test-type: coverage
#- python-version: '3.11'
# dependencies-version: minimum
# test-type: coverage
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -74,15 +74,15 @@ jobs:

- name: Run Pytest
if: matrix.test-type == 'standard'
run: pytest -n auto
run: pytest

- name: Run Pytest (coverage)
if: matrix.test-type == 'coverage'
run: coverage run -m pytest -n auto --cov --cov-report=xml
run: coverage run -m pytest --cov --cov-report=xml

- name: Run Pytest (treat warnings as errors)
if: matrix.test-type == 'strict-warning'
run: pytest --strict-warnings -n auto
run: pytest --strict-warnings

- uses: codecov/codecov-action@v4
if: matrix.test-type == 'coverage'
Expand Down
1 change: 1 addition & 0 deletions ci/constraints.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
numba>=0.56
fast-array-utils @ git+https://github.com/scverse/fast-array-utils.git
2 changes: 1 addition & 1 deletion hatch.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ scripts.clean = "git restore --source=HEAD --staged --worktree -- docs/release-n
[envs.hatch-test]
default-args = [ ]
features = [ "dev", "test" ]
extra-dependencies = [ "ipykernel" ]
extra-dependencies = [ "ipykernel", "fast-array-utils @ git+https://github.com/scverse/fast-array-utils.git" ]
env-vars.UV_CONSTRAINT = "ci/constraints.txt"
overrides.matrix.deps.env-vars = [
{ if = [ "pre" ], key = "UV_PRERELEASE", value = "allow" },
Expand Down
9 changes: 6 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ dependencies = [
"packaging>=24.2",
# array-api-compat 1.5 has https://github.com/scverse/anndata/issues/1410
"array_api_compat>1.4,!=1.5",
"fast-array-utils",
"legacy-api-wrap",
"zarr >=2.15.0, !=3.0.0, !=3.0.1, !=3.0.2, !=3.0.3",
]
Expand Down Expand Up @@ -85,25 +86,27 @@ doc = [
dev-doc = [ "towncrier>=24.8.0" ] # release notes tool
test-full = [ "anndata[test,lazy]" ]
test = [
"loompy>=3.0.5",
"pytest>=8.2,<8.3.4",
"pytest-cov",
"pytest-randomly",
"pytest-memray",
"pytest-mock",
"pytest-instafail",
"fast-array-utils[testing]",
"pytest-xdist[psutil]",
"filelock",
"matplotlib",
"scikit-learn",
"loompy>=3.0.5",
"openpyxl",
"joblib",
"boltons",
"scanpy>=1.10",
"httpx", # For data downloading
"httpx", # For data downloading
"dask[distributed]",
"awkward>=2.3",
"pyarrow",
"anndata[dask]",
"anndata[dask,lazy]",
]
gpu = [ "cupy" ]
cu12 = [ "cupy-cuda12x" ]
Expand Down
8 changes: 4 additions & 4 deletions src/anndata/_core/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
DaskArray,
_map_cat_to_str,
)
from ..utils import asarray, axis_len, warn_once
from ..utils import axis_len, warn_once
from .anndata import AnnData
from .index import _subset, make_slice

Expand Down Expand Up @@ -115,8 +115,8 @@ def not_missing(v) -> bool:
# TODO: Hopefully this will stop being an issue in the future and this code can be removed.
@singledispatch
def equal(a, b) -> bool:
a = asarray(a)
b = asarray(b)
a = np.asarray(a)
b = np.asarray(b)
if a.ndim == b.ndim == 0:
return bool(a == b)
return np.array_equal(a, b)
Expand Down Expand Up @@ -150,7 +150,7 @@ def equal_dask_array(a, b) -> bool:
def equal_array(a, b) -> bool:
# Reshaping allows us to compare inputs with >2 dimensions
# We cast to pandas since it will still work with non-numeric types
b = asarray(b)
b = np.asarray(b)
if a.shape != b.shape:
return False

Expand Down
2 changes: 1 addition & 1 deletion src/anndata/compat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import h5py
import numpy as np
import pandas as pd
import scipy
import scipy.sparse
from packaging.version import Version
from zarr import Array as ZarrArray # noqa: F401
from zarr import Group as ZarrGroup
Expand Down
Loading
Loading