pycellpack 0.1.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.
Files changed (287) hide show
  1. pycellpack-0.1.0/Cargo.lock +372 -0
  2. pycellpack-0.1.0/Cargo.toml +35 -0
  3. pycellpack-0.1.0/LICENSE +21 -0
  4. pycellpack-0.1.0/PKG-INFO +175 -0
  5. pycellpack-0.1.0/README.md +133 -0
  6. pycellpack-0.1.0/crates/cellpack/Cargo.toml +43 -0
  7. pycellpack-0.1.0/crates/cellpack/LICENSE +21 -0
  8. pycellpack-0.1.0/crates/cellpack/README.md +133 -0
  9. pycellpack-0.1.0/crates/cellpack/examples/README.md +130 -0
  10. pycellpack-0.1.0/crates/cellpack/examples/belady.rs +86 -0
  11. pycellpack-0.1.0/crates/cellpack/examples/bench/codec.rs +435 -0
  12. pycellpack-0.1.0/crates/cellpack/examples/bench/costs/store.rs +626 -0
  13. pycellpack-0.1.0/crates/cellpack/examples/bench/encode.rs +219 -0
  14. pycellpack-0.1.0/crates/cellpack/examples/bench/main.rs +1040 -0
  15. pycellpack-0.1.0/crates/cellpack/examples/bench/process/sampling.rs +409 -0
  16. pycellpack-0.1.0/crates/cellpack/include/access_fn_cabi.h +33 -0
  17. pycellpack-0.1.0/crates/cellpack/include/process_fn_cabi.h +74 -0
  18. pycellpack-0.1.0/crates/cellpack/src/error.rs +74 -0
  19. pycellpack-0.1.0/crates/cellpack/src/format/cpk.rs +352 -0
  20. pycellpack-0.1.0/crates/cellpack/src/format.rs +1022 -0
  21. pycellpack-0.1.0/crates/cellpack/src/lib.rs +72 -0
  22. pycellpack-0.1.0/crates/cellpack/src/loader/accesses.rs +533 -0
  23. pycellpack-0.1.0/crates/cellpack/src/loader/catalog.rs +555 -0
  24. pycellpack-0.1.0/crates/cellpack/src/loader/config.rs +221 -0
  25. pycellpack-0.1.0/crates/cellpack/src/loader/convert.rs +396 -0
  26. pycellpack-0.1.0/crates/cellpack/src/loader/error.rs +66 -0
  27. pycellpack-0.1.0/crates/cellpack/src/loader/exec/io.rs +266 -0
  28. pycellpack-0.1.0/crates/cellpack/src/loader/exec/mod.rs +511 -0
  29. pycellpack-0.1.0/crates/cellpack/src/loader/exec/progress.rs +206 -0
  30. pycellpack-0.1.0/crates/cellpack/src/loader/exec/worker.rs +1241 -0
  31. pycellpack-0.1.0/crates/cellpack/src/loader/loader.rs +404 -0
  32. pycellpack-0.1.0/crates/cellpack/src/loader/memory.rs +90 -0
  33. pycellpack-0.1.0/crates/cellpack/src/loader/mod.rs +46 -0
  34. pycellpack-0.1.0/crates/cellpack/src/loader/planring.rs +425 -0
  35. pycellpack-0.1.0/crates/cellpack/src/loader/process.rs +287 -0
  36. pycellpack-0.1.0/crates/cellpack/src/loader/resources.rs +97 -0
  37. pycellpack-0.1.0/crates/cellpack/src/loader/ring.rs +1009 -0
  38. pycellpack-0.1.0/crates/cellpack/src/loader/rows.rs +152 -0
  39. pycellpack-0.1.0/crates/cellpack/src/loader/schema.rs +574 -0
  40. pycellpack-0.1.0/crates/cellpack/src/opt/compile.rs +159 -0
  41. pycellpack-0.1.0/crates/cellpack/src/opt/defaults.rs +139 -0
  42. pycellpack-0.1.0/crates/cellpack/src/opt/engine.rs +1823 -0
  43. pycellpack-0.1.0/crates/cellpack/src/opt/mod.rs +34 -0
  44. pycellpack-0.1.0/crates/cellpack/src/opt/model.rs +539 -0
  45. pycellpack-0.1.0/crates/cellpack/src/opt/occupancy.rs +318 -0
  46. pycellpack-0.1.0/crates/cellpack/src/opt/plan.rs +857 -0
  47. pycellpack-0.1.0/crates/cellpack/src/opt/price.rs +296 -0
  48. pycellpack-0.1.0/crates/cellpack/src/opt/records.rs +225 -0
  49. pycellpack-0.1.0/crates/cellpack/src/opt/reference.rs +307 -0
  50. pycellpack-0.1.0/crates/cellpack/src/prof/mod.rs +716 -0
  51. pycellpack-0.1.0/crates/cellpack/src/runtime.rs +184 -0
  52. pycellpack-0.1.0/crates/cellpack/src/scans/bits.rs +185 -0
  53. pycellpack-0.1.0/crates/cellpack/src/scans/coding.rs +24 -0
  54. pycellpack-0.1.0/crates/cellpack/src/scans/decode.rs +1314 -0
  55. pycellpack-0.1.0/crates/cellpack/src/scans/encode/input.rs +175 -0
  56. pycellpack-0.1.0/crates/cellpack/src/scans/encode/mod.rs +572 -0
  57. pycellpack-0.1.0/crates/cellpack/src/scans/encode/model.rs +609 -0
  58. pycellpack-0.1.0/crates/cellpack/src/scans/encode/prep.rs +815 -0
  59. pycellpack-0.1.0/crates/cellpack/src/scans/encode/record.rs +328 -0
  60. pycellpack-0.1.0/crates/cellpack/src/scans/encode/scratch.rs +238 -0
  61. pycellpack-0.1.0/crates/cellpack/src/scans/kernels/boundaries.rs +25 -0
  62. pycellpack-0.1.0/crates/cellpack/src/scans/kernels/encode_x86.rs +588 -0
  63. pycellpack-0.1.0/crates/cellpack/src/scans/kernels/map_avx2.rs +696 -0
  64. pycellpack-0.1.0/crates/cellpack/src/scans/kernels/mapping_policy.rs +38 -0
  65. pycellpack-0.1.0/crates/cellpack/src/scans/kernels/mod.rs +1088 -0
  66. pycellpack-0.1.0/crates/cellpack/src/scans/kernels/typed.rs +255 -0
  67. pycellpack-0.1.0/crates/cellpack/src/scans/kernels/typed_tests.rs +288 -0
  68. pycellpack-0.1.0/crates/cellpack/src/scans/kernels/x86.rs +1760 -0
  69. pycellpack-0.1.0/crates/cellpack/src/scans/map/mod.rs +357 -0
  70. pycellpack-0.1.0/crates/cellpack/src/scans/map/route.rs +476 -0
  71. pycellpack-0.1.0/crates/cellpack/src/scans/map/slots.rs +401 -0
  72. pycellpack-0.1.0/crates/cellpack/src/scans/mod.rs +72 -0
  73. pycellpack-0.1.0/crates/cellpack/src/scans/pack.rs +227 -0
  74. pycellpack-0.1.0/crates/cellpack/src/scans/rans.rs +446 -0
  75. pycellpack-0.1.0/crates/cellpack/src/scans/requirements.rs +27 -0
  76. pycellpack-0.1.0/crates/cellpack/src/scans/symbol.rs +114 -0
  77. pycellpack-0.1.0/crates/cellpack/src/scans/tables.rs +258 -0
  78. pycellpack-0.1.0/crates/cellpack/src/scans/types.rs +597 -0
  79. pycellpack-0.1.0/crates/cellpack/src/scans/workspace.rs +166 -0
  80. pycellpack-0.1.0/crates/cellpack/src/store/mod.rs +14 -0
  81. pycellpack-0.1.0/crates/cellpack/src/store/panel.rs +139 -0
  82. pycellpack-0.1.0/crates/cellpack/src/store/reader.rs +256 -0
  83. pycellpack-0.1.0/crates/cellpack/src/store/reads.rs +106 -0
  84. pycellpack-0.1.0/crates/cellpack/src/store/selection.rs +684 -0
  85. pycellpack-0.1.0/crates/cellpack/src/store/writer.rs +441 -0
  86. pycellpack-0.1.0/crates/cellpack/src/unchecked.rs +34 -0
  87. pycellpack-0.1.0/crates/cellpack/tests/access_fn.rs +50 -0
  88. pycellpack-0.1.0/crates/cellpack/tests/boundaries.rs +262 -0
  89. pycellpack-0.1.0/crates/cellpack/tests/corrupt.rs +131 -0
  90. pycellpack-0.1.0/crates/cellpack/tests/interfaces.rs +100 -0
  91. pycellpack-0.1.0/crates/cellpack/tests/invariants.rs +98 -0
  92. pycellpack-0.1.0/crates/cellpack/tests/loading.rs +839 -0
  93. pycellpack-0.1.0/crates/cellpack/tests/modes.rs +322 -0
  94. pycellpack-0.1.0/crates/cellpack/tests/outputs.rs +685 -0
  95. pycellpack-0.1.0/crates/cellpack/tests/roundtrip.rs +951 -0
  96. pycellpack-0.1.0/crates/cellpack/tests/store.rs +548 -0
  97. pycellpack-0.1.0/crates/pycellpack/Cargo.toml +24 -0
  98. pycellpack-0.1.0/crates/pycellpack/src/buffers.rs +301 -0
  99. pycellpack-0.1.0/crates/pycellpack/src/errors.rs +52 -0
  100. pycellpack-0.1.0/crates/pycellpack/src/format.rs +80 -0
  101. pycellpack-0.1.0/crates/pycellpack/src/lib.rs +70 -0
  102. pycellpack-0.1.0/crates/pycellpack/src/loader/accesses.rs +245 -0
  103. pycellpack-0.1.0/crates/pycellpack/src/loader/config.rs +44 -0
  104. pycellpack-0.1.0/crates/pycellpack/src/loader/loader.rs +138 -0
  105. pycellpack-0.1.0/crates/pycellpack/src/loader/mod.rs +33 -0
  106. pycellpack-0.1.0/crates/pycellpack/src/loader/process.rs +92 -0
  107. pycellpack-0.1.0/crates/pycellpack/src/loader/ring.rs +774 -0
  108. pycellpack-0.1.0/crates/pycellpack/src/loader/run.rs +386 -0
  109. pycellpack-0.1.0/crates/pycellpack/src/loader/schema.rs +107 -0
  110. pycellpack-0.1.0/crates/pycellpack/src/loader/source.rs +196 -0
  111. pycellpack-0.1.0/crates/pycellpack/src/loader/stats.rs +90 -0
  112. pycellpack-0.1.0/crates/pycellpack/src/opt/args.rs +155 -0
  113. pycellpack-0.1.0/crates/pycellpack/src/opt/defaults.rs +55 -0
  114. pycellpack-0.1.0/crates/pycellpack/src/opt/mod.rs +18 -0
  115. pycellpack-0.1.0/crates/pycellpack/src/opt/plan.rs +229 -0
  116. pycellpack-0.1.0/crates/pycellpack/src/scans/decoder.rs +299 -0
  117. pycellpack-0.1.0/crates/pycellpack/src/scans/encode.rs +365 -0
  118. pycellpack-0.1.0/crates/pycellpack/src/scans/mod.rs +138 -0
  119. pycellpack-0.1.0/crates/pycellpack/src/scans/parts.rs +386 -0
  120. pycellpack-0.1.0/crates/pycellpack/src/scans/tables.rs +467 -0
  121. pycellpack-0.1.0/crates/pycellpack/src/store.rs +530 -0
  122. pycellpack-0.1.0/docs/cellpack/README.md +55 -0
  123. pycellpack-0.1.0/docs/cellpack/abi.md +389 -0
  124. pycellpack-0.1.0/docs/cellpack/accesses.md +106 -0
  125. pycellpack-0.1.0/docs/cellpack/api-examples.md +56 -0
  126. pycellpack-0.1.0/docs/cellpack/api.md +68 -0
  127. pycellpack-0.1.0/docs/cellpack/architecture.md +93 -0
  128. pycellpack-0.1.0/docs/cellpack/codecs.md +154 -0
  129. pycellpack-0.1.0/docs/cellpack/concepts.md +63 -0
  130. pycellpack-0.1.0/docs/cellpack/contracts.md +157 -0
  131. pycellpack-0.1.0/docs/cellpack/contributing.md +210 -0
  132. pycellpack-0.1.0/docs/cellpack/data-contracts.md +241 -0
  133. pycellpack-0.1.0/docs/cellpack/data-sources.md +104 -0
  134. pycellpack-0.1.0/docs/cellpack/format.md +189 -0
  135. pycellpack-0.1.0/docs/cellpack/index.md +13 -0
  136. pycellpack-0.1.0/docs/cellpack/installation.md +77 -0
  137. pycellpack-0.1.0/docs/cellpack/loading.md +150 -0
  138. pycellpack-0.1.0/docs/cellpack/overview.md +49 -0
  139. pycellpack-0.1.0/docs/cellpack/performance.md +102 -0
  140. pycellpack-0.1.0/docs/cellpack/planning.md +160 -0
  141. pycellpack-0.1.0/docs/cellpack/playground/README.md +116 -0
  142. pycellpack-0.1.0/docs/cellpack/process-functions.md +115 -0
  143. pycellpack-0.1.0/docs/cellpack/profiling.md +170 -0
  144. pycellpack-0.1.0/docs/cellpack/python/api/access-functions.md +138 -0
  145. pycellpack-0.1.0/docs/cellpack/python/api/anndata.md +158 -0
  146. pycellpack-0.1.0/docs/cellpack/python/api/codecs.md +192 -0
  147. pycellpack-0.1.0/docs/cellpack/python/api/dataloader.md +131 -0
  148. pycellpack-0.1.0/docs/cellpack/python/api/distributed.md +138 -0
  149. pycellpack-0.1.0/docs/cellpack/python/api/index.md +55 -0
  150. pycellpack-0.1.0/docs/cellpack/python/api/loader.md +176 -0
  151. pycellpack-0.1.0/docs/cellpack/python/api/planning.md +159 -0
  152. pycellpack-0.1.0/docs/cellpack/python/api/process-functions.md +199 -0
  153. pycellpack-0.1.0/docs/cellpack/python/api/rings.md +197 -0
  154. pycellpack-0.1.0/docs/cellpack/python/api/statistics.md +185 -0
  155. pycellpack-0.1.0/docs/cellpack/python/api/storage.md +188 -0
  156. pycellpack-0.1.0/docs/cellpack/python/docs/access-functions.md +142 -0
  157. pycellpack-0.1.0/docs/cellpack/python/docs/alignment.md +66 -0
  158. pycellpack-0.1.0/docs/cellpack/python/docs/anndata.md +140 -0
  159. pycellpack-0.1.0/docs/cellpack/python/docs/codecs.md +122 -0
  160. pycellpack-0.1.0/docs/cellpack/python/docs/dataloader.md +139 -0
  161. pycellpack-0.1.0/docs/cellpack/python/docs/distributed.md +139 -0
  162. pycellpack-0.1.0/docs/cellpack/python/docs/index.md +33 -0
  163. pycellpack-0.1.0/docs/cellpack/python/docs/installation.md +33 -0
  164. pycellpack-0.1.0/docs/cellpack/python/docs/native-loader.md +165 -0
  165. pycellpack-0.1.0/docs/cellpack/python/docs/planning.md +150 -0
  166. pycellpack-0.1.0/docs/cellpack/python/docs/process-functions.md +135 -0
  167. pycellpack-0.1.0/docs/cellpack/python/docs/quickstart.md +78 -0
  168. pycellpack-0.1.0/docs/cellpack/python/docs/storage.md +161 -0
  169. pycellpack-0.1.0/docs/cellpack/python/index.md +9 -0
  170. pycellpack-0.1.0/docs/cellpack/python/training/dataloader.md +57 -0
  171. pycellpack-0.1.0/docs/cellpack/python/training/index.md +13 -0
  172. pycellpack-0.1.0/docs/cellpack/python/training/integration.md +77 -0
  173. pycellpack-0.1.0/docs/cellpack/python/training/process-functions.md +61 -0
  174. pycellpack-0.1.0/docs/cellpack/quickstart.md +43 -0
  175. pycellpack-0.1.0/docs/cellpack/reference-errors.md +106 -0
  176. pycellpack-0.1.0/docs/cellpack/reference-format.md +119 -0
  177. pycellpack-0.1.0/docs/cellpack/reference-loader.md +204 -0
  178. pycellpack-0.1.0/docs/cellpack/reference-opt.md +180 -0
  179. pycellpack-0.1.0/docs/cellpack/reference-prof.md +119 -0
  180. pycellpack-0.1.0/docs/cellpack/reference-runtime.md +87 -0
  181. pycellpack-0.1.0/docs/cellpack/reference-scans.md +204 -0
  182. pycellpack-0.1.0/docs/cellpack/reference-store.md +143 -0
  183. pycellpack-0.1.0/docs/cellpack/report.md +13 -0
  184. pycellpack-0.1.0/docs/cellpack/rust/index.md +9 -0
  185. pycellpack-0.1.0/docs/cellpack/storage.md +156 -0
  186. pycellpack-0.1.0/docs/cellpack/troubleshooting.md +87 -0
  187. pycellpack-0.1.0/docs/releasing.md +63 -0
  188. pycellpack-0.1.0/pyproject.toml +69 -0
  189. pycellpack-0.1.0/src/pycellpack/__init__.py +62 -0
  190. pycellpack-0.1.0/src/pycellpack/_cellpack.pyi +548 -0
  191. pycellpack-0.1.0/src/pycellpack/_workers.py +64 -0
  192. pycellpack-0.1.0/src/pycellpack/anndata/__init__.py +25 -0
  193. pycellpack-0.1.0/src/pycellpack/anndata/_core.py +437 -0
  194. pycellpack-0.1.0/src/pycellpack/anndata/_dispatch.py +34 -0
  195. pycellpack-0.1.0/src/pycellpack/cellpack/__init__.py +32 -0
  196. pycellpack-0.1.0/src/pycellpack/cellpack/_arrays.py +92 -0
  197. pycellpack-0.1.0/src/pycellpack/cellpack/_file.py +525 -0
  198. pycellpack-0.1.0/src/pycellpack/cellpack/_store.py +518 -0
  199. pycellpack-0.1.0/src/pycellpack/cellpack/_types.py +75 -0
  200. pycellpack-0.1.0/src/pycellpack/cellpack/format.py +35 -0
  201. pycellpack-0.1.0/src/pycellpack/cellpack/scans/__init__.py +120 -0
  202. pycellpack-0.1.0/src/pycellpack/cellpack/scans/_codec.py +452 -0
  203. pycellpack-0.1.0/src/pycellpack/cellpack/scans/_mapping.py +154 -0
  204. pycellpack-0.1.0/src/pycellpack/cellpack/scans/_prepared.py +140 -0
  205. pycellpack-0.1.0/src/pycellpack/cellpack/scans/_types.py +418 -0
  206. pycellpack-0.1.0/src/pycellpack/cellpack/selection.py +92 -0
  207. pycellpack-0.1.0/src/pycellpack/dataloader/__init__.py +14 -0
  208. pycellpack-0.1.0/src/pycellpack/dataloader/_accesses.py +59 -0
  209. pycellpack-0.1.0/src/pycellpack/dataloader/_dataset.py +101 -0
  210. pycellpack-0.1.0/src/pycellpack/dataloader/_loader.py +247 -0
  211. pycellpack-0.1.0/src/pycellpack/dataloader/_transfer.py +109 -0
  212. pycellpack-0.1.0/src/pycellpack/io/__init__.py +56 -0
  213. pycellpack-0.1.0/src/pycellpack/io/_anndata.py +657 -0
  214. pycellpack-0.1.0/src/pycellpack/io/_cpk.py +174 -0
  215. pycellpack-0.1.0/src/pycellpack/loader/__init__.py +115 -0
  216. pycellpack-0.1.0/src/pycellpack/loader/_accesses.py +41 -0
  217. pycellpack-0.1.0/src/pycellpack/loader/_config.py +209 -0
  218. pycellpack-0.1.0/src/pycellpack/loader/_distributed.py +405 -0
  219. pycellpack-0.1.0/src/pycellpack/loader/_loader.py +296 -0
  220. pycellpack-0.1.0/src/pycellpack/loader/_producer.py +85 -0
  221. pycellpack-0.1.0/src/pycellpack/loader/_ring.py +14 -0
  222. pycellpack-0.1.0/src/pycellpack/loader/_schema.py +132 -0
  223. pycellpack-0.1.0/src/pycellpack/loader/_shared.py +152 -0
  224. pycellpack-0.1.0/src/pycellpack/loader/_source.py +259 -0
  225. pycellpack-0.1.0/src/pycellpack/loader/_stats.py +218 -0
  226. pycellpack-0.1.0/src/pycellpack/loader/_transport.py +303 -0
  227. pycellpack-0.1.0/src/pycellpack/loader/access_fn/__init__.py +6 -0
  228. pycellpack-0.1.0/src/pycellpack/loader/access_fn/_access_fn.py +186 -0
  229. pycellpack-0.1.0/src/pycellpack/loader/access_fn/_numba.py +25 -0
  230. pycellpack-0.1.0/src/pycellpack/loader/access_fn/include/access_fn_cabi.h +33 -0
  231. pycellpack-0.1.0/src/pycellpack/loader/costs/__init__.py +38 -0
  232. pycellpack-0.1.0/src/pycellpack/loader/costs/__main__.py +110 -0
  233. pycellpack-0.1.0/src/pycellpack/loader/costs/_calibrate.py +396 -0
  234. pycellpack-0.1.0/src/pycellpack/loader/costs/_code.py +141 -0
  235. pycellpack-0.1.0/src/pycellpack/loader/costs/_collect.py +81 -0
  236. pycellpack-0.1.0/src/pycellpack/loader/costs/_defaults.py +38 -0
  237. pycellpack-0.1.0/src/pycellpack/loader/costs/_fit.py +343 -0
  238. pycellpack-0.1.0/src/pycellpack/loader/costs/_keys.py +184 -0
  239. pycellpack-0.1.0/src/pycellpack/loader/costs/_resolve.py +145 -0
  240. pycellpack-0.1.0/src/pycellpack/loader/costs/_steady.py +228 -0
  241. pycellpack-0.1.0/src/pycellpack/loader/costs/_store.py +125 -0
  242. pycellpack-0.1.0/src/pycellpack/loader/opt/__init__.py +40 -0
  243. pycellpack-0.1.0/src/pycellpack/loader/opt/_config.py +271 -0
  244. pycellpack-0.1.0/src/pycellpack/loader/opt/_plan.py +144 -0
  245. pycellpack-0.1.0/src/pycellpack/loader/opt/_stats.py +154 -0
  246. pycellpack-0.1.0/src/pycellpack/loader/process_fn/__init__.py +55 -0
  247. pycellpack-0.1.0/src/pycellpack/loader/process_fn/_build.py +537 -0
  248. pycellpack-0.1.0/src/pycellpack/loader/process_fn/_numba.py +131 -0
  249. pycellpack-0.1.0/src/pycellpack/loader/process_fn/_output.py +84 -0
  250. pycellpack-0.1.0/src/pycellpack/loader/process_fn/_process_fn.py +293 -0
  251. pycellpack-0.1.0/src/pycellpack/loader/process_fn/include/process_fn_cabi.h +74 -0
  252. pycellpack-0.1.0/src/pycellpack/loader/process_fn/include/template/common.hpp +234 -0
  253. pycellpack-0.1.0/src/pycellpack/loader/process_fn/include/template/geneformer.hpp +91 -0
  254. pycellpack-0.1.0/src/pycellpack/loader/process_fn/include/template/scgpt.hpp +139 -0
  255. pycellpack-0.1.0/src/pycellpack/loader/process_fn/include/template/state_se.hpp +198 -0
  256. pycellpack-0.1.0/src/pycellpack/loader/process_fn/include/template/uce.hpp +160 -0
  257. pycellpack-0.1.0/src/pycellpack/loader/process_fn/presets.py +261 -0
  258. pycellpack-0.1.0/src/pycellpack/py.typed +0 -0
  259. pycellpack-0.1.0/src/tests/conftest.py +26 -0
  260. pycellpack-0.1.0/src/tests/test_access_fn.py +136 -0
  261. pycellpack-0.1.0/src/tests/test_anndata.py +400 -0
  262. pycellpack-0.1.0/src/tests/test_cellpack.py +309 -0
  263. pycellpack-0.1.0/src/tests/test_consumers.py +151 -0
  264. pycellpack-0.1.0/src/tests/test_costs.py +312 -0
  265. pycellpack-0.1.0/src/tests/test_cuda_transfer.py +47 -0
  266. pycellpack-0.1.0/src/tests/test_dataloader.py +363 -0
  267. pycellpack-0.1.0/src/tests/test_distributed.py +176 -0
  268. pycellpack-0.1.0/src/tests/test_fancy_io.py +230 -0
  269. pycellpack-0.1.0/src/tests/test_io.py +83 -0
  270. pycellpack-0.1.0/src/tests/test_kernel.py +171 -0
  271. pycellpack-0.1.0/src/tests/test_lanes_contract.py +96 -0
  272. pycellpack-0.1.0/src/tests/test_loader_api.py +525 -0
  273. pycellpack-0.1.0/src/tests/test_outputs.py +155 -0
  274. pycellpack-0.1.0/src/tests/test_parallel_outputs.py +71 -0
  275. pycellpack-0.1.0/src/tests/test_plan_execution.py +105 -0
  276. pycellpack-0.1.0/src/tests/test_prepared.py +149 -0
  277. pycellpack-0.1.0/src/tests/test_process_build.py +221 -0
  278. pycellpack-0.1.0/src/tests/test_process_output.py +84 -0
  279. pycellpack-0.1.0/src/tests/test_process_presets.py +346 -0
  280. pycellpack-0.1.0/src/tests/test_producer_cleanup.py +249 -0
  281. pycellpack-0.1.0/src/tests/test_scans.py +370 -0
  282. pycellpack-0.1.0/src/tests/test_store.py +190 -0
  283. pycellpack-0.1.0/src/tests/test_store_lifecycle.py +161 -0
  284. pycellpack-0.1.0/src/tests/test_subsystems.py +175 -0
  285. pycellpack-0.1.0/src/tests/test_transport_lifecycle.py +141 -0
  286. pycellpack-0.1.0/src/tests/test_view_contracts.py +42 -0
  287. pycellpack-0.1.0/src/tests/test_workers.py +27 -0
