vsparse 0.4.0__tar.gz → 0.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {vsparse-0.4.0 → vsparse-0.6.0}/PKG-INFO +69 -15
- {vsparse-0.4.0 → vsparse-0.6.0}/README.md +64 -14
- {vsparse-0.4.0 → vsparse-0.6.0}/pyproject.toml +15 -1
- {vsparse-0.4.0 → vsparse-0.6.0}/pyproject.toml.orig +21 -1
- {vsparse-0.4.0 → vsparse-0.6.0}/src/vsparse/__init__.py +7 -3
- {vsparse-0.4.0 → vsparse-0.6.0}/src/vsparse/_anndata_class.py +117 -92
- {vsparse-0.4.0 → vsparse-0.6.0}/src/vsparse/_base.py +20 -22
- vsparse-0.6.0/src/vsparse/_compression.py +308 -0
- {vsparse-0.4.0 → vsparse-0.6.0}/src/vsparse/_construct.py +3 -1
- vsparse-0.6.0/src/vsparse/_cuda.py +881 -0
- vsparse-0.6.0/src/vsparse/_io.py +243 -0
- {vsparse-0.4.0 → vsparse-0.6.0}/src/vsparse/_ivcsc.py +227 -39
- {vsparse-0.4.0 → vsparse-0.6.0}/src/vsparse/_norm_common.py +203 -134
- {vsparse-0.4.0 → vsparse-0.6.0}/src/vsparse/_ops.py +139 -2
- vsparse-0.6.0/src/vsparse/_rapid_load.py +108 -0
- vsparse-0.6.0/src/vsparse/_stats.py +212 -0
- {vsparse-0.4.0 → vsparse-0.6.0}/src/vsparse/_vcs_norm.py +1 -2
- vsparse-0.4.0/src/vsparse/_compression.py +0 -168
- vsparse-0.4.0/src/vsparse/_io.py +0 -143
- vsparse-0.4.0/src/vsparse/_rapid_load.py +0 -556
- {vsparse-0.4.0 → vsparse-0.6.0}/src/vsparse/_anndata.py +0 -0
- {vsparse-0.4.0 → vsparse-0.6.0}/src/vsparse/_indexutils.py +0 -0
- {vsparse-0.4.0 → vsparse-0.6.0}/src/vsparse/_vcs_matmul.py +0 -0
- {vsparse-0.4.0 → vsparse-0.6.0}/src/vsparse/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vsparse
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: Value-Compressed Sparse Column/Row (VCSC/VCSR) arrays, with optional AnnData integration
|
|
5
5
|
Keywords: anndata,single-cell,sparse,compression
|
|
6
6
|
Author: Aaron Meyer
|
|
@@ -11,11 +11,14 @@ Classifier: Intended Audience :: Science/Research
|
|
|
11
11
|
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.12
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
14
15
|
Requires-Dist: numpy>=2.0
|
|
15
16
|
Requires-Dist: scipy>=1.12
|
|
16
17
|
Requires-Dist: numba>=0.60
|
|
17
18
|
Requires-Dist: anndata>=0.13
|
|
18
19
|
Requires-Dist: hdf5plugin>=4.0
|
|
20
|
+
Requires-Dist: numcodecs>=0.13
|
|
21
|
+
Requires-Dist: cupy-cuda13x[ctk]>=13.0,<15.0 ; extra == 'cuda'
|
|
19
22
|
Requires-Dist: sphinx>=7.0 ; extra == 'docs'
|
|
20
23
|
Requires-Dist: furo>=2024.1.29 ; extra == 'docs'
|
|
21
24
|
Requires-Dist: myst-parser>=3.0 ; extra == 'docs'
|
|
@@ -25,6 +28,7 @@ Project-URL: Homepage, https://meyer-lab.github.io/vsparse/
|
|
|
25
28
|
Project-URL: Repository, https://github.com/meyer-lab/vsparse
|
|
26
29
|
Project-URL: Documentation, https://meyer-lab.github.io/vsparse/
|
|
27
30
|
Project-URL: Issues, https://github.com/meyer-lab/vsparse/issues
|
|
31
|
+
Provides-Extra: cuda
|
|
28
32
|
Provides-Extra: docs
|
|
29
33
|
Description-Content-Type: text/markdown
|
|
30
34
|
|
|
@@ -55,6 +59,14 @@ pip install vsparse
|
|
|
55
59
|
uv add vsparse
|
|
56
60
|
```
|
|
57
61
|
|
|
62
|
+
For the CUDA support described below (needs an NVIDIA GPU; pulls in CuPy):
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
pip install "vsparse[cuda]"
|
|
66
|
+
# or with uv
|
|
67
|
+
uv add "vsparse[cuda]"
|
|
68
|
+
```
|
|
69
|
+
|
|
58
70
|
From source:
|
|
59
71
|
|
|
60
72
|
```sh
|
|
@@ -130,7 +142,8 @@ va = vsparse.VCSCAnnData.from_anndata(adata) # Compresses X and raw.X
|
|
|
130
142
|
va.X # VCSCArray
|
|
131
143
|
va.raw_X # VCSCArray (separate from anndata's .raw)
|
|
132
144
|
|
|
133
|
-
# Persist to HDF5 (.h5ad) or Zarr with default
|
|
145
|
+
# Persist to HDF5 (.h5ad) or Zarr with default zstd compression
|
|
146
|
+
# (stored as IVCSC/IVCSR, see below)
|
|
134
147
|
va.write_h5ad("compressed.h5ad") # Read back with VCSCAnnData.read_h5ad
|
|
135
148
|
va2 = vsparse.VCSCAnnData.read_h5ad("compressed.h5ad")
|
|
136
149
|
|
|
@@ -143,41 +156,82 @@ plain = va.to_anndata()
|
|
|
143
156
|
|
|
144
157
|
### Byte-Packed On-Disk Format (IVCSC / IVCSR)
|
|
145
158
|
|
|
146
|
-
|
|
159
|
+
`write_h5ad` / `write_zarr` always store `X`/`raw_X` as IVCSC (from VCSC) or IVCSR (from VCSR). This byte-packs the minor-axis indices with delta + varint encoding (inspired by [IVSparse's IVCSC](https://github.com/Seth-Wolfgang/IVSparse)).
|
|
147
160
|
|
|
148
161
|
It is purely an archival storage format: `read_h5ad` / `read_zarr` decompress the indices on load and return a standard `VCSCArray`/`VCSRArray`.
|
|
149
162
|
|
|
150
163
|
```python
|
|
151
|
-
#
|
|
152
|
-
va.write_h5ad("archived.h5ad"
|
|
164
|
+
# Writes delta+varint byte-packed indices
|
|
165
|
+
va.write_h5ad("archived.h5ad")
|
|
153
166
|
|
|
154
167
|
# Reads back directly as an ordinary VCSCAnnData
|
|
155
168
|
va_loaded = vsparse.VCSCAnnData.read_h5ad("archived.h5ad")
|
|
156
169
|
```
|
|
157
170
|
|
|
158
|
-
###
|
|
171
|
+
### Loading, subsetting, and normalizing
|
|
172
|
+
|
|
173
|
+
Loading, subsetting, and normalization are separate steps, so they can be mixed and matched. `vsparse.load_packed` decodes an IVCSR/IVCSC-stored `.h5ad` into a `VCSCAnnData`; normalization is then a view over the stored array (`.normalized("parafac2")` reproduces `parafac2.normalize.prepare_dataset`'s depth normalization and log10 transform) that is never materialized.
|
|
174
|
+
|
|
175
|
+
```python
|
|
176
|
+
va = vsparse.load_packed("archived.h5ad")
|
|
177
|
+
norm = va.X.normalized("parafac2") # lazy view; norm @ B works without densifying
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
`load_packed` can also subset as it decodes: `obs_idx`/`var_idx` take a boolean mask, an array of integer positions, or a slice, and give the same result as indexing a full load, without ever building the full matrix. With IVCSR, only the selected cells are decoded and unselected genes are dropped in the same pass (IVCSC is the same with the axes swapped). Every packed byte is still read, so reading the stream sets the floor: on a 1.26M-cell file, a 1% cell subset decodes `X` in 0.21 s against 0.50 s for all of it.
|
|
181
|
+
|
|
182
|
+
```python
|
|
183
|
+
import anndata, h5py
|
|
184
|
+
|
|
185
|
+
with h5py.File("archived.h5ad") as f: # read only obs to build the mask
|
|
186
|
+
obs = anndata.io.read_elem(f["obs"])
|
|
187
|
+
va_blood = vsparse.load_packed("archived.h5ad", obs_idx=obs["tissue"] == "blood")
|
|
188
|
+
```
|
|
159
189
|
|
|
160
|
-
|
|
190
|
+
### Statistics sidecar
|
|
161
191
|
|
|
162
|
-
-
|
|
163
|
-
- **Fused filter & normalization**: Performs gene filtering, cell/gene depth-scaling, and $\log_{10}(1000x + 1)$ transform in parallel passes over the compact CSR representation.
|
|
192
|
+
Every `VCSCArray`/`VCSRArray` carries per-row and per-column summary statistics as `arr.stats` (a `vsparse.VCSStats`): `row_sums`/`col_sums` (total counts), `row_nnz`/`col_nnz` (n-genes/n-cells by counts), and `col_depth_sums` (per-gene sums of depth-normalized counts). They are computed on first access and written next to `X`/`raw_X` by `write_h5ad`/`write_zarr` whether or not they were ever computed or a normalized view was ever made, so a file read back has them without touching the data. Every recipe's per-cell and per-gene scales (`a`/`b`) are derived from them, so only centering/scaling recipes still need a pass over the data. Files without a usable sidecar (older versions, other tools) load as before, and the statistics are recomputed when first needed.
|
|
164
193
|
|
|
165
194
|
```python
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
min_cell_counts=10.0, # Filter cells with counts <= 10
|
|
169
|
-
gene_threshold=0.05, # Filter genes with counts <= 0.05 * n_cells
|
|
170
|
-
)
|
|
195
|
+
va = vsparse.VCSCAnnData.read_h5ad("archived.h5ad")
|
|
196
|
+
keep = va.X.stats.row_sums >= 500 # QC filter from the sidecar alone
|
|
171
197
|
```
|
|
172
198
|
|
|
199
|
+
### CUDA (`to_gpu`)
|
|
200
|
+
|
|
201
|
+
A normalized view moves onto an NVIDIA GPU with `.to_gpu()`, keeping its value-compressed layout there rather than expanding to one float per nonzero — so a matrix that only fits in device memory compressed still fits. Everything floating-point on the device is float32.
|
|
202
|
+
|
|
203
|
+
```python
|
|
204
|
+
gpu = vsparse.VCSRArray.from_scipy(counts).normalized("parafac2").to_gpu()
|
|
205
|
+
out = gpu @ B # float32 CuPy array; B @ gpu likewise
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
cuSPARSE reads only CSR/CSC, so walking the VCS layout on the device needs custom kernels; `vsparse._cuda` supplies four, one per (format, direction). Against the alternative — expanding to a sorted CuPy CSR and calling cuSPARSE — they measured (RTX 5080, 60k x 2k, 6M nonzeros, width 16):
|
|
209
|
+
|
|
210
|
+
| direction | kernel / cuSPARSE | device bytes vs CSR |
|
|
211
|
+
| --- | --- | --- |
|
|
212
|
+
| `VCSR @ B` | 0.71x–0.86x | 0.62x |
|
|
213
|
+
| `VCSC @ B` | 0.83x | 0.51x |
|
|
214
|
+
| `B @ VCSC` | 0.32x | 0.51x |
|
|
215
|
+
| `B @ VCSR` | 0.23x | 0.62x |
|
|
216
|
+
|
|
217
|
+
`CudaNormalizedView.to_cupy_sparse()` builds that CSR baseline if you want it.
|
|
218
|
+
|
|
173
219
|
See `docs/` for full usage guides and API documentation.
|
|
174
220
|
|
|
175
221
|
## Development
|
|
176
222
|
|
|
177
223
|
```sh
|
|
178
|
-
uv sync --all-extras --dev
|
|
224
|
+
uv sync --all-extras --dev # add --no-extra cuda to skip the ~1 GB CuPy wheel
|
|
179
225
|
uv run pytest
|
|
180
226
|
uv run ruff check .
|
|
181
227
|
uv run ty check
|
|
182
228
|
uv run sphinx-build -b html docs docs/_build/html
|
|
183
229
|
```
|
|
230
|
+
|
|
231
|
+
The CUDA tests and benchmarks need an NVIDIA GPU; without one `tests/test_cuda.py`
|
|
232
|
+
skips itself. On a GPU machine:
|
|
233
|
+
|
|
234
|
+
```sh
|
|
235
|
+
uv run pytest -m cuda
|
|
236
|
+
uv run python -m benchmarks.run --set cuda
|
|
237
|
+
```
|
|
@@ -25,6 +25,14 @@ pip install vsparse
|
|
|
25
25
|
uv add vsparse
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
+
For the CUDA support described below (needs an NVIDIA GPU; pulls in CuPy):
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
pip install "vsparse[cuda]"
|
|
32
|
+
# or with uv
|
|
33
|
+
uv add "vsparse[cuda]"
|
|
34
|
+
```
|
|
35
|
+
|
|
28
36
|
From source:
|
|
29
37
|
|
|
30
38
|
```sh
|
|
@@ -100,7 +108,8 @@ va = vsparse.VCSCAnnData.from_anndata(adata) # Compresses X and raw.X
|
|
|
100
108
|
va.X # VCSCArray
|
|
101
109
|
va.raw_X # VCSCArray (separate from anndata's .raw)
|
|
102
110
|
|
|
103
|
-
# Persist to HDF5 (.h5ad) or Zarr with default
|
|
111
|
+
# Persist to HDF5 (.h5ad) or Zarr with default zstd compression
|
|
112
|
+
# (stored as IVCSC/IVCSR, see below)
|
|
104
113
|
va.write_h5ad("compressed.h5ad") # Read back with VCSCAnnData.read_h5ad
|
|
105
114
|
va2 = vsparse.VCSCAnnData.read_h5ad("compressed.h5ad")
|
|
106
115
|
|
|
@@ -113,41 +122,82 @@ plain = va.to_anndata()
|
|
|
113
122
|
|
|
114
123
|
### Byte-Packed On-Disk Format (IVCSC / IVCSR)
|
|
115
124
|
|
|
116
|
-
|
|
125
|
+
`write_h5ad` / `write_zarr` always store `X`/`raw_X` as IVCSC (from VCSC) or IVCSR (from VCSR). This byte-packs the minor-axis indices with delta + varint encoding (inspired by [IVSparse's IVCSC](https://github.com/Seth-Wolfgang/IVSparse)).
|
|
117
126
|
|
|
118
127
|
It is purely an archival storage format: `read_h5ad` / `read_zarr` decompress the indices on load and return a standard `VCSCArray`/`VCSRArray`.
|
|
119
128
|
|
|
120
129
|
```python
|
|
121
|
-
#
|
|
122
|
-
va.write_h5ad("archived.h5ad"
|
|
130
|
+
# Writes delta+varint byte-packed indices
|
|
131
|
+
va.write_h5ad("archived.h5ad")
|
|
123
132
|
|
|
124
133
|
# Reads back directly as an ordinary VCSCAnnData
|
|
125
134
|
va_loaded = vsparse.VCSCAnnData.read_h5ad("archived.h5ad")
|
|
126
135
|
```
|
|
127
136
|
|
|
128
|
-
###
|
|
137
|
+
### Loading, subsetting, and normalizing
|
|
138
|
+
|
|
139
|
+
Loading, subsetting, and normalization are separate steps, so they can be mixed and matched. `vsparse.load_packed` decodes an IVCSR/IVCSC-stored `.h5ad` into a `VCSCAnnData`; normalization is then a view over the stored array (`.normalized("parafac2")` reproduces `parafac2.normalize.prepare_dataset`'s depth normalization and log10 transform) that is never materialized.
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
va = vsparse.load_packed("archived.h5ad")
|
|
143
|
+
norm = va.X.normalized("parafac2") # lazy view; norm @ B works without densifying
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
`load_packed` can also subset as it decodes: `obs_idx`/`var_idx` take a boolean mask, an array of integer positions, or a slice, and give the same result as indexing a full load, without ever building the full matrix. With IVCSR, only the selected cells are decoded and unselected genes are dropped in the same pass (IVCSC is the same with the axes swapped). Every packed byte is still read, so reading the stream sets the floor: on a 1.26M-cell file, a 1% cell subset decodes `X` in 0.21 s against 0.50 s for all of it.
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
import anndata, h5py
|
|
150
|
+
|
|
151
|
+
with h5py.File("archived.h5ad") as f: # read only obs to build the mask
|
|
152
|
+
obs = anndata.io.read_elem(f["obs"])
|
|
153
|
+
va_blood = vsparse.load_packed("archived.h5ad", obs_idx=obs["tissue"] == "blood")
|
|
154
|
+
```
|
|
129
155
|
|
|
130
|
-
|
|
156
|
+
### Statistics sidecar
|
|
131
157
|
|
|
132
|
-
-
|
|
133
|
-
- **Fused filter & normalization**: Performs gene filtering, cell/gene depth-scaling, and $\log_{10}(1000x + 1)$ transform in parallel passes over the compact CSR representation.
|
|
158
|
+
Every `VCSCArray`/`VCSRArray` carries per-row and per-column summary statistics as `arr.stats` (a `vsparse.VCSStats`): `row_sums`/`col_sums` (total counts), `row_nnz`/`col_nnz` (n-genes/n-cells by counts), and `col_depth_sums` (per-gene sums of depth-normalized counts). They are computed on first access and written next to `X`/`raw_X` by `write_h5ad`/`write_zarr` whether or not they were ever computed or a normalized view was ever made, so a file read back has them without touching the data. Every recipe's per-cell and per-gene scales (`a`/`b`) are derived from them, so only centering/scaling recipes still need a pass over the data. Files without a usable sidecar (older versions, other tools) load as before, and the statistics are recomputed when first needed.
|
|
134
159
|
|
|
135
160
|
```python
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
min_cell_counts=10.0, # Filter cells with counts <= 10
|
|
139
|
-
gene_threshold=0.05, # Filter genes with counts <= 0.05 * n_cells
|
|
140
|
-
)
|
|
161
|
+
va = vsparse.VCSCAnnData.read_h5ad("archived.h5ad")
|
|
162
|
+
keep = va.X.stats.row_sums >= 500 # QC filter from the sidecar alone
|
|
141
163
|
```
|
|
142
164
|
|
|
165
|
+
### CUDA (`to_gpu`)
|
|
166
|
+
|
|
167
|
+
A normalized view moves onto an NVIDIA GPU with `.to_gpu()`, keeping its value-compressed layout there rather than expanding to one float per nonzero — so a matrix that only fits in device memory compressed still fits. Everything floating-point on the device is float32.
|
|
168
|
+
|
|
169
|
+
```python
|
|
170
|
+
gpu = vsparse.VCSRArray.from_scipy(counts).normalized("parafac2").to_gpu()
|
|
171
|
+
out = gpu @ B # float32 CuPy array; B @ gpu likewise
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
cuSPARSE reads only CSR/CSC, so walking the VCS layout on the device needs custom kernels; `vsparse._cuda` supplies four, one per (format, direction). Against the alternative — expanding to a sorted CuPy CSR and calling cuSPARSE — they measured (RTX 5080, 60k x 2k, 6M nonzeros, width 16):
|
|
175
|
+
|
|
176
|
+
| direction | kernel / cuSPARSE | device bytes vs CSR |
|
|
177
|
+
| --- | --- | --- |
|
|
178
|
+
| `VCSR @ B` | 0.71x–0.86x | 0.62x |
|
|
179
|
+
| `VCSC @ B` | 0.83x | 0.51x |
|
|
180
|
+
| `B @ VCSC` | 0.32x | 0.51x |
|
|
181
|
+
| `B @ VCSR` | 0.23x | 0.62x |
|
|
182
|
+
|
|
183
|
+
`CudaNormalizedView.to_cupy_sparse()` builds that CSR baseline if you want it.
|
|
184
|
+
|
|
143
185
|
See `docs/` for full usage guides and API documentation.
|
|
144
186
|
|
|
145
187
|
## Development
|
|
146
188
|
|
|
147
189
|
```sh
|
|
148
|
-
uv sync --all-extras --dev
|
|
190
|
+
uv sync --all-extras --dev # add --no-extra cuda to skip the ~1 GB CuPy wheel
|
|
149
191
|
uv run pytest
|
|
150
192
|
uv run ruff check .
|
|
151
193
|
uv run ty check
|
|
152
194
|
uv run sphinx-build -b html docs docs/_build/html
|
|
153
195
|
```
|
|
196
|
+
|
|
197
|
+
The CUDA tests and benchmarks need an NVIDIA GPU; without one `tests/test_cuda.py`
|
|
198
|
+
skips itself. On a GPU machine:
|
|
199
|
+
|
|
200
|
+
```sh
|
|
201
|
+
uv run pytest -m cuda
|
|
202
|
+
uv run python -m benchmarks.run --set cuda
|
|
203
|
+
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "vsparse"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.6.0"
|
|
4
4
|
description = "Value-Compressed Sparse Column/Row (VCSC/VCSR) arrays, with optional AnnData integration"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.12"
|
|
@@ -17,6 +17,7 @@ classifiers = [
|
|
|
17
17
|
"Topic :: Scientific/Engineering :: Bio-Informatics",
|
|
18
18
|
"Programming Language :: Python :: 3.12",
|
|
19
19
|
"Programming Language :: Python :: 3.13",
|
|
20
|
+
"Programming Language :: Python :: 3.14",
|
|
20
21
|
]
|
|
21
22
|
dependencies = [
|
|
22
23
|
"numpy>=2.0",
|
|
@@ -24,6 +25,7 @@ dependencies = [
|
|
|
24
25
|
"numba>=0.60",
|
|
25
26
|
"anndata>=0.13",
|
|
26
27
|
"hdf5plugin>=4.0",
|
|
28
|
+
"numcodecs>=0.13",
|
|
27
29
|
]
|
|
28
30
|
|
|
29
31
|
[[project.authors]]
|
|
@@ -37,6 +39,7 @@ Documentation = "https://meyer-lab.github.io/vsparse/"
|
|
|
37
39
|
Issues = "https://github.com/meyer-lab/vsparse/issues"
|
|
38
40
|
|
|
39
41
|
[project.optional-dependencies]
|
|
42
|
+
cuda = ["cupy-cuda13x[ctk]>=13.0, <15.0"]
|
|
40
43
|
docs = [
|
|
41
44
|
"sphinx>=7.0",
|
|
42
45
|
"furo>=2024.1.29",
|
|
@@ -52,6 +55,10 @@ dev = [
|
|
|
52
55
|
"ty>=0.0.1a1",
|
|
53
56
|
"hypothesis>=6.100",
|
|
54
57
|
"codespell>=2.3",
|
|
58
|
+
"pytest-memray>=1.11.0",
|
|
59
|
+
"vulture>=2.16",
|
|
60
|
+
"radon>=6.0.1",
|
|
61
|
+
"xenon>=0.9.3",
|
|
55
62
|
]
|
|
56
63
|
|
|
57
64
|
[build-system]
|
|
@@ -90,9 +97,16 @@ ignore-words-list = "coo"
|
|
|
90
97
|
[tool.ty.environment]
|
|
91
98
|
python-version = "3.12"
|
|
92
99
|
|
|
100
|
+
[tool.ty.analysis]
|
|
101
|
+
allowed-unresolved-imports = [
|
|
102
|
+
"cupy",
|
|
103
|
+
"cupyx.**",
|
|
104
|
+
]
|
|
105
|
+
|
|
93
106
|
[tool.pytest.ini_options]
|
|
94
107
|
testpaths = ["tests"]
|
|
95
108
|
addopts = "-ra"
|
|
109
|
+
markers = ["cuda: requires CuPy and an NVIDIA GPU"]
|
|
96
110
|
|
|
97
111
|
[tool.coverage.run]
|
|
98
112
|
source = ["src/vsparse"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "vsparse"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.6.0"
|
|
4
4
|
description = "Value-Compressed Sparse Column/Row (VCSC/VCSR) arrays, with optional AnnData integration"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [
|
|
@@ -15,6 +15,7 @@ classifiers = [
|
|
|
15
15
|
"Topic :: Scientific/Engineering :: Bio-Informatics",
|
|
16
16
|
"Programming Language :: Python :: 3.12",
|
|
17
17
|
"Programming Language :: Python :: 3.13",
|
|
18
|
+
"Programming Language :: Python :: 3.14",
|
|
18
19
|
]
|
|
19
20
|
dependencies = [
|
|
20
21
|
"numpy>=2.0",
|
|
@@ -22,6 +23,7 @@ dependencies = [
|
|
|
22
23
|
"numba>=0.60",
|
|
23
24
|
"anndata>=0.13",
|
|
24
25
|
"hdf5plugin>=4.0",
|
|
26
|
+
"numcodecs>=0.13",
|
|
25
27
|
]
|
|
26
28
|
|
|
27
29
|
[project.urls]
|
|
@@ -31,6 +33,11 @@ Documentation = "https://meyer-lab.github.io/vsparse/"
|
|
|
31
33
|
Issues = "https://github.com/meyer-lab/vsparse/issues"
|
|
32
34
|
|
|
33
35
|
[project.optional-dependencies]
|
|
36
|
+
# CUDA support (`vsparse._cuda`). Kept an opt-in extra because the wheel is
|
|
37
|
+
# ~1 GB and useless without an NVIDIA GPU; CI's CPU jobs pass `--no-extra cuda`.
|
|
38
|
+
cuda = [
|
|
39
|
+
"cupy-cuda13x[ctk]>=13.0, <15.0",
|
|
40
|
+
]
|
|
34
41
|
docs = [
|
|
35
42
|
"sphinx>=7.0",
|
|
36
43
|
"furo>=2024.1.29",
|
|
@@ -46,6 +53,10 @@ dev = [
|
|
|
46
53
|
"ty>=0.0.1a1",
|
|
47
54
|
"hypothesis>=6.100",
|
|
48
55
|
"codespell>=2.3",
|
|
56
|
+
"pytest-memray>=1.11.0",
|
|
57
|
+
"vulture>=2.16",
|
|
58
|
+
"radon>=6.0.1",
|
|
59
|
+
"xenon>=0.9.3",
|
|
49
60
|
]
|
|
50
61
|
|
|
51
62
|
[build-system]
|
|
@@ -70,9 +81,18 @@ ignore-words-list = "coo"
|
|
|
70
81
|
[tool.ty.environment]
|
|
71
82
|
python-version = "3.12"
|
|
72
83
|
|
|
84
|
+
[tool.ty.analysis]
|
|
85
|
+
# CuPy is an optional extra; the lint job syncs without it.
|
|
86
|
+
allowed-unresolved-imports = ["cupy", "cupyx.**"]
|
|
87
|
+
|
|
73
88
|
[tool.pytest.ini_options]
|
|
74
89
|
testpaths = ["tests"]
|
|
75
90
|
addopts = "-ra"
|
|
91
|
+
markers = [
|
|
92
|
+
# tests/test_cuda.py skips itself without a device, so the marker is for
|
|
93
|
+
# selecting (`-m cuda`) or excluding (`-m 'not cuda'`) the GPU suite.
|
|
94
|
+
"cuda: requires CuPy and an NVIDIA GPU",
|
|
95
|
+
]
|
|
76
96
|
|
|
77
97
|
[tool.coverage.run]
|
|
78
98
|
source = ["src/vsparse"]
|
|
@@ -9,22 +9,26 @@ AnnData subclass that holds a VCSC/VCSR array as ``X`` directly.
|
|
|
9
9
|
from vsparse._anndata import from_anndata, to_layer
|
|
10
10
|
from vsparse._anndata_class import VCSCAnnData
|
|
11
11
|
from vsparse._base import VCSCArray, VCSRArray
|
|
12
|
+
from vsparse._cuda import CudaNormalizedView, cuda_is_available
|
|
12
13
|
from vsparse._norm_common import RECIPES, Recipe
|
|
13
|
-
from vsparse._rapid_load import
|
|
14
|
+
from vsparse._rapid_load import load_packed
|
|
15
|
+
from vsparse._stats import VCSStats
|
|
14
16
|
from vsparse._vcs_norm import VCSCArrayNormalized, VCSRArrayNormalized
|
|
15
17
|
|
|
16
18
|
__all__ = [
|
|
17
19
|
"RECIPES",
|
|
20
|
+
"CudaNormalizedView",
|
|
18
21
|
"Recipe",
|
|
19
22
|
"VCSCAnnData",
|
|
20
23
|
"VCSCArray",
|
|
21
24
|
"VCSCArrayNormalized",
|
|
22
25
|
"VCSRArray",
|
|
23
26
|
"VCSRArrayNormalized",
|
|
27
|
+
"VCSStats",
|
|
28
|
+
"cuda_is_available",
|
|
24
29
|
"from_anndata",
|
|
25
|
-
"load_and_normalize",
|
|
26
30
|
"load_packed",
|
|
27
31
|
"to_layer",
|
|
28
32
|
]
|
|
29
33
|
|
|
30
|
-
__version__ = "0.
|
|
34
|
+
__version__ = "0.6.0"
|