Skip to content

Commit 1bf25ea

Browse files
authored
Merge branch 'main' into pagerank-example
2 parents b2e63af + 05cf589 commit 1bf25ea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1310
-646
lines changed

.codecov.yml

+7-17
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,18 @@
1-
comment:
2-
layout: "header, diff, changes, uncovered"
3-
1+
comment: false
42
coverage:
53
status:
64
project:
75
default:
8-
# Total project must not drop by more than 3%
9-
target: auto
10-
threshold: "3%"
6+
# Total project must be 95%
7+
target: '100%'
8+
threshold: '5%'
119

1210
patch:
1311
default:
1412
# Patch coverage must be 92%
15-
target: auto
16-
threshold: "92%"
13+
target: '100%'
14+
threshold: '8%'
1715

1816
precision: 2
1917
round: down
20-
range: 70...98
21-
22-
ignore:
23-
- sparse/tests/
24-
- sparse/_version.py
25-
- ^(?!sparse\/)
26-
27-
codecov:
28-
token: 8de77158-fc37-47be-930c-f98739f9e5bf
18+
range: 80...98

.github/workflows/ci.yml

+38-66
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1+
defaults:
2+
run:
3+
shell: bash -leo pipefail {0}
4+
5+
concurrency:
6+
group: ${{ github.head_ref }}
7+
cancel-in-progress: true
8+
19
jobs:
210
test:
3-
defaults:
4-
run:
5-
shell: bash -el {0}
611
strategy:
712
matrix:
813
os: [ubuntu-latest]
914
python: ['3.10', '3.11', '3.12']
15+
pip_opts: ['']
1016
numba_boundscheck: [0]
1117
include:
1218
- os: macos-latest
@@ -16,6 +22,9 @@ jobs:
1622
- os: ubuntu-latest
1723
python: '3.10'
1824
numba_boundscheck: 1
25+
- os: ubuntu-latest
26+
python: '3.10'
27+
pip_opts: "--pre -U"
1928
fail-fast: false
2029
runs-on: ${{ matrix.os }}
2130
env:
@@ -24,63 +33,33 @@ jobs:
2433
steps:
2534
- name: Checkout Repo
2635
uses: actions/checkout@v4
27-
- name: Cache conda
28-
uses: actions/cache@v4
29-
env:
30-
# Increase this value to reset cache if ci/environment.yml has not changed
31-
CACHE_NUMBER: 0
32-
with:
33-
path: ~/conda_pkgs_dir
34-
key:
35-
test-${{ matrix.os }}-conda-py${{ matrix.python }}-${{ env.CACHE_NUMBER }}-${{
36-
hashFiles('ci/environment.yml') }}
37-
- uses: julia-actions/setup-julia@v1
36+
- name: Set up Python
37+
uses: actions/setup-python@v5
3838
with:
39-
version: '1.10.0'
40-
- uses: conda-incubator/setup-miniconda@v3
41-
with:
42-
activate-environment: sparse-dev
43-
allow-softlinks: true
44-
environment-file: ci/environment.yml
4539
python-version: ${{ matrix.python }}
46-
miniforge-version: latest
40+
cache: 'pip'
4741
- name: Install package
4842
run: |
4943
pip install -e .[tests]
44+
pip install ${{ matrix.pip_opts }} numpy numba
5045
- name: Run tests
5146
run: |
52-
pytest --pyargs sparse
47+
SPARSE_BACKEND=Numba pytest --pyargs sparse --cov-report=xml:coverage_Numba.xml -n 4 -vvv
48+
SPARSE_BACKEND=Finch pytest --pyargs sparse/tests --cov-report=xml:coverage_Finch.xml -n 4 -vvv
5349
- uses: codecov/codecov-action@v4
5450
if: always()
55-
- name: Publish Test Results
56-
uses: EnricoMi/publish-unit-test-result-action/composite@v2
57-
if: always()
5851
with:
59-
files: "**/test-*.xml"
52+
files: ./**/coverage*.xml
6053
docs:
61-
defaults:
62-
run:
63-
shell: bash -el {0}
6454
runs-on: ubuntu-latest
6555
steps:
6656
- name: Checkout Repo
6757
uses: actions/checkout@v4
68-
- name: Cache conda
69-
uses: actions/cache@v4
70-
env:
71-
# Increase this value to reset cache if ci/environment.yml has not changed
72-
CACHE_NUMBER: 0
58+
- name: Set up Python
59+
uses: actions/setup-python@v5
7360
with:
74-
path: ~/conda_pkgs_dir
75-
key:
76-
docs-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/environment.yml') }}
77-
- uses: conda-incubator/setup-miniconda@v3
78-
with:
79-
activate-environment: sparse-dev
80-
allow-softlinks: true
81-
environment-file: ci/environment.yml
8261
python-version: '3.10'
83-
miniforge-version: latest
62+
cache: 'pip'
8463
- name: Install package
8564
run: |
8665
pip install -e .[docs]
@@ -92,29 +71,15 @@ jobs:
9271
name: Documentation
9372
path: _build/html
9473
benchmarks:
95-
defaults:
96-
run:
97-
shell: bash -el {0}
9874
runs-on: ubuntu-latest
9975
steps:
10076
- name: Checkout Repo
10177
uses: actions/checkout@v4
102-
- name: Cache conda
103-
uses: actions/cache@v4
104-
env:
105-
# Increase this value to reset cache if ci/environment.yml has not changed
106-
CACHE_NUMBER: 0
107-
with:
108-
path: ~/conda_pkgs_dir
109-
key:
110-
benchmarks-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/environment.yml') }}
111-
- uses: conda-incubator/setup-miniconda@v3
78+
- name: Set up Python
79+
uses: actions/setup-python@v5
11280
with:
113-
activate-environment: sparse-dev
114-
allow-softlinks: true
115-
environment-file: ci/environment.yml
11681
python-version: '3.10'
117-
miniforge-version: latest
82+
cache: 'pip'
11883
- name: Install asv
11984
run: |
12085
pip install asv
@@ -128,16 +93,22 @@ jobs:
12893
- name: Checkout Repo
12994
uses: actions/checkout@v4
13095
- name: Set up Python
131-
uses: actions/setup-python@v5.1.0
96+
uses: actions/setup-python@v5
13297
with:
13398
python-version: '3.11'
99+
cache: 'pip'
134100
- name: Build and install Sparse
135101
run: |
102+
pip install -U setuptools wheel
136103
python -m pip install '.[finch]' scipy
137104
- name: Run examples
138105
run: |
139106
source ci/test_examples.sh
140107
array_api_tests:
108+
strategy:
109+
matrix:
110+
backend: ['Numba', 'Finch']
111+
fail-fast: false
141112
runs-on: ubuntu-latest
142113
steps:
143114
- name: Checkout Repo
@@ -146,26 +117,27 @@ jobs:
146117
uses: actions/checkout@v4
147118
with:
148119
repository: data-apis/array-api-tests
149-
ref: '3cf8ef654c456d9fd1633d64e67b4470465940e9' # Latest commit as of 2024-04-09
120+
ref: '33f2d2ea2f3dd2b3ceeeb4519d55e08096184149' # Latest commit as of 2024-05-29
150121
submodules: 'true'
151122
path: 'array-api-tests'
152123
- name: Set up Python
153-
uses: actions/setup-python@v5.1.0
124+
uses: actions/setup-python@v5
154125
with:
155126
python-version: '3.11'
127+
cache: 'pip'
156128
- name: Install build and test dependencies from PyPI
157129
run: |
158-
python -m pip install -r array-api-tests/requirements.txt
130+
python -m pip install pytest-xdist -r array-api-tests/requirements.txt
159131
- name: Build and install Sparse
160132
run: |
161133
python -m pip install '.[finch]'
162134
- name: Run the test suite
163135
env:
164136
ARRAY_API_TESTS_MODULE: sparse
165-
SPARSE_BACKEND: Finch
137+
SPARSE_BACKEND: ${{ matrix.backend }}
166138
run: |
167139
cd ${GITHUB_WORKSPACE}/array-api-tests
168-
pytest array_api_tests/test_signatures.py -v -c pytest.ini --ci --max-examples=2 --derandomize --disable-deadline -o xfail_strict=True --xfails-file ${GITHUB_WORKSPACE}/ci/array-api-skips.txt
140+
pytest array_api_tests -v -c pytest.ini -n 4 --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
169141
on:
170142
# Trigger the workflow on push or pull request,
171143
# but only for the main branch

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,6 @@ sandbox.py
8080

