Skip to content

Commit 352fc98

Browse files
authored
BLD/DEV/CI: better Pixi setup (#920)
2 parents 5e5f0fd + b98cdff commit 352fc98

File tree

9 files changed

+18105
-112
lines changed

9 files changed

+18105
-112
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,49 +6,37 @@ concurrency:
66
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
77
cancel-in-progress: true
88

9+
name: "CI"
10+
911
jobs:
1012
test:
13+
name: Test ${{ matrix.os }} (${{ join(matrix.tasks, ' ') }})
1114
strategy:
1215
matrix:
13-
os: ['ubuntu-latest']
14-
python: ['3.11', '3.12', '3.13']
15-
pip_opts: ['']
16-
numba_boundscheck: [0]
16+
os: [macos-latest, windows-latest]
17+
tasks: [[test-numba, test-finch, test-mlir]]
18+
environments: [[test, finch, mlir]]
1719
include:
18-
- os: macos-latest
19-
python: '3.11'
20-
- os: windows-latest
21-
python: '3.11'
22-
- os: ubuntu-latest
23-
python: '3.11'
24-
numba_boundscheck: 1
2520
- os: ubuntu-latest
26-
python: '3.11'
27-
pip_opts: 'numpy<2'
21+
tasks: [test-numba, test-finch, test-mlir, test-numba-mindeps, test-finch-mindeps, test-mlir-mindeps]
22+
environments: [mindeps, test, finch, mlir]
2823
fail-fast: false
2924
runs-on: ${{ matrix.os }}
30-
env:
31-
PYTHON_VERSION: ${{ matrix.python }}
32-
NUMBA_BOUNDSCHECK: ${{ matrix.numba_boundscheck }}
3325
steps:
3426
- name: Checkout Repo
3527
uses: actions/checkout@v4
36-
- uses: mamba-org/setup-micromamba@v2
28+
- uses: prefix-dev/setup-pixi@v0.9.4
3729
with:
38-
environment-file: ci/environment.yml
39-
init-shell: >-
40-
bash
41-
cache-environment: true
42-
cache-downloads: true
43-
post-cleanup: 'all'
44-
create-args: >-
45-
python=${{ matrix.python }}
46-
${{ matrix.pip_opts }}
47-
- name: Install package
48-
run: |
49-
pip install -e '.[tests]'
30+
pixi-version: v0.63.2
31+
cache: true
32+
environments: ${{ join(matrix.environments, ' ') }}
33+
- name: hack for setuptools-scm
34+
run: pixi build
5035
- name: Run tests
51-
run: ci/test_backends.sh
36+
run: |
37+
for task in ${{ join(matrix.tasks, ' ') }}; do
38+
pixi run "$task"
39+
done
5240
- uses: codecov/codecov-action@v5
5341
with:
5442
token: ${{ secrets.CODECOV_TOKEN }}

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,5 +86,4 @@ docs/examples_ipynb/
8686

8787
# Envs
8888
.pixi/
89-
pixi.lock
9089
.venv/

ci/environment.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

ci/test_Finch.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

ci/test_MLIR.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

ci/test_Numba.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

ci/test_backends.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

pixi.lock

Lines changed: 17983 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pixi.toml

Lines changed: 104 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,95 @@
1-
[project]
1+
[workspace]
22
authors = ["Hameer Abbasi <2190658+hameerabbasi@users.noreply.github.com>"]
3-
channels = ["conda-forge"]
3+
channels = ["https://prefix.dev/conda-forge"]
44
name = "sparse"
55
platforms = ["osx-arm64", "osx-64", "linux-64", "win-64"]
6+
preview = ["pixi-build"]
67

7-
[pypi-dependencies]
8-
sparse = { path = ".", editable = true }
8+
[environments]
9+
test = ["test", "extra"]
10+
doc = ["doc", "extra"]
11+
mlir = ["test", "mlir"]
12+
finch = ["test", "finch"]
13+
matrepr = ["matrepr"]
14+
notebooks = ["extra", "mlir", "finch", "notebooks"]
15+
core = { features = ["core"], no-default-feature = true }
16+
mindeps = ["test", "extra", "mindeps", "numba-boundscheck", "finch", "mlir"]
17+
18+
# sparse package definition #
19+
20+
[package]
21+
version = "0.1.0" # TODO: fix this
22+
23+
[package.build.backend]
24+
name = "pixi-build-python"
25+
version = "*"
26+
27+
[package.host-dependencies]
28+
python = ">=3.11,<3.14"
29+
setuptools = "*"
30+
setuptools-scm = "*"
31+
32+
[package.run-dependencies]
933
numba = ">=0.49"
1034
numpy = ">=1.17"
1135

12-
[dependencies]
13-
python = ">=3.11,<3.14"
36+
# default feature definition #
1437

15-
[feature.extra.pypi-dependencies]
16-
dask = { version = ">=2024", extras = ["array"] }
38+
[dev]
39+
sparse.path = "."
40+
41+
# non-default feature definitions #
42+
43+
# extra
44+
45+
[feature.extra.dependencies]
46+
dask = ">=2024"
1747
scipy = ">=0.19"
1848
scikit-learn = "*"
1949

20-
[feature.doc.pypi-dependencies]
50+
# doc
51+
52+
[feature.doc.dependencies]
2153
mkdocs-material = "*"
22-
mkdocstrings = { version = "*", extras = ["python"] }
54+
mkdocstrings-python = "*"
2355
mkdocs-gen-files = "*"
2456
mkdocs-literate-nav = "*"
2557
mkdocs-section-index = "*"
2658
mkdocs-jupyter = "*"
2759

28-
[feature.test.tasks]
29-
test = "ci/test_Numba.sh"
30-
test-mlir = "ci/test_MLIR.sh"
31-
test-finch = "ci/test_Finch.sh"
60+
# test
3261

33-
[feature.test.pypi-dependencies]
62+
[feature.test.dependencies]
3463
pytest = ">=3.5"
3564
pytest-cov = "*"
3665
pytest-xdist = "*"
3766
pytest-codspeed = "*"
3867

39-
[feature.notebooks.pypi-dependencies]
68+
[feature.test.tasks.test]
69+
cmd = "pytest -n auto -vvv"
70+
default-environment = "test"
71+
72+
[feature.test.tasks.test-numba]
73+
cmd = "pytest --pyargs sparse --doctest-modules --cov-report=xml:coverage_Numba.xml -n auto -vvv"
74+
default-environment = "test"
75+
76+
# notebooks
77+
78+
[feature.notebooks.dependencies]
4079
ipykernel = "*"
4180
nbmake = "*"
4281
matplotlib = "*"
4382
networkx = "*"
4483
jupyterlab = "*"
4584

46-
[feature.matrepr.pypi-dependencies]
47-
matrepr = "*"
48-
49-
[feature.finch.tasks]
50-
precompile = "python -c 'import finch'"
85+
# finch
5186

5287
[feature.finch.dependencies]
5388
python = ">=3.10"
5489
juliaup = ">=1.17.10"
90+
scipy = ">=1.13"
5591

5692
[feature.finch.pypi-dependencies]
57-
scipy = ">=1.13"
5893
finch-tensor = ">=0.2.13"
5994

6095
[feature.finch.activation.env]
@@ -63,30 +98,59 @@ SPARSE_BACKEND = "Finch"
6398
[feature.finch.target.osx-arm64.activation.env]
6499
PYTHONFAULTHANDLER = "${HOME}/faulthandler.log"
65100

101+
[feature.finch.tasks._precompile]
102+
cmd = "python -c 'import finch'"
103+
default-environment = "finch"
104+
105+
[feature.finch.tasks.test-finch]
106+
cmd = "pytest --pyargs sparse/tests --cov-report=xml:coverage_Finch.xml -n auto -vvv"
107+
depends-on = ["_precompile"]
108+
default-environment = "finch"
109+
110+
# mlir
111+
66112
[feature.mlir.dependencies]
67-
python = ">=3.10,<3.14"
113+
scipy = ">=0.19"
114+
pyyaml = "*"
68115

69116
[feature.mlir.pypi-dependencies]
70-
scipy = ">=0.19"
71117
finch-mlir = ">=0.0.2"
72-
"PyYAML" = "*"
73118

74-
[feature.barebones.dependencies]
75-
python = ">=3.10,<3.13"
76-
pip = ">=24"
119+
[feature.mlir.activation.env]
120+
SPARSE_BACKEND = "MLIR"
121+
122+
[feature.mlir.tasks.test-mlir]
123+
cmd = "pytest --pyargs sparse/mlir_backend --cov-report=xml:coverage_MLIR.xml -n auto -vvv"
124+
default-environment = "mlir"
125+
126+
# matrepr
127+
128+
[feature.matrepr.dependencies]
129+
matrepr = "*"
130+
131+
# core
77132

78-
[feature.barebones.tasks]
79-
setup-env = {cmd = "ci/setup_env.sh" }
133+
[feature.core.tasks]
134+
setup-env = { cmd = "ci/setup_env.sh" }
80135
test-all = { cmd = "ci/test_all.sh", env = { ACTIVATE_VENV = "1" }, depends-on = ["setup-env"] }
81-
test-finch = "ci/test_Finch.sh"
82136

83-
[feature.mlir.activation.env]
84-
SPARSE_BACKEND = "MLIR"
137+
# mindeps
85138

86-
[environments]
87-
test = ["test", "extra"]
88-
doc = ["doc", "extra"]
89-
mlir-dev = {features = ["test", "mlir"], no-default-feature = true}
90-
finch-dev = {features = ["test", "finch"], no-default-feature = true}
91-
notebooks = ["extra", "mlir", "finch", "notebooks"]
92-
barebones = {features = ["barebones"], no-default-feature = true}
139+
[feature.mindeps.dependencies]
140+
python = "3.11.*"
141+
numpy = "1.*"
142+
143+
[feature.mindeps.tasks.test-numba-mindeps]
144+
cmd = "pytest --pyargs sparse --cov-report=xml:coverage_Numba.xml -n auto -vvv"
145+
env.SPARSE_BACKEND = "Numba"
146+
147+
[feature.mindeps.tasks.test-finch-mindeps]
148+
cmd = "pytest --pyargs sparse/tests --cov-report=xml:coverage_Finch.xml -n auto -vvv"
149+
env.SPARSE_BACKEND = "Finch"
150+
151+
[feature.mindeps.tasks.test-mlir-mindeps]
152+
cmd = "pytest --pyargs sparse/mlir_backend --cov-report=xml:coverage_MLIR.xml -n auto -vvv"
153+
env.SPARSE_BACKEND = "MLIR"
154+
155+
[feature.numba-boundscheck.activation.env]
156+
NUMBA_BOUNDSCHECK = "1"

0 commit comments

Comments
 (0)