@@ -0,0 +1,372 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "autocfg"
7
+ version = "1.5.1"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
10
+
11
+ [[package]]
12
+ name = "bitflags"
13
+ version = "2.13.1"
14
+ source = "registry+https://github.com/rust-lang/crates.io-index"
15
+ checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da"
16
+
17
+ [[package]]
18
+ name = "cellpack"
19
+ version = "0.1.0"
20
+ dependencies = [
21
+ "crossbeam-queue",
22
+ "crossbeam-utils",
23
+ "io-uring",
24
+ "libc",
25
+ "serde",
26
+ "serde_json",
27
+ "thiserror",
28
+ ]
29
+
30
+ [[package]]
31
+ name = "cfg-if"
32
+ version = "1.0.5"
33
+ source = "registry+https://github.com/rust-lang/crates.io-index"
34
+ checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
35
+
36
+ [[package]]
37
+ name = "crossbeam-queue"
38
+ version = "0.3.14"
39
+ source = "registry+https://github.com/rust-lang/crates.io-index"
40
+ checksum = "03e8bd762f7479489c70ed6c768ddca99d7296857de437a68dcb2a94365b3fae"
41
+ dependencies = [
42
+ "crossbeam-utils",
43
+ ]
44
+
45
+ [[package]]
46
+ name = "crossbeam-utils"
47
+ version = "0.8.23"
48
+ source = "registry+https://github.com/rust-lang/crates.io-index"
49
+ checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6"
50
+
51
+ [[package]]
52
+ name = "heck"
53
+ version = "0.5.0"
54
+ source = "registry+https://github.com/rust-lang/crates.io-index"
55
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
56
+
57
+ [[package]]
58
+ name = "io-uring"
59
+ version = "0.7.15"
60
+ source = "registry+https://github.com/rust-lang/crates.io-index"
61
+ checksum = "ed3bd0ecfbb87805f538bb7b32e5239ca0763890c623e349860ecba69469f2bb"
62
+ dependencies = [
63
+ "bitflags",
64
+ "cfg-if",
65
+ "libc",
66
+ ]
67
+
68
+ [[package]]
69
+ name = "itoa"
70
+ version = "1.0.18"
71
+ source = "registry+https://github.com/rust-lang/crates.io-index"
72
+ checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
73
+
74
+ [[package]]
75
+ name = "libc"
76
+ version = "0.2.189"
77
+ source = "registry+https://github.com/rust-lang/crates.io-index"
78
+ checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
79
+
80
+ [[package]]
81
+ name = "matrixmultiply"
82
+ version = "0.3.11"
83
+ source = "registry+https://github.com/rust-lang/crates.io-index"
84
+ checksum = "3f607c237553f086e7043417a51df26b2eb899d3caff94e6a67592ff992fedc7"
85
+ dependencies = [
86
+ "autocfg",
87
+ "rawpointer",
88
+ ]
89
+
90
+ [[package]]
91
+ name = "memchr"
92
+ version = "2.8.3"
93
+ source = "registry+https://github.com/rust-lang/crates.io-index"
94
+ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
95
+
96
+ [[package]]
97
+ name = "ndarray"
98
+ version = "0.17.2"
99
+ source = "registry+https://github.com/rust-lang/crates.io-index"
100
+ checksum = "520080814a7a6b4a6e9070823bb24b4531daac8c4627e08ba5de8c5ef2f2752d"
101
+ dependencies = [
102
+ "matrixmultiply",
103
+ "num-complex",
104
+ "num-integer",
105
+ "num-traits",
106
+ "portable-atomic",
107
+ "portable-atomic-util",
108
+ "rawpointer",
109
+ ]
110
+
111
+ [[package]]
112
+ name = "num-complex"
113
+ version = "0.4.6"
114
+ source = "registry+https://github.com/rust-lang/crates.io-index"
115
+ checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"
116
+ dependencies = [
117
+ "num-traits",
118
+ ]
119
+
120
+ [[package]]
121
+ name = "num-integer"
122
+ version = "0.1.47"
123
+ source = "registry+https://github.com/rust-lang/crates.io-index"
124
+ checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b"
125
+ dependencies = [
126
+ "num-traits",
127
+ ]
128
+
129
+ [[package]]
130
+ name = "num-traits"
131
+ version = "0.2.19"
132
+ source = "registry+https://github.com/rust-lang/crates.io-index"
133
+ checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
134
+ dependencies = [
135
+ "autocfg",
136
+ ]
137
+
138
+ [[package]]
139
+ name = "numpy"
140
+ version = "0.29.0"
141
+ source = "registry+https://github.com/rust-lang/crates.io-index"
142
+ checksum = "6a5b15d63a5ff39e378daed0e1340d3a5964703ea9712eb09a0dc66fade996f4"
143
+ dependencies = [
144
+ "libc",
145
+ "ndarray",
146
+ "num-complex",
147
+ "num-integer",
148
+ "num-traits",
149
+ "pyo3",
150
+ "pyo3-build-config",
151
+ "rustc-hash",
152
+ ]
153
+
154
+ [[package]]
155
+ name = "once_cell"
156
+ version = "1.21.4"
157
+ source = "registry+https://github.com/rust-lang/crates.io-index"
158
+ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
159
+
160
+ [[package]]
161
+ name = "portable-atomic"
162
+ version = "1.15.0"
163
+ source = "registry+https://github.com/rust-lang/crates.io-index"
164
+ checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
165
+
166
+ [[package]]
167
+ name = "portable-atomic-util"
168
+ version = "0.2.8"
169
+ source = "registry+https://github.com/rust-lang/crates.io-index"
170
+ checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715"
171
+ dependencies = [
172
+ "portable-atomic",
173
+ ]
174
+
175
+ [[package]]
176
+ name = "proc-macro2"
177
+ version = "1.0.107"
178
+ source = "registry+https://github.com/rust-lang/crates.io-index"
179
+ checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
180
+ dependencies = [
181
+ "unicode-ident",
182
+ ]
183
+
184
+ [[package]]
185
+ name = "pycellpack"
186
+ version = "0.1.0"
187
+ dependencies = [
188
+ "cellpack",
189
+ "numpy",
190
+ "pyo3",
191
+ ]
192
+
193
+ [[package]]
194
+ name = "pyo3"
195
+ version = "0.29.2"
196
+ source = "registry+https://github.com/rust-lang/crates.io-index"
197
+ checksum = "4688ddedf473e32662b9b067670129a8afb8c18e351482c70d62ba4a88171e8b"
198
+ dependencies = [
199
+ "libc",
200
+ "once_cell",
201
+ "portable-atomic",
202
+ "pyo3-build-config",
203
+ "pyo3-ffi",
204
+ "pyo3-macros",
205
+ ]
206
+
207
+ [[package]]
208
+ name = "pyo3-build-config"
209
+ version = "0.29.2"
210
+ source = "registry+https://github.com/rust-lang/crates.io-index"
211
+ checksum = "f41027e41b4bd03f6e60f9f417fe24a6341a6bb744edd62b6f709f2a52ea30e9"
212
+ dependencies = [
213
+ "target-lexicon",
214
+ ]
215
+
216
+ [[package]]
217
+ name = "pyo3-ffi"
218
+ version = "0.29.2"
219
+ source = "registry+https://github.com/rust-lang/crates.io-index"
220
+ checksum = "e591a95526fead067432c3b3a33fc74770b87b1e04e73671090d9c2055a2b327"
221
+ dependencies = [
222
+ "libc",
223
+ "pyo3-build-config",
224
+ ]
225
+
226
+ [[package]]
227
+ name = "pyo3-macros"
228
+ version = "0.29.2"
229
+ source = "registry+https://github.com/rust-lang/crates.io-index"
230
+ checksum = "73225868fc1cd84eef2c3c230ddb91273bf1de46aeb8a4248da76d32a0924a1c"
231
+ dependencies = [
232
+ "proc-macro2",
233
+ "pyo3-macros-backend",
234
+ "quote",
235
+ "syn 2.0.119",
236
+ ]
237
+
238
+ [[package]]
239
+ name = "pyo3-macros-backend"
240
+ version = "0.29.2"
241
+ source = "registry+https://github.com/rust-lang/crates.io-index"
242
+ checksum = "571575aa3749fa6216757dd47d2a3e7ef360f329a40f0666a9fbd14889024952"
243
+ dependencies = [
244
+ "heck",
245
+ "proc-macro2",
246
+ "quote",
247
+ "syn 2.0.119",
248
+ ]
249
+
250
+ [[package]]
251
+ name = "quote"
252
+ version = "1.0.47"
253
+ source = "registry+https://github.com/rust-lang/crates.io-index"
254
+ checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
255
+ dependencies = [
256
+ "proc-macro2",
257
+ ]
258
+
259
+ [[package]]
260
+ name = "rawpointer"
261
+ version = "0.2.1"
262
+ source = "registry+https://github.com/rust-lang/crates.io-index"
263
+ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
264
+
265
+ [[package]]
266
+ name = "rustc-hash"
267
+ version = "2.1.3"
268
+ source = "registry+https://github.com/rust-lang/crates.io-index"
269
+ checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"
270
+
271
+ [[package]]
272
+ name = "serde"
273
+ version = "1.0.229"
274
+ source = "registry+https://github.com/rust-lang/crates.io-index"
275
+ checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
276
+ dependencies = [
277
+ "serde_core",
278
+ "serde_derive",
279
+ ]
280
+
281
+ [[package]]
282
+ name = "serde_core"
283
+ version = "1.0.229"
284
+ source = "registry+https://github.com/rust-lang/crates.io-index"
285
+ checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
286
+ dependencies = [
287
+ "serde_derive",
288
+ ]
289
+
290
+ [[package]]
291
+ name = "serde_derive"
292
+ version = "1.0.229"
293
+ source = "registry+https://github.com/rust-lang/crates.io-index"
294
+ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
295
+ dependencies = [
296
+ "proc-macro2",
297
+ "quote",
298
+ "syn 3.0.4",
299
+ ]
300
+
301
+ [[package]]
302
+ name = "serde_json"
303
+ version = "1.0.154"
304
+ source = "registry+https://github.com/rust-lang/crates.io-index"
305
+ checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6"
306
+ dependencies = [
307
+ "itoa",
308
+ "memchr",
309
+ "serde",
310
+ "serde_core",
311
+ "zmij",
312
+ ]
313
+
314
+ [[package]]
315
+ name = "syn"
316
+ version = "2.0.119"
317
+ source = "registry+https://github.com/rust-lang/crates.io-index"
318
+ checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
319
+ dependencies = [
320
+ "proc-macro2",
321
+ "quote",
322
+ "unicode-ident",
323
+ ]
324
+
325
+ [[package]]
326
+ name = "syn"
327
+ version = "3.0.4"
328
+ source = "registry+https://github.com/rust-lang/crates.io-index"
329
+ checksum = "e6275cddf4610d1775e6d1fe9469b2e77d0f39fd98fb7450901b821e0c53649f"
330
+ dependencies = [
331
+ "proc-macro2",
332
+ "quote",
333
+ "unicode-ident",
334
+ ]
335
+
336
+ [[package]]
337
+ name = "target-lexicon"
338
+ version = "0.13.5"
339
+ source = "registry+https://github.com/rust-lang/crates.io-index"
340
+ checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
341
+
342
+ [[package]]
343
+ name = "thiserror"
344
+ version = "2.0.20"
345
+ source = "registry+https://github.com/rust-lang/crates.io-index"
346
+ checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f"
347
+ dependencies = [
348
+ "thiserror-impl",
349
+ ]
350
+
351
+ [[package]]
352
+ name = "thiserror-impl"
353
+ version = "2.0.20"
354
+ source = "registry+https://github.com/rust-lang/crates.io-index"
355
+ checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af"
356
+ dependencies = [
357
+ "proc-macro2",
358
+ "quote",
359
+ "syn 3.0.4",
360
+ ]
361
+
362
+ [[package]]
363
+ name = "unicode-ident"
364
+ version = "1.0.24"
365
+ source = "registry+https://github.com/rust-lang/crates.io-index"
366
+ checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
367
+
368
+ [[package]]
369
+ name = "zmij"
370
+ version = "1.0.23"
371
+ source = "registry+https://github.com/rust-lang/crates.io-index"
372
+ checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
@@ -0,0 +1,35 @@
1
+ [workspace]
2
+ members = ["crates/cellpack", "crates/pycellpack"]
3
+ resolver = "3"
4
+
5
+ [workspace.package]
6
+ version = "0.1.0"
7
+ edition = "2024"
8
+ rust-version = "1.89"
9
+ license = "MIT"
10
+ publish = false
11
+ repository = "https://github.com/CladeTeam/CellPack"
12
+ homepage = "https://cladeteam.github.io/CellPack/"
13
+
14
+ [workspace.dependencies]
15
+ thiserror = "2"
16
+ libc = "0.2"
17
+ rustix = { version = "1", features = ["fs", "io_uring", "mm"] }
18
+ pyo3 = "0.29"
19
+
20
+ [workspace.lints.rust]
21
+ unsafe_op_in_unsafe_fn = "deny"
22
+
23
+ [workspace.lints.clippy]
24
+ undocumented_unsafe_blocks = "deny"
25
+
26
+ [profile.release]
27
+ opt-level = 3
28
+ lto = "fat"
29
+ codegen-units = 1
30
+ debug = "line-tables-only"
31
+
32
+ # Release code with full debug info for perf.
33
+ [profile.profiling]
34
+ inherits = "release"
35
+ debug = true
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 wangzhongqi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,175 @@
1
+ Metadata-Version: 2.4
2
+ Name: pycellpack
3
+ Version: 0.1.0
4
+ Classifier: Programming Language :: Python :: 3
5
+ Classifier: Programming Language :: Python :: 3.10
6
+ Classifier: Programming Language :: Python :: 3.11
7
+ Classifier: Programming Language :: Python :: 3.12
8
+ Classifier: Programming Language :: Python :: 3.13
9
+ Classifier: Programming Language :: Python :: 3.14
10
+ Classifier: Programming Language :: Python :: 3.15
11
+ Classifier: Programming Language :: Rust
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
14
+ Classifier: Typing :: Typed
15
+ Requires-Dist: numpy>=2.0
16
+ Requires-Dist: typing-extensions>=4.0
17
+ Requires-Dist: anndata==0.13.4 ; python_full_version >= '3.12' and extra == 'anndata'
18
+ Requires-Dist: h5py>=3.8 ; extra == 'anndata'
19
+ Requires-Dist: scipy>=1.13 ; extra == 'anndata'
20
+ Requires-Dist: maturin>=1.8,<2 ; extra == 'dev'
21
+ Requires-Dist: pytest>=8.0 ; extra == 'dev'
22
+ Requires-Dist: pyright>=1.1.410 ; extra == 'dev'
23
+ Requires-Dist: ruff>=0.12 ; extra == 'dev'
24
+ Requires-Dist: scipy>=1.13 ; extra == 'dev'
25
+ Requires-Dist: pandas>=2 ; extra == 'dev'
26
+ Requires-Dist: anndata==0.13.4 ; python_full_version >= '3.12' and extra == 'dev'
27
+ Requires-Dist: h5py>=3.8 ; extra == 'dev'
28
+ Requires-Dist: scipy>=1.13 ; extra == 'scipy'
29
+ Provides-Extra: anndata
30
+ Provides-Extra: dev
31
+ Provides-Extra: scipy
32
+ License-File: LICENSE
33
+ Summary: CellPack matrix storage, native loading, and AnnData H5AD integration
34
+ License-Expression: MIT
35
+ Requires-Python: >=3.10, <3.16
36
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
37
+ Project-URL: Documentation, https://cladeteam.github.io/CellPack/python/
38
+ Project-URL: Homepage, https://cladeteam.github.io/CellPack/
39
+ Project-URL: Issues, https://github.com/CladeTeam/CellPack/issues
40
+ Project-URL: Repository, https://github.com/CladeTeam/CellPack
41
+
42
+ <p align="center">
43
+ <img src="assets/logo.svg" alt="CellPack logo" width="128" height="128">
44
+ </p>
45
+
46
+ <h1 align="center">CellPack</h1>
47
+
48
+ <p align="center">
49
+ <strong>Compact single-cell storage. Fast random access. Ready for AnnData.</strong>
50
+ </p>
51
+
52
+ <p align="center">
53
+ <a href="https://cladeteam.github.io/CellPack/">Website</a> ·
54
+ <a href="https://github.com/CladeTeam/CellPack/issues">Issues</a> ·
55
+ <a href="LICENSE">MIT License</a>
56
+ </p>
57
+
58
+ <p align="center">
59
+ <img alt="Python 3.10–3.15" src="https://img.shields.io/badge/python-3.10–3.15-1E7A68?logo=python&logoColor=white">
60
+ <img alt="Rust core" src="https://img.shields.io/badge/core-Rust-1E7A68?logo=rust">
61
+ <img alt="Platform: Linux" src="https://img.shields.io/badge/platform-Linux-1E7A68?logo=linux&logoColor=white">
62
+ </p>
63
+
64
+ CellPack stores expression matrices as compact, independently decodable cell
65
+ records. Read individual cells or shuffled batches without decoding their
66
+ neighbours, work with datasets larger than memory, and keep your AnnData
67
+ annotations alongside the compressed matrices.
68
+
69
+ The storage engine and loader are written in Rust. **`pycellpack`** brings them
70
+ to Python, with NumPy, SciPy, AnnData and PyTorch integrations.
71
+
72
+ ## What you can do
73
+
74
+ - **Compress without losing values.** Shared statistical models capture sparse
75
+ matrix structure while each cell remains independently decodable.
76
+ - **Read just the cells and genes you need.** Lazy matrix views support slicing,
77
+ masks and reordered selections; materialize the selected data as dense or CSR.
78
+ - **Keep annotated datasets together.** H5CP embeds CellPack matrices in one
79
+ HDF5 file alongside AnnData annotations, layers, embeddings and metadata.
80
+ - **Load shuffled data beyond RAM.** Asynchronous I/O overlaps reads and
81
+ decoding; bounded buffers deliver batches in the requested sampling order.
82
+ - **Make reuse count.** A planner uses the supplied access sequence to allocate
83
+ a cache budget between compressed pages and decoded rows.
84
+ - **Feed model inputs directly.** Align genes across datasets, apply native
85
+ preprocessing and deliver PyTorch batches on CPU or CUDA. Presets cover
86
+ scGPT, Geneformer, UCE and STATE SE.
87
+
88
+ ## AnnData, with compressed matrices
89
+
90
+ Start with an ordinary AnnData object, including one from an existing Scanpy
91
+ workflow. Write it once, then select cells and genes before decoding:
92
+
93
+ ```python
94
+ import anndata as ad
95
+ import numpy as np
96
+ import pycellpack as cp
97
+
98
+ adata = ad.AnnData(X=np.array([[0, 2, 0], [1, 0, 3]], dtype=np.float32))
99
+ adata.obs_names = ["cell-a", "cell-b"]
100
+ adata.var_names = ["ACTB", "GAPDH", "CD3D"]
101
+ adata.layers["counts"] = adata.X.copy()
102
+
103
+ # One portable file: compressed matrices and their annotations.
104
+ cp.write_h5cp("cells.h5cp", adata, encode=True)
105
+ cells = cp.read_h5("cells.h5cp", lazy=True)
106
+
107
+ # AnnData slicing keeps the embedded matrices lazy.
108
+ subset = cells[["cell-b"], ["CD3D", "ACTB"]]
109
+ small = subset.to_memory()
110
+ print(small.X) # [[3. 1.]]
111
+
112
+ # Export an ordinary H5AD for downstream tools.
113
+ cp.write_h5ad("subset.h5ad", small)
114
+ ```
115
+
116
+ `encode=True` compresses numeric matrix slots; `lazy=True` keeps embedded
117
+ matrices on disk while annotations are loaded into memory. Decode a subset
118
+ with `to_memory()` before passing it to tools that expect NumPy or SciPy
119
+ matrices. H5CP is read through `pycellpack`; `write_h5ad()` exports standard H5AD.
120
+
121
+ For training, `ScDataset.from_anndata(cells, ids=gene_ids)` connects a lazy
122
+ matrix to `ScDataLoader`. Supply one vocabulary ID per gene and your own sample
123
+ order; the loader handles alignment, preprocessing and batch delivery.
124
+
125
+ ## Performance
126
+
127
+ The figures below are newly drawn from frozen experimental results. They
128
+ describe the experimental implementation used for the technical report,
129
+ rather than benchmarks of the current commit.
130
+
131
+ ### Compact storage
132
+
133
+ ![Compression ratios for CellPack and selected general-purpose codecs; larger is better.](assets/performance-compression.svg)
134
+
135
+ CellPack reaches **5.89× compression** while retaining per-cell decoding.
136
+ Ratios are means across raw and normalized matrix blocks: 734 for CellPack and
137
+ 724 for the other codecs. These are corpus summaries, not a paired-input
138
+ comparison or a ranking of decoding speed.
139
+
140
+ ### Random-order loading
141
+
142
+ ![Global random-order loading on one NVMe SSD with 16 workers; a logarithmic axis shows cells per second.](assets/performance-loading.svg)
143
+
144
+ On one NVMe SSD with 16 workers, the report gives **1.165M cells/s** for
145
+ CellPack without a data cache. Baselines use a **20 GB cache** and their best
146
+ variant, averaged over three seeds. CellPack's point is the report's
147
+ author-selected value for a 5 s post-warm-up check, without a variance estimate;
148
+ baselines use 60 s measurement windows. CellPack emits a fixed 2,048-gene panel;
149
+ baselines use their sample-output paths. Only global random-order methods are
150
+ shown.
151
+
152
+ The [figure data and provenance](assets/performance.json) record the exact
153
+ values and source hashes. Both figures can be regenerated with
154
+ `uv run scripts/plot_readme.py`.
155
+
156
+ ## Install
157
+
158
+ From a repository checkout, with a Rust toolchain installed:
159
+
160
+ ```sh
161
+ # Python 3.12+ for AnnData integration (pinned to AnnData 0.13.4).
162
+ uv add '/path/to/CellPack[anndata]'
163
+
164
+ # Or install the matrix storage and loader core (Python 3.10–3.15).
165
+ uv add /path/to/CellPack
166
+ ```
167
+
168
+ CellPack targets Linux. The default loader uses `io_uring`; a `pread` backend
169
+ is available where `io_uring` is disabled. Install PyTorch separately for
170
+ `ScDataLoader`, choosing the build appropriate for your device.
171
+
172
+ ## License
173
+
174
+ [MIT](LICENSE).
175
+