8181
# Version file
8282
sparse/_version.py
83+
84+
# Benchmark Results
85+
results/

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ repos:
1717
args: ["--autofix", "--no-ensure-ascii"]
1818

1919
- repo: https://github.com/astral-sh/ruff-pre-commit
20-
rev: v0.4.4
20+
rev: v0.4.8
2121
hooks:
2222
- id: ruff
2323
args: ["--fix"]

asv.conf.json

-23
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,17 @@
44
],
55
"build_command": [],
66
"environment_type": "virtualenv",
7-
"exclude": [
8-
{
9-
"env": {
10-
"SPARSE_BACKEND": "Finch"
11-
},
12-
"req": {
13-
"finch-tensor": null
14-
}
15-
},
16-
{
17-
"env": {
18-
"SPARSE_BACKEND": "Numba"
19-
},
20-
"req": {
21-
"finch-tensor": ""
22-
}
23-
}
24-
],
257
"install_command": [
268
"pip install --no-deps ."
279
],
2810
"matrix": {
2911
"env": {
3012
"SPARSE_BACKEND": [
31-
"Finch",
3213
"Numba"
3314
]
3415
},
3516
"env_nobuild": {},
3617
"req": {
37-
"finch-tensor": [
38-
"",
39-
null
40-
],
4118
"numba": [
4219
""
4320
],

0 commit comments

Comments
 (0)