Skip to content

Commit

Permalink
Attempt to fix CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
hameerabbasi committed Dec 16, 2024
1 parent 8158401 commit e2f2372
Show file tree
Hide file tree
Showing 9 changed files with 6,241 additions and 39 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ jobs:
- name: Install package
run: |
pip install -e '.[tests]'
# micromamba remove numba
# micromamba install -c numba numba
- name: Run tests
run: |
SPARSE_BACKEND=Numba pytest --pyargs sparse --doctest-modules --cov-report=xml:coverage_Numba.xml -n0 -vvv
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ coverage.xml
test_results/
junit/
.hypothesis/
coverage_*.xml

# Translations
*.mo
Expand Down Expand Up @@ -85,4 +86,3 @@ docs/examples_ipynb/

# Pixi envs
.pixi/
pixi.lock
15 changes: 7 additions & 8 deletions ci/environment.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
name: sparse-dev
channels:
- numba
- conda-forge
- nodefaults
dependencies:
- python
- pip
- numpy
- numba
- scipy
- dask
- pytest
- pytest-cov
- pytest-xdist
- pip:
- finch-tensor>=0.2.2
- finch-mlir>=0.0.2
- pytest-codspeed
- numpy
- numba
- scipy
- dask
- pytest
- pytest-cov
- pytest-xdist
20 changes: 17 additions & 3 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import pathlib

import sparse

import pytest


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

import numpy as np

if sparse._BackendType.Numba != sparse._BACKEND:
pass # TODO: pytest.skip() skips Finch and MLIR tests

doctest_namespace["np"] = np
doctest_namespace["sparse"] = sparse


def pytest_ignore_collect(collection_path: pathlib.Path, config: pytest.Config) -> bool | None:
if "numba_backend" in collection_path.parts and sparse._BackendType.Numba != sparse._BACKEND:
return True

if "mlir_backend" in collection_path.parts and sparse._BackendType.MLIR != sparse._BACKEND:
return True

if "finch_backend" in collection_path.parts and sparse._BackendType.Finch != sparse._BACKEND:
return True

return None
6,199 changes: 6,199 additions & 0 deletions pixi.lock

Large diffs are not rendered by default.

28 changes: 16 additions & 12 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,28 @@ numpy = ">=1.17"
[dependencies]
python = ">=3.10,<3.13"

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

[feature.docs.pypi-dependencies]
[feature.doc.pypi-dependencies]
mkdocs-material = "*"
mkdocstrings = { version = "*", extras = ["python"] }
mkdocs-gen-files = "*"
mkdocs-literate-nav = "*"
mkdocs-section-index = "*"
mkdocs-jupyter = "*"

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

[feature.tests.dependencies]
[feature.test.pypi-dependencies]
pytest = ">=3.5"
pytest-cov = "*"
pytest-xdist = "*"
pre-commit = "*"
pytest-codspeed = "*"

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

[feature.finch.dependencies]
python = ">=3.10"
juliaup = ">=1.17.10"

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

[feature.mlir.dependencies]
python = ">=3.10"

[feature.mlir.pypi-dependencies]
scipy = ">=0.19"
finch-mlir = ">=0.0.2"
"PyYAML" = "*"

[feature.mlir.activation.env]
SPARSE_BACKEND = "MLIR"

[environments]
tests = ["tests", "extras"]
docs = ["docs", "extras"]
mlir-dev = {features = ["tests", "mlir"], no-default-feature = true}
finch-dev = {features = ["tests", "finch"], no-default-feature = true}
notebooks = ["extras", "mlir", "finch", "notebooks"]
test = ["test", "extra"]
doc = ["doc", "extra"]
mlir-dev = {features = ["test", "mlir"], no-default-feature = true}
finch-dev = {features = ["test", "finch"], no-default-feature = true}
notebooks = ["extra", "mlir", "finch", "notebooks"]
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[pytest]
addopts = --cov-report term-missing --cov-report html --cov-report=term:skip-covered --cov sparse --cov-config .coveragerc --junitxml=junit/test-results.xml
addopts = --cov-report term-missing --cov-report html --cov-report=term:skip-covered --cov sparse --cov-config .coveragerc
filterwarnings =
ignore::PendingDeprecationWarning
testpaths =
Expand Down
6 changes: 0 additions & 6 deletions sparse/mlir_backend/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +0,0 @@
import sparse

import pytest

if sparse._BACKEND != sparse._BackendType.MLIR:
pytest.skip("skipping MLIR tests", allow_module_level=True)
6 changes: 0 additions & 6 deletions sparse/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +0,0 @@
import sparse

import pytest

if sparse._BACKEND == sparse._BackendType.MLIR:
pytest.skip("skipping backend tests", allow_module_level=True)

0 comments on commit e2f2372

Please sign in to comment.