Skip to content

Commit e8c01a7

Browse files
committed
Attempt to fix CI.
1 parent 8158401 commit e8c01a7

File tree

9 files changed

+6253
-43
lines changed

9 files changed

+6253
-43
lines changed

.github/workflows/ci.yml

+12-6
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,16 @@ jobs:
4848
- name: Install package
4949
run: |
5050
pip install -e '.[tests]'
51-
# micromamba remove numba
52-
# micromamba install -c numba numba
5351
- name: Run tests
5452
run: |
55-
SPARSE_BACKEND=Numba pytest --pyargs sparse --doctest-modules --cov-report=xml:coverage_Numba.xml -n0 -vvv
56-
SPARSE_BACKEND=Finch pytest --pyargs sparse/tests --cov-report=xml:coverage_Finch.xml -n0 -vvv
57-
SPARSE_BACKEND=MLIR pytest --pyargs sparse/mlir_backend --cov-report=xml:coverage_MLIR.xml -n0 -vvv
53+
if [ $(python -c 'import numpy as np; print(np.lib.NumpyVersion(np.__version__) >= "2.0.0a1")') = 'True' ]; then
54+
pytest --pyargs sparse --doctest-modules --cov-report=xml:coverage_Numba.xml -n auto -vvv
55+
else
56+
pytest --pyargs sparse --cov-report=xml:coverage_Numba.xml -n auto -vvv
57+
fi
58+
python -c 'import finch'
59+
SPARSE_BACKEND=Finch pytest --pyargs sparse/tests --cov-report=xml:coverage_Finch.xml -n auto -vvv
60+
SPARSE_BACKEND=MLIR pytest --pyargs sparse/mlir_backend --cov-report=xml:coverage_MLIR.xml -n auto -vvv
5861
- uses: codecov/codecov-action@v5
5962
if: always()
6063
with:
@@ -128,7 +131,10 @@ jobs:
128131
SPARSE_BACKEND: ${{ matrix.backend }}
129132
run: |
130133
cd ${GITHUB_WORKSPACE}/array-api-tests
131-
pytest array_api_tests -v -c pytest.ini -n0 --max-examples=2 --derandomize --disable-deadline -o xfail_strict=True --xfails-file ${GITHUB_WORKSPACE}/ci/${{ matrix.backend }}-array-api-xfails.txt --skips-file ${GITHUB_WORKSPACE}/ci/${{ matrix.backend }}-array-api-skips.txt
134+
if [ "${SPARSE_BACKEND}" = "Finch" ]; then
135+
python -c 'import finch'
136+
fi
137+
pytest array_api_tests -v -c pytest.ini -n auto --max-examples=2 --derandomize --disable-deadline -o xfail_strict=True --xfails-file ${GITHUB_WORKSPACE}/ci/${{ matrix.backend }}-array-api-xfails.txt --skips-file ${GITHUB_WORKSPACE}/ci/${{ matrix.backend }}-array-api-skips.txt
132138
133139
on:
134140
# Trigger the workflow on push or pull request,

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ coverage.xml
4949
test_results/
5050
junit/
5151
.hypothesis/
52+
coverage_*.xml
5253

5354
# Translations
5455
*.mo
@@ -85,4 +86,3 @@ docs/examples_ipynb/
8586

8687
# Pixi envs
8788
.pixi/
88-
pixi.lock

ci/environment.yml

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
name: sparse-dev
22
channels:
3-
- numba
43
- conda-forge
54
- nodefaults
65
dependencies:
76
- python
87
- pip
9-
- numpy
10-
- numba
11-
- scipy
12-
- dask
13-
- pytest
14-
- pytest-cov
15-
- pytest-xdist
168
- pip:
179
- finch-tensor>=0.2.2
1810
- finch-mlir>=0.0.2
1911
- pytest-codspeed
12+
- numpy
13+
- numba
14+
- scipy
15+
- dask
16+
- pytest
17+
- pytest-cov
18+
- pytest-xdist

conftest.py

+17-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import pathlib
2+
3+
import sparse
4+
15
import pytest
26

37

@@ -7,8 +11,18 @@ def add_doctest_modules(doctest_namespace):
711

812
import numpy as np
913

10-
if sparse._BackendType.Numba != sparse._BACKEND:
11-
pass # TODO: pytest.skip() skips Finch and MLIR tests
12-
1314
doctest_namespace["np"] = np
1415
doctest_namespace["sparse"] = sparse
16+
17+
18+
def pytest_ignore_collect(collection_path: pathlib.Path, config: pytest.Config) -> bool | None:
19+
if "numba_backend" in collection_path.parts and sparse._BackendType.Numba != sparse._BACKEND:
20+
return True
21+
22+
if "mlir_backend" in collection_path.parts and sparse._BackendType.MLIR != sparse._BACKEND:
23+
return True
24+
25+
if "finch_backend" in collection_path.parts and sparse._BackendType.Finch != sparse._BACKEND:
26+
return True
27+
28+
return None

pixi.lock

+6,199
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pixi.toml

+16-12
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,28 @@ numpy = ">=1.17"
1212
[dependencies]
1313
python = ">=3.10,<3.13"
1414

15-
[feature.extras.pypi-dependencies]
15+
[feature.extra.pypi-dependencies]
1616
dask = { version = ">=2024", extras = ["array"] }
1717
scipy = ">=0.19"
1818
scikit-learn = "*"
1919

20-
[feature.docs.pypi-dependencies]
20+
[feature.doc.pypi-dependencies]
2121
mkdocs-material = "*"
2222
mkdocstrings = { version = "*", extras = ["python"] }
2323
mkdocs-gen-files = "*"
2424
mkdocs-literate-nav = "*"
2525
mkdocs-section-index = "*"
2626
mkdocs-jupyter = "*"
2727

28-
[feature.tests.tasks]
29-
test = "pytest --pyargs sparse -n auto"
30-
test-mlir = { cmd = "pytest --pyargs sparse.mlir_backend -v" }
28+
[feature.test.tasks]
29+
test = "pytest -n auto --doctest-modules"
30+
test-mlir = "pytest --pyargs sparse.mlir_backend -v"
3131
test-finch = { cmd = "pytest --pyargs sparse/tests -n auto -v", depends-on = ["precompile"] }
3232

33-
[feature.tests.dependencies]
33+
[feature.test.pypi-dependencies]
3434
pytest = ">=3.5"
3535
pytest-cov = "*"
3636
pytest-xdist = "*"
37-
pre-commit = "*"
3837
pytest-codspeed = "*"
3938

4039
[feature.notebooks.pypi-dependencies]
@@ -51,6 +50,7 @@ matrepr = "*"
5150
precompile = "python -c 'import finch'"
5251

5352
[feature.finch.dependencies]
53+
python = ">=3.10"
5454
juliaup = ">=1.17.10"
5555

5656
[feature.finch.pypi-dependencies]
@@ -63,16 +63,20 @@ SPARSE_BACKEND = "Finch"
6363
[feature.finch.target.osx-arm64.activation.env]
6464
PYTHONFAULTHANDLER = "${HOME}/faulthandler.log"
6565

66+
[feature.mlir.dependencies]
67+
python = ">=3.10"
68+
6669
[feature.mlir.pypi-dependencies]
6770
scipy = ">=0.19"
6871
finch-mlir = ">=0.0.2"
72+
"PyYAML" = "*"
6973

7074
[feature.mlir.activation.env]
7175
SPARSE_BACKEND = "MLIR"
7276

7377
[environments]
74-
tests = ["tests", "extras"]
75-
docs = ["docs", "extras"]
76-
mlir-dev = {features = ["tests", "mlir"], no-default-feature = true}
77-
finch-dev = {features = ["tests", "finch"], no-default-feature = true}
78-
notebooks = ["extras", "mlir", "finch", "notebooks"]
78+
test = ["test", "extra"]
79+
doc = ["doc", "extra"]
80+
mlir-dev = {features = ["test", "mlir"], no-default-feature = true}
81+
finch-dev = {features = ["test", "finch"], no-default-feature = true}
82+
notebooks = ["extra", "mlir", "finch", "notebooks"]

pytest.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[pytest]
2-
addopts = --cov-report term-missing --cov-report html --cov-report=term:skip-covered --cov sparse --cov-config .coveragerc --junitxml=junit/test-results.xml
2+
addopts = --cov-report term-missing --cov-report html --cov-report=term:skip-covered --cov sparse --cov-config .coveragerc
33
filterwarnings =
44
ignore::PendingDeprecationWarning
55
testpaths =

sparse/mlir_backend/tests/__init__.py

-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +0,0 @@
1-
import sparse
2-
3-
import pytest
4-
5-
if sparse._BACKEND != sparse._BackendType.MLIR:
6-
pytest.skip("skipping MLIR tests", allow_module_level=True)

sparse/tests/__init__.py

-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +0,0 @@
1-
import sparse
2-
3-
import pytest
4-
5-
if sparse._BACKEND == sparse._BackendType.MLIR:
6-
pytest.skip("skipping backend tests", allow_module_level=True)

0 commit comments

Comments
 (0)