blosc2 3.3.0__tar.gz → 3.3.1__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 (257) hide show
  1. {blosc2-3.3.0 → blosc2-3.3.1}/ANNOUNCE.rst +10 -6
  2. {blosc2-3.3.0 → blosc2-3.3.1}/PKG-INFO +1 -1
  3. {blosc2-3.3.0 → blosc2-3.3.1}/RELEASE_NOTES.md +21 -0
  4. {blosc2-3.3.0 → blosc2-3.3.1}/doc/python-blosc2.rst +1 -1
  5. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/linear_algebra.rst +2 -0
  6. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/ndarray.rst +1 -0
  7. blosc2-3.3.1/examples/c2array-get-slice.py +37 -0
  8. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/arange-constructor.py +1 -1
  9. {blosc2-3.3.0 → blosc2-3.3.1}/pyproject.toml +1 -1
  10. {blosc2-3.3.0 → blosc2-3.3.1}/src/blosc2/__init__.py +2 -1
  11. {blosc2-3.3.0 → blosc2-3.3.1}/src/blosc2/blosc2_ext.pyx +106 -87
  12. {blosc2-3.3.0 → blosc2-3.3.1}/src/blosc2/lazyexpr.py +28 -8
  13. {blosc2-3.3.0 → blosc2-3.3.1}/src/blosc2/ndarray.py +157 -28
  14. blosc2-3.3.1/src/blosc2/version.py +1 -0
  15. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_lazyexpr.py +23 -0
  16. blosc2-3.3.1/tests/ndarray/test_transpose.py +240 -0
  17. blosc2-3.3.0/src/blosc2/version.py +0 -1
  18. blosc2-3.3.0/tests/ndarray/test_transpose.py +0 -104
  19. {blosc2-3.3.0 → blosc2-3.3.1}/.gitignore +0 -0
  20. {blosc2-3.3.0 → blosc2-3.3.1}/.guix/modules/python-blosc2-package.scm +0 -0
  21. {blosc2-3.3.0 → blosc2-3.3.1}/.guix-channel +0 -0
  22. {blosc2-3.3.0 → blosc2-3.3.1}/.pre-commit-config.yaml +0 -0
  23. {blosc2-3.3.0 → blosc2-3.3.1}/CMakeLists.txt +0 -0
  24. {blosc2-3.3.0 → blosc2-3.3.1}/CONTRIBUTING.rst +0 -0
  25. {blosc2-3.3.0 → blosc2-3.3.1}/LICENSE.txt +0 -0
  26. {blosc2-3.3.0 → blosc2-3.3.1}/README.rst +0 -0
  27. {blosc2-3.3.0 → blosc2-3.3.1}/README_DEVELOPERS.md +0 -0
  28. {blosc2-3.3.0 → blosc2-3.3.1}/RELEASING.rst +0 -0
  29. {blosc2-3.3.0 → blosc2-3.3.1}/code_of_conduct.md +0 -0
  30. {blosc2-3.3.0 → blosc2-3.3.1}/doc/_static/blosc-favicon_32x32.png +0 -0
  31. {blosc2-3.3.0 → blosc2-3.3.1}/doc/_static/blosc-favicon_64x64.png +0 -0
  32. {blosc2-3.3.0 → blosc2-3.3.1}/doc/_static/blosc-logo_128.png +0 -0
  33. {blosc2-3.3.0 → blosc2-3.3.1}/doc/_static/blosc-logo_256.png +0 -0
  34. {blosc2-3.3.0 → blosc2-3.3.1}/doc/_static/css/custom.css +0 -0
  35. {blosc2-3.3.0 → blosc2-3.3.1}/doc/conf.py +0 -0
  36. {blosc2-3.3.0 → blosc2-3.3.1}/doc/development/code-of-conduct.rst +0 -0
  37. {blosc2-3.3.0 → blosc2-3.3.1}/doc/development/contributing.rst +0 -0
  38. {blosc2-3.3.0 → blosc2-3.3.1}/doc/development/index.rst +0 -0
  39. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/index.rst +0 -0
  40. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/installation.rst +0 -0
  41. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/overview.rst +0 -0
  42. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/01.ndarray-basics.ipynb +0 -0
  43. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/02.lazyarray-expressions.ipynb +0 -0
  44. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/03.lazyarray-udf.ipynb +0 -0
  45. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/04.reductions.ipynb +0 -0
  46. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/05.persistent-reductions.ipynb +0 -0
  47. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/06.remote_proxy.ipynb +0 -0
  48. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/07.schunk-basics.ipynb +0 -0
  49. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/08.schunk-slicing_and_beyond.ipynb +0 -0
  50. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/10.ucodecs-ufilters.ipynb +0 -0
  51. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/11.prefilters.ipynb +0 -0
  52. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/12.postfilters.ipynb +0 -0
  53. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/images/blosc2-pipeline.png +0 -0
  54. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/images/blosc2-pipeline.svg +0 -0
  55. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/images/lazyexpr-broadcast.png +0 -0
  56. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/images/reductions/3D-cube-plane.png +0 -0
  57. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/images/reductions/3D-cube.png +0 -0
  58. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/images/reductions/memory-access-2D-x.png +0 -0
  59. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/images/reductions/memory-access-2D-y.png +0 -0
  60. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/images/remote_proxy.png +0 -0
  61. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/images/ucodecs-filters/backward.png +0 -0
  62. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/images/ucodecs-filters/backward.svg +0 -0
  63. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/images/ucodecs-filters/decoder.png +0 -0
  64. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/images/ucodecs-filters/decoder.svg +0 -0
  65. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/images/ucodecs-filters/decoder2.png +0 -0
  66. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/images/ucodecs-filters/decoder2.svg +0 -0
  67. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/images/ucodecs-filters/encoder.png +0 -0
  68. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/images/ucodecs-filters/encoder.svg +0 -0
  69. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/images/ucodecs-filters/encoder2.png +0 -0
  70. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/images/ucodecs-filters/encoder2.svg +0 -0
  71. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/images/ucodecs-filters/forward.png +0 -0
  72. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials/images/ucodecs-filters/forward.svg +0 -0
  73. {blosc2-3.3.0 → blosc2-3.3.1}/doc/getting_started/tutorials.rst +0 -0
  74. {blosc2-3.3.0 → blosc2-3.3.1}/doc/index.rst +0 -0
  75. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/array_operations.rst +0 -0
  76. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.__getitem__.rst +0 -0
  77. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.__init__.rst +0 -0
  78. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.__len__.rst +0 -0
  79. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.__setitem__.rst +0 -0
  80. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.append_data.rst +0 -0
  81. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.decompress_chunk.rst +0 -0
  82. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.delete_chunk.rst +0 -0
  83. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.fill_special.rst +0 -0
  84. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.filler.rst +0 -0
  85. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.get_chunk.rst +0 -0
  86. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.get_slice.rst +0 -0
  87. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.insert_chunk.rst +0 -0
  88. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.insert_data.rst +0 -0
  89. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.iterchunks.rst +0 -0
  90. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.iterchunks_info.rst +0 -0
  91. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.postfilter.rst +0 -0
  92. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.prefilter.rst +0 -0
  93. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.remove_postfilter.rst +0 -0
  94. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.remove_prefilter.rst +0 -0
  95. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.to_cframe.rst +0 -0
  96. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.update_chunk.rst +0 -0
  97. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/autofiles/schunk/blosc2.schunk.SChunk.update_data.rst +0 -0
  98. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/c2array.rst +0 -0
  99. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/classes.rst +0 -0
  100. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/decorators.rst +0 -0
  101. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/index.rst +0 -0
  102. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/lazy_functions.rst +0 -0
  103. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/lazyarray.rst +0 -0
  104. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/low_level.rst +0 -0
  105. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/ndfield.rst +0 -0
  106. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/proxy.rst +0 -0
  107. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/proxyndsource.rst +0 -0
  108. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/proxysource.rst +0 -0
  109. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/reduction_functions.rst +0 -0
  110. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/save_load.rst +0 -0
  111. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/schunk.rst +0 -0
  112. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/storage.rst +0 -0
  113. {blosc2-3.3.0 → blosc2-3.3.1}/doc/reference/utilities.rst +0 -0
  114. {blosc2-3.3.0 → blosc2-3.3.1}/doc/release_notes/index.md +0 -0
  115. {blosc2-3.3.0 → blosc2-3.3.1}/examples/btune.py +0 -0
  116. {blosc2-3.3.0 → blosc2-3.3.1}/examples/compress2_decompress2.py +0 -0
  117. {blosc2-3.3.0 → blosc2-3.3.1}/examples/compress_decompress.py +0 -0
  118. {blosc2-3.3.0 → blosc2-3.3.1}/examples/filler.py +0 -0
  119. {blosc2-3.3.0 → blosc2-3.3.1}/examples/gil.py +0 -0
  120. {blosc2-3.3.0 → blosc2-3.3.1}/examples/mmap-rw.py +0 -0
  121. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/asarray_.py +0 -0
  122. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/broadcast_expr.py +0 -0
  123. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/buffer.py +0 -0
  124. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/bytedelta_filter.py +0 -0
  125. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/c2array_expr.py +0 -0
  126. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/compute_expr.py +0 -0
  127. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/compute_fields.py +0 -0
  128. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/compute_udf_numba.py +0 -0
  129. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/compute_where.py +0 -0
  130. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/copy_.py +0 -0
  131. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/empty_.py +0 -0
  132. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/eye-constructor.py +0 -0
  133. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/filter_sort_fields.py +0 -0
  134. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/formats.py +0 -0
  135. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/fromiter-constructor.py +0 -0
  136. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/general_expressions.py +0 -0
  137. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/getitem.py +0 -0
  138. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/iterchunks_info.py +0 -0
  139. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/jit-expr.py +0 -0
  140. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/jit-numpy-funcs.py +0 -0
  141. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/jit-reduc.py +0 -0
  142. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/linspace-constructor.py +0 -0
  143. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/lists-vs-bools-idx.py +0 -0
  144. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/meta.py +0 -0
  145. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/ndarray_copy.py +0 -0
  146. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/ndmean.py +0 -0
  147. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/persistency.py +0 -0
  148. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/proxy-carray.py +0 -0
  149. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/proxy-ndarray.py +0 -0
  150. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/reduce_and_enlarge.py +0 -0
  151. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/reduce_expr.py +0 -0
  152. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/reduce_expr_save.py +0 -0
  153. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/reduce_string_expr.py +0 -0
  154. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/resize_.py +0 -0
  155. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/work_with_numpy.py +0 -0
  156. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ndarray/zfp_codec.py +0 -0
  157. {blosc2-3.3.0 → blosc2-3.3.1}/examples/pack_array.py +0 -0
  158. {blosc2-3.3.0 → blosc2-3.3.1}/examples/pack_tensor.py +0 -0
  159. {blosc2-3.3.0 → blosc2-3.3.1}/examples/postfilter1.py +0 -0
  160. {blosc2-3.3.0 → blosc2-3.3.1}/examples/postfilter2.py +0 -0
  161. {blosc2-3.3.0 → blosc2-3.3.1}/examples/postfilter3.py +0 -0
  162. {blosc2-3.3.0 → blosc2-3.3.1}/examples/prefilter.py +0 -0
  163. {blosc2-3.3.0 → blosc2-3.3.1}/examples/save_tensor.py +0 -0
  164. {blosc2-3.3.0 → blosc2-3.3.1}/examples/schunk.py +0 -0
  165. {blosc2-3.3.0 → blosc2-3.3.1}/examples/schunk_roundtrip.py +0 -0
  166. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ucodecs.py +0 -0
  167. {blosc2-3.3.0 → blosc2-3.3.1}/examples/ufilters.py +0 -0
  168. {blosc2-3.3.0 → blosc2-3.3.1}/examples/vlmeta.py +0 -0
  169. {blosc2-3.3.0 → blosc2-3.3.1}/generate_version.py +0 -0
  170. {blosc2-3.3.0 → blosc2-3.3.1}/guix.scm +0 -0
  171. {blosc2-3.3.0 → blosc2-3.3.1}/images/Complete-Write-Read-B2ND.png +0 -0
  172. {blosc2-3.3.0 → blosc2-3.3.1}/images/M1-i386-vs-arm64-pack.png +0 -0
  173. {blosc2-3.3.0 → blosc2-3.3.1}/images/M1-i386-vs-arm64-unpack.png +0 -0
  174. {blosc2-3.3.0 → blosc2-3.3.1}/images/Read-Partial-Slices-B2ND.png +0 -0
  175. {blosc2-3.3.0 → blosc2-3.3.1}/images/b2nd-2level-parts.png +0 -0
  176. {blosc2-3.3.0 → blosc2-3.3.1}/images/eval-expr-full-mem-M2.png +0 -0
  177. {blosc2-3.3.0 → blosc2-3.3.1}/images/eval-expr-scarce-mem-M2.png +0 -0
  178. {blosc2-3.3.0 → blosc2-3.3.1}/images/lazyarray-dask-large.png +0 -0
  179. {blosc2-3.3.0 → blosc2-3.3.1}/images/lazyarray-dask-small.png +0 -0
  180. {blosc2-3.3.0 → blosc2-3.3.1}/images/lazyarray-expr-large.png +0 -0
  181. {blosc2-3.3.0 → blosc2-3.3.1}/images/lazyarray-expr.png +0 -0
  182. {blosc2-3.3.0 → blosc2-3.3.1}/images/linspace-compress.png +0 -0
  183. {blosc2-3.3.0 → blosc2-3.3.1}/images/linspace-decompress.png +0 -0
  184. {blosc2-3.3.0 → blosc2-3.3.1}/images/pack-array-cratios.png +0 -0
  185. {blosc2-3.3.0 → blosc2-3.3.1}/images/reduc-float64-amd.png +0 -0
  186. {blosc2-3.3.0 → blosc2-3.3.1}/images/reduc-float64-log-amd.png +0 -0
  187. {blosc2-3.3.0 → blosc2-3.3.1}/pytest.ini +0 -0
  188. {blosc2-3.3.0 → blosc2-3.3.1}/src/blosc2/c2array.py +0 -0
  189. {blosc2-3.3.0 → blosc2-3.3.1}/src/blosc2/core.py +0 -0
  190. {blosc2-3.3.0 → blosc2-3.3.1}/src/blosc2/helpers.py +0 -0
  191. {blosc2-3.3.0 → blosc2-3.3.1}/src/blosc2/info.py +0 -0
  192. {blosc2-3.3.0 → blosc2-3.3.1}/src/blosc2/proxy.py +0 -0
  193. {blosc2-3.3.0 → blosc2-3.3.1}/src/blosc2/schunk.py +0 -0
  194. {blosc2-3.3.0 → blosc2-3.3.1}/src/blosc2/storage.py +0 -0
  195. {blosc2-3.3.0 → blosc2-3.3.1}/tests/conftest.py +0 -0
  196. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_auto_parts.py +0 -0
  197. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_buffer.py +0 -0
  198. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_c2array_expr.py +0 -0
  199. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_c2array_reductions.py +0 -0
  200. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_c2array_udf.py +0 -0
  201. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_copy.py +0 -0
  202. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_empty.py +0 -0
  203. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_evaluate.py +0 -0
  204. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_full.py +0 -0
  205. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_get_slice_nchunks.py +0 -0
  206. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_getitem.py +0 -0
  207. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_iterchunks_info.py +0 -0
  208. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_jit.py +0 -0
  209. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_lazyexpr_fields.py +0 -0
  210. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_lazyudf.py +0 -0
  211. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_lossy.py +0 -0
  212. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_matmul.py +0 -0
  213. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_metalayers.py +0 -0
  214. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_mode.py +0 -0
  215. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_nans.py +0 -0
  216. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_ndarray.py +0 -0
  217. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_numpy.py +0 -0
  218. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_persistency.py +0 -0
  219. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_proxy.py +0 -0
  220. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_proxy_c2array.py +0 -0
  221. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_proxy_expr.py +0 -0
  222. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_reductions.py +0 -0
  223. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_resize.py +0 -0
  224. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_setitem.py +0 -0
  225. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_slice.py +0 -0
  226. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_squeeze.py +0 -0
  227. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_struct_dtype.py +0 -0
  228. {blosc2-3.3.0 → blosc2-3.3.1}/tests/ndarray/test_zeros.py +0 -0
  229. {blosc2-3.3.0 → blosc2-3.3.1}/tests/test_bytes_array.py +0 -0
  230. {blosc2-3.3.0 → blosc2-3.3.1}/tests/test_comp_info.py +0 -0
  231. {blosc2-3.3.0 → blosc2-3.3.1}/tests/test_compress2.py +0 -0
  232. {blosc2-3.3.0 → blosc2-3.3.1}/tests/test_compression_parameters.py +0 -0
  233. {blosc2-3.3.0 → blosc2-3.3.1}/tests/test_compressors.py +0 -0
  234. {blosc2-3.3.0 → blosc2-3.3.1}/tests/test_decompress.py +0 -0
  235. {blosc2-3.3.0 → blosc2-3.3.1}/tests/test_iterchunks.py +0 -0
  236. {blosc2-3.3.0 → blosc2-3.3.1}/tests/test_mmap.py +0 -0
  237. {blosc2-3.3.0 → blosc2-3.3.1}/tests/test_open.py +0 -0
  238. {blosc2-3.3.0 → blosc2-3.3.1}/tests/test_open_c2array.py +0 -0
  239. {blosc2-3.3.0 → blosc2-3.3.1}/tests/test_pathlib.py +0 -0
  240. {blosc2-3.3.0 → blosc2-3.3.1}/tests/test_postfilters.py +0 -0
  241. {blosc2-3.3.0 → blosc2-3.3.1}/tests/test_prefilters.py +0 -0
  242. {blosc2-3.3.0 → blosc2-3.3.1}/tests/test_proxy_schunk.py +0 -0
  243. {blosc2-3.3.0 → blosc2-3.3.1}/tests/test_python_blosc.py +0 -0
  244. {blosc2-3.3.0 → blosc2-3.3.1}/tests/test_schunk.py +0 -0
  245. {blosc2-3.3.0 → blosc2-3.3.1}/tests/test_schunk_constructor.py +0 -0
  246. {blosc2-3.3.0 → blosc2-3.3.1}/tests/test_schunk_delete.py +0 -0
  247. {blosc2-3.3.0 → blosc2-3.3.1}/tests/test_schunk_get_slice.py +0 -0
  248. {blosc2-3.3.0 → blosc2-3.3.1}/tests/test_schunk_get_slice_nchunks.py +0 -0
  249. {blosc2-3.3.0 → blosc2-3.3.1}/tests/test_schunk_insert.py +0 -0
  250. {blosc2-3.3.0 → blosc2-3.3.1}/tests/test_schunk_set_slice.py +0 -0
  251. {blosc2-3.3.0 → blosc2-3.3.1}/tests/test_schunk_update.py +0 -0
  252. {blosc2-3.3.0 → blosc2-3.3.1}/tests/test_storage.py +0 -0
  253. {blosc2-3.3.0 → blosc2-3.3.1}/tests/test_tensor.py +0 -0
  254. {blosc2-3.3.0 → blosc2-3.3.1}/tests/test_ucodecs.py +0 -0
  255. {blosc2-3.3.0 → blosc2-3.3.1}/tests/test_ufilters.py +0 -0
  256. {blosc2-3.3.0 → blosc2-3.3.1}/tests/test_vlmeta.py +0 -0
  257. {blosc2-3.3.0 → blosc2-3.3.1}/update_version.py +0 -0
@@ -1,12 +1,16 @@
1
- Announcing Python-Blosc2 3.3.0
1
+ Announcing Python-Blosc2 3.3.1
2
2
  ==============================
3
3
 
4
- We are introducing a new blosc2.transpose() function for natively transposing
5
- 2D NDArray instances and a fast path for NDArray.slice() that delivers up to
6
- 40x speedup when slices align with underlying chunks. Documentation has also
7
- been improved with several edits throughout.
4
+ In our effort to better adapt to better adapt to the array API
5
+ (https://data-apis.org/array-api/latest/), we have introduced
6
+ permute_dims() and matrix_transpose() functions, and the .T property.
7
+ This replaces to previous transpose() function, which is now deprecated.
8
+ See PR #384. Thanks to Ricardo Sales Piquer (@ricardosp4).
8
9
 
9
- See benchmarks at: https://github.com/Blosc/python-blosc2/blob/main/bench/ndarray/aligned_chunks.py
10
+ We have also reduced the memory footprint of constructors like ``arange()``,
11
+ ``linspace()`` and ``fromiter()`` by a large factor. As an example, a 5 TB
12
+ array of 8-byte floats now uses less than 200 MB of memory instead of
13
+ 170 GB previously.
10
14
 
11
15
  You can think of Python-Blosc2 3.x as an extension of NumPy/numexpr that:
12
16
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: blosc2
3
- Version: 3.3.0
3
+ Version: 3.3.1
4
4
  Summary: A fast & compressed ndarray library with a flexible compute engine.
5
5
  Author-Email: Blosc Development Team <blosc@blosc.org>
6
6
  Maintainer-Email: Blosc Development Team <blosc@blosc.org>
@@ -1,5 +1,26 @@
1
1
  # Release notes
2
2
 
3
+ ## Changes from 3.3.0 to 3.3.1
4
+
5
+ * In our effort to better adapt to better adapt to the array API
6
+ (https://data-apis.org/array-api/latest/), we have introduced
7
+ permute_dims() and matrix_transpose() functions, and the .T property.
8
+ This replaces to previous transpose() function, which is now deprecated.
9
+ See PR #384. Thanks to Ricardo Sales Piquer (@ricardosp4).
10
+
11
+ * Constructors like `arange()`, `linspace()` and `fromiter()` now
12
+ use far less memory when creating large arrays. As an example, a 5 TB
13
+ array of 8-byte floats now uses less than 200 MB of memory instead of
14
+ 170 GB previously. See PR #387.
15
+
16
+ * Now, when opening a lazy expression with `blosc2.open()`, and there is
17
+ a missing operand, the open still works, but the dtype and shape
18
+ attributes are None. This is useful for lazy expressions that have
19
+ lost some operands, but you still want to open them for inspection.
20
+ See PR #385.
21
+
22
+ * Added an example of getting a slice out of a C2Array.
23
+
3
24
  ## Changes from 3.2.1 to 3.3.0
4
25
 
5
26
  * New `blosc2.transpose()` function for transposing 2D NDArray instances
@@ -6,7 +6,7 @@
6
6
 
7
7
  <p style="text-align: center; color: black; background-color: rgba(230, 169, 9, 0.65);">
8
8
  <a href="https://github.com/Blosc/python-blosc2/blob/main/RELEASE_NOTES.md"
9
- style="font-size: 1.5em;">Version 3.2.1 released on 2025-04-27!</a>
9
+ style="font-size: 1.5em;">Version 3.3.0 released on 2025-04-08!</a>
10
10
  <span style="display: inline-block; width: 20px;"></span>
11
11
  <span style="font-family: monospace;">pip install blosc2 -U</span>
12
12
  </p>
@@ -13,3 +13,5 @@ The next functions can be used for computing linear algebra operations with :ref
13
13
 
14
14
  matmul
15
15
  transpose
16
+ matrix_transpose
17
+ permute_dims
@@ -40,6 +40,7 @@ Attributes
40
40
  .. autosummary::
41
41
  :toctree: autofiles/ndarray
42
42
 
43
+ T
43
44
  ndim
44
45
  shape
45
46
  ext_shape
@@ -0,0 +1,37 @@
1
+ #######################################################################
2
+ # Copyright (c) 2019-present, Blosc Development Team <blosc@blosc.org>
3
+ # All rights reserved.
4
+ #
5
+ # This source code is licensed under a BSD-style license (found in the
6
+ # LICENSE file in the root directory of this source tree)
7
+ #######################################################################
8
+
9
+ # Example for opening and reading a C2Array (remote array)
10
+
11
+ from time import time
12
+
13
+ import numpy as np
14
+
15
+ import blosc2
16
+
17
+ urlbase = "https://cat2.cloud/demo"
18
+ root = "@public"
19
+
20
+ # Access the server
21
+ # urlpath = blosc2.URLPath(f'{root}/examples/ds-1d.b2nd', urlbase)
22
+ # urlpath = blosc2.URLPath(f'{root}/examples/sa-1M.b2nd', urlbase)
23
+ urlpath = blosc2.URLPath(f"{root}/examples/lung-jpeg2000_10x.b2nd", urlbase)
24
+ # urlpath = blosc2.URLPath(f'{root}/examples/uncompressed_lung-jpeg2000_10x.b2nd', urlbase)
25
+
26
+ # Open the remote array
27
+ t0 = time()
28
+ remote_array = blosc2.open(urlpath, mode="r")
29
+ size = np.prod(remote_array.shape) * remote_array.cparams.typesize
30
+ print(f"Time for opening data (HTTP): {time() - t0:.3f}s - file size: {size / 2**10:.2f} KB")
31
+
32
+ # Fetch a slice of the remote array as a numpy array
33
+ t0 = time()
34
+ a = remote_array[5:9]
35
+ print(f"Time for reading data (HTTP): {time() - t0:.3f}s - {a.nbytes / 2**10:.2f} KB")
36
+
37
+ # TODO: Fetch a slice of the remote array as a blosc2.NDArray
@@ -19,7 +19,7 @@ N = 10_000_000
19
19
  shape = (N,)
20
20
  print(f"*** Creating a blosc2 array with {N:_} elements (shape: {shape}) ***")
21
21
  t0 = time()
22
- a = blosc2.arange(shape=shape, dtype=np.int32)
22
+ a = blosc2.arange(N, shape=shape, dtype=np.int32)
23
23
  cratio = a.schunk.nbytes / a.schunk.cbytes
24
24
  print(
25
25
  f"Time: {time() - t0:.3f} s ({N / (time() - t0) / 1e6:.2f} M/s)"
@@ -40,7 +40,7 @@ dependencies = [
40
40
  "py-cpuinfo; platform_machine != 'wasm32'",
41
41
  "requests",
42
42
  ]
43
- version = "3.3.0"
43
+ version = "3.3.1"
44
44
 
45
45
 
46
46
  [project.optional-dependencies]
@@ -248,7 +248,9 @@ from .ndarray import (
248
248
  full,
249
249
  save,
250
250
  matmul,
251
+ permute_dims,
251
252
  transpose,
253
+ matrix_transpose,
252
254
  )
253
255
 
254
256
  from .c2array import c2context, C2Array, URLPath
@@ -267,7 +269,6 @@ from .proxy import Proxy, ProxySource, ProxyNDSource, ProxyNDField, SimpleProxy,
267
269
 
268
270
  from .schunk import SChunk, open
269
271
 
270
-
271
272
  # Registry for postfilters
272
273
  postfilter_funcs = {}
273
274
  """
@@ -642,8 +642,8 @@ def cbuffer_sizes(src):
642
642
  cpdef compress(src, int32_t typesize=8, int clevel=9, filter=blosc2.Filter.SHUFFLE, codec=blosc2.Codec.BLOSCLZ):
643
643
  set_compressor(codec)
644
644
  cdef int32_t len_src = <int32_t> len(src)
645
- cdef Py_buffer *buf = <Py_buffer *> malloc(sizeof(Py_buffer))
646
- PyObject_GetBuffer(src, buf, PyBUF_SIMPLE)
645
+ cdef Py_buffer buf
646
+ PyObject_GetBuffer(src, &buf, PyBUF_SIMPLE)
647
647
  dest = bytes(buf.len + BLOSC2_MAX_OVERHEAD)
648
648
  cdef int32_t len_dest = <int32_t> len(dest)
649
649
  cdef int size
@@ -654,8 +654,7 @@ cpdef compress(src, int32_t typesize=8, int clevel=9, filter=blosc2.Filter.SHUFF
654
654
  size = blosc2_compress(clevel, filter_, <int32_t> typesize, buf.buf, <int32_t> buf.len, _dest, len_dest)
655
655
  else:
656
656
  size = blosc2_compress(clevel, filter_, <int32_t> typesize, buf.buf, <int32_t> buf.len, <void*> <char *> dest, len_dest)
657
- PyBuffer_Release(buf)
658
- free(buf)
657
+ PyBuffer_Release(&buf)
659
658
  if size > 0:
660
659
  return dest[:size]
661
660
  else:
@@ -672,14 +671,13 @@ def decompress(src, dst=None, as_bytearray=False):
672
671
  typed_view_src = mem_view_src.cast('B')
673
672
  _check_comp_length('src', len(typed_view_src))
674
673
  blosc2_cbuffer_sizes(<void*>&typed_view_src[0], &nbytes, &cbytes, &blocksize)
675
- cdef Py_buffer *buf
674
+ cdef Py_buffer buf
676
675
  if dst is not None:
677
- buf = <Py_buffer *> malloc(sizeof(Py_buffer))
678
- PyObject_GetBuffer(dst, buf, PyBUF_SIMPLE)
676
+ PyObject_GetBuffer(dst, &buf, PyBUF_SIMPLE)
679
677
  if buf.len == 0:
680
678
  raise ValueError("The dst length must be greater than 0")
681
679
  size = blosc1_decompress(<void*>&typed_view_src[0], buf.buf, buf.len)
682
- PyBuffer_Release(buf)
680
+ PyBuffer_Release(&buf)
683
681
  else:
684
682
  dst = PyBytes_FromStringAndSize(NULL, nbytes)
685
683
  if dst is None:
@@ -850,8 +848,8 @@ def compress2(src, **kwargs):
850
848
  create_cparams_from_kwargs(&cparams, kwargs)
851
849
 
852
850
  cdef blosc2_context *cctx
853
- cdef Py_buffer *buf = <Py_buffer *> malloc(sizeof(Py_buffer))
854
- PyObject_GetBuffer(src, buf, PyBUF_SIMPLE)
851
+ cdef Py_buffer buf
852
+ PyObject_GetBuffer(src, &buf, PyBUF_SIMPLE)
855
853
  cdef int size
856
854
  cdef int32_t len_dest = <int32_t> (buf.len + BLOSC2_MAX_OVERHEAD)
857
855
  dest = bytes(len_dest)
@@ -865,8 +863,7 @@ def compress2(src, **kwargs):
865
863
  else:
866
864
  size = blosc2_compress_ctx(cctx, buf.buf, <int32_t> buf.len, _dest, len_dest)
867
865
  blosc2_free_ctx(cctx)
868
- PyBuffer_Release(buf)
869
- free(buf)
866
+ PyBuffer_Release(&buf)
870
867
  if size < 0:
871
868
  raise RuntimeError("Could not compress the data")
872
869
  elif size == 0:
@@ -900,10 +897,9 @@ def decompress2(src, dst=None, **kwargs):
900
897
  cdef int32_t cbytes
901
898
  cdef int32_t blocksize
902
899
  blosc2_cbuffer_sizes(<void*>&typed_view_src[0], &nbytes, &cbytes, &blocksize)
903
- cdef Py_buffer *buf
900
+ cdef Py_buffer buf
904
901
  if dst is not None:
905
- buf = <Py_buffer *> malloc(sizeof(Py_buffer))
906
- PyObject_GetBuffer(dst, buf, PyBUF_SIMPLE)
902
+ PyObject_GetBuffer(dst, &buf, PyBUF_SIMPLE)
907
903
  if buf.len == 0:
908
904
  blosc2_free_ctx(dctx)
909
905
  raise ValueError("The dst length must be greater than 0")
@@ -914,7 +910,7 @@ def decompress2(src, dst=None, **kwargs):
914
910
  else:
915
911
  size = blosc2_decompress_ctx(dctx, view, cbytes, buf.buf, nbytes)
916
912
  blosc2_free_ctx(dctx)
917
- PyBuffer_Release(buf)
913
+ PyBuffer_Release(&buf)
918
914
  else:
919
915
  dst = PyBytes_FromStringAndSize(NULL, nbytes)
920
916
  if dst is None:
@@ -980,7 +976,6 @@ cdef get_chunk_repeatval(blosc2_cparams cparams, const int32_t nbytes,
980
976
  if blosc2_chunk_repeatval(cparams, nbytes, dest, destsize, repeatval.buf) < 0:
981
977
  free(dest)
982
978
  PyBuffer_Release(repeatval)
983
- free(repeatval)
984
979
  raise RuntimeError("Problems when creating the repeated values chunk")
985
980
 
986
981
 
@@ -1076,11 +1071,10 @@ cdef class SChunk:
1076
1071
  self.schunk.chunksize = chunksize
1077
1072
  cdef const uint8_t[:] typed_view
1078
1073
  cdef int64_t index
1079
- cdef Py_buffer *buf
1074
+ cdef Py_buffer buf
1080
1075
  cdef uint8_t *buf_ptr
1081
1076
  if data is not None and len(data) > 0:
1082
- buf = <Py_buffer *> malloc(sizeof(Py_buffer))
1083
- PyObject_GetBuffer(data, buf, PyBUF_SIMPLE)
1077
+ PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE)
1084
1078
  buf_ptr = <uint8_t *> buf.buf
1085
1079
  len_data = buf.len
1086
1080
  nchunks = len_data // chunksize + 1 if len_data % chunksize != 0 else len_data // chunksize
@@ -1091,9 +1085,9 @@ cdef class SChunk:
1091
1085
  index = i * chunksize
1092
1086
  nchunks_ = blosc2_schunk_append_buffer(self.schunk, buf_ptr + index, len_chunk)
1093
1087
  if nchunks_ != (i + 1):
1094
- PyBuffer_Release(buf)
1088
+ PyBuffer_Release(&buf)
1095
1089
  raise RuntimeError("An error occurred while appending the chunks")
1096
- PyBuffer_Release(buf)
1090
+ PyBuffer_Release(&buf)
1097
1091
 
1098
1092
  @property
1099
1093
  def c_schunk(self):
@@ -1223,11 +1217,10 @@ cdef class SChunk:
1223
1217
  raise RuntimeError("Could not create decompression context")
1224
1218
 
1225
1219
  def append_data(self, data):
1226
- cdef Py_buffer *buf = <Py_buffer *> malloc(sizeof(Py_buffer))
1227
- PyObject_GetBuffer(data, buf, PyBUF_SIMPLE)
1220
+ cdef Py_buffer buf
1221
+ PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE)
1228
1222
  rc = blosc2_schunk_append_buffer(self.schunk, buf.buf, <int32_t> buf.len)
1229
- PyBuffer_Release(buf)
1230
- free(buf)
1223
+ PyBuffer_Release(&buf)
1231
1224
  if rc < 0:
1232
1225
  raise RuntimeError("Could not append the buffer")
1233
1226
  return rc
@@ -1252,31 +1245,29 @@ cdef class SChunk:
1252
1245
  else:
1253
1246
  raise ValueError("value size in bytes must match with typesize")
1254
1247
  array = np.array([value], dtype=dtype)
1255
- cdef Py_buffer *buf = <Py_buffer *> malloc(sizeof(Py_buffer))
1256
- PyObject_GetBuffer(array, buf, PyBUF_SIMPLE)
1248
+ cdef Py_buffer buf
1249
+ PyObject_GetBuffer(array, &buf, PyBUF_SIMPLE)
1257
1250
  # Create chunk with repeated values
1258
1251
  nchunks = nitems // self.chunkshape
1259
1252
  cdef blosc2_schunk *c_schunk = <blosc2_schunk *> self.c_schunk
1260
1253
  cdef blosc2_cparams *cparams = self.schunk.storage.cparams
1261
1254
  chunksize = BLOSC_EXTENDED_HEADER_LENGTH + self.typesize
1262
1255
  cdef void *chunk = malloc(chunksize)
1263
- get_chunk_repeatval(dereference(cparams), self.chunksize, chunk, chunksize, buf)
1256
+ get_chunk_repeatval(dereference(cparams), self.chunksize, chunk, chunksize, &buf)
1264
1257
 
1265
1258
  for i in range(nchunks):
1266
1259
  if blosc2_schunk_append_chunk(self.schunk, <uint8_t *>chunk, True) < 0:
1267
1260
  free(chunk)
1268
- PyBuffer_Release(buf)
1269
- free(buf)
1261
+ PyBuffer_Release(&buf)
1270
1262
  raise RuntimeError("Error while appending the chunk")
1271
1263
  # Create and append last chunk if it is smaller than chunkshape
1272
1264
  remainder = nitems % self.chunkshape
1273
1265
  rc = 0
1274
1266
  if remainder != 0:
1275
- get_chunk_repeatval(dereference(cparams), remainder * self.typesize, chunk, chunksize, buf)
1267
+ get_chunk_repeatval(dereference(cparams), remainder * self.typesize, chunk, chunksize, &buf)
1276
1268
  rc = blosc2_schunk_append_chunk(self.schunk, <uint8_t *>chunk, True)
1277
1269
  free(chunk)
1278
- PyBuffer_Release(buf)
1279
- free(buf)
1270
+ PyBuffer_Release(&buf)
1280
1271
  if rc < 0:
1281
1272
  raise RuntimeError("Error while appending the chunk")
1282
1273
 
@@ -1297,14 +1288,13 @@ cdef class SChunk:
1297
1288
  if needs_free:
1298
1289
  free(chunk)
1299
1290
 
1300
- cdef Py_buffer *buf
1291
+ cdef Py_buffer buf
1301
1292
  if dst is not None:
1302
- buf = <Py_buffer *> malloc(sizeof(Py_buffer))
1303
- PyObject_GetBuffer(dst, buf, PyBUF_SIMPLE)
1293
+ PyObject_GetBuffer(dst, &buf, PyBUF_SIMPLE)
1304
1294
  if buf.len == 0:
1305
1295
  raise ValueError("The dst length must be greater than 0")
1306
1296
  size = blosc2_schunk_decompress_chunk(self.schunk, nchunk, buf.buf, <int32_t>buf.len)
1307
- PyBuffer_Release(buf)
1297
+ PyBuffer_Release(&buf)
1308
1298
  else:
1309
1299
  dst = PyBytes_FromStringAndSize(NULL, nbytes)
1310
1300
  if dst is None:
@@ -1363,8 +1353,8 @@ cdef class SChunk:
1363
1353
 
1364
1354
  def insert_data(self, nchunk, data, copy):
1365
1355
  cdef blosc2_context *cctx
1366
- cdef Py_buffer *buf = <Py_buffer *> malloc(sizeof(Py_buffer))
1367
- PyObject_GetBuffer(data, buf, PyBUF_SIMPLE)
1356
+ cdef Py_buffer buf
1357
+ PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE)
1368
1358
  cdef int size
1369
1359
  cdef int32_t len_chunk = <int32_t> (buf.len + BLOSC2_MAX_OVERHEAD)
1370
1360
  cdef uint8_t* chunk = <uint8_t*> malloc(len_chunk)
@@ -1374,8 +1364,7 @@ cdef class SChunk:
1374
1364
  size = blosc2_compress_ctx(self.schunk.cctx, buf.buf, <int32_t> buf.len, chunk, len_chunk)
1375
1365
  else:
1376
1366
  size = blosc2_compress_ctx(self.schunk.cctx, buf.buf, <int32_t> buf.len, chunk, len_chunk)
1377
- PyBuffer_Release(buf)
1378
- free(buf)
1367
+ PyBuffer_Release(&buf)
1379
1368
  if size < 0:
1380
1369
  raise RuntimeError("Could not compress the data")
1381
1370
  elif size == 0:
@@ -1402,8 +1391,8 @@ cdef class SChunk:
1402
1391
  return rc
1403
1392
 
1404
1393
  def update_data(self, nchunk, data, copy):
1405
- cdef Py_buffer *buf = <Py_buffer *> malloc(sizeof(Py_buffer))
1406
- PyObject_GetBuffer(data, buf, PyBUF_SIMPLE)
1394
+ cdef Py_buffer buf
1395
+ PyObject_GetBuffer(data, &buf, PyBUF_SIMPLE)
1407
1396
  cdef int size
1408
1397
  cdef int32_t len_chunk = <int32_t> (buf.len + BLOSC2_MAX_OVERHEAD)
1409
1398
  cdef uint8_t* chunk = <uint8_t*> malloc(len_chunk)
@@ -1413,8 +1402,7 @@ cdef class SChunk:
1413
1402
  else:
1414
1403
  size = blosc2_compress_ctx(self.schunk.cctx, buf.buf, <int32_t> buf.len, chunk, len_chunk)
1415
1404
 
1416
- PyBuffer_Release(buf)
1417
- free(buf)
1405
+ PyBuffer_Release(&buf)
1418
1406
  if size < 0:
1419
1407
  raise RuntimeError("Could not compress the data")
1420
1408
  elif size == 0:
@@ -1437,14 +1425,13 @@ cdef class SChunk:
1437
1425
  return b''
1438
1426
 
1439
1427
  cdef Py_ssize_t nbytes = (stop - start) * self.schunk.typesize
1440
- cdef Py_buffer *buf
1428
+ cdef Py_buffer buf
1441
1429
  if out is not None:
1442
- buf = <Py_buffer *> malloc(sizeof(Py_buffer))
1443
- PyObject_GetBuffer(out, buf, PyBUF_SIMPLE)
1430
+ PyObject_GetBuffer(out, &buf, PyBUF_SIMPLE)
1444
1431
  if buf.len < nbytes:
1445
1432
  raise ValueError("Not enough space for writing the slice in out")
1446
1433
  rc = blosc2_schunk_get_slice_buffer(self.schunk, start, stop, buf.buf)
1447
- PyBuffer_Release(buf)
1434
+ PyBuffer_Release(&buf)
1448
1435
  else:
1449
1436
  out = PyBytes_FromStringAndSize(NULL, nbytes)
1450
1437
  if out is None:
@@ -1463,8 +1450,8 @@ cdef class SChunk:
1463
1450
 
1464
1451
  cdef int64_t nbytes = (stop - start) * self.schunk.typesize
1465
1452
 
1466
- cdef Py_buffer *buf = <Py_buffer *> malloc(sizeof(Py_buffer))
1467
- PyObject_GetBuffer(value, buf, PyBUF_SIMPLE)
1453
+ cdef Py_buffer buf
1454
+ PyObject_GetBuffer(value, &buf, PyBUF_SIMPLE)
1468
1455
  cdef uint8_t *buf_ptr = <uint8_t *> buf.buf
1469
1456
  cdef int64_t buf_pos = 0
1470
1457
  cdef uint8_t *data
@@ -1516,7 +1503,7 @@ cdef class SChunk:
1516
1503
  buf_pos += chunksize
1517
1504
  else:
1518
1505
  rc = blosc2_schunk_set_slice_buffer(self.schunk, start, stop, buf.buf)
1519
- PyBuffer_Release(buf)
1506
+ PyBuffer_Release(&buf)
1520
1507
  if rc < 0:
1521
1508
  raise RuntimeError("Error while setting the slice")
1522
1509
 
@@ -1797,18 +1784,17 @@ cdef int aux_udf(udf_udata *udata, int64_t nchunk, int32_t nblock,
1797
1784
  cdef int64_t start[B2ND_MAX_DIM]
1798
1785
  cdef int64_t slice_shape[B2ND_MAX_DIM]
1799
1786
  cdef int64_t blockshape_int64[B2ND_MAX_DIM]
1800
- cdef Py_buffer *buf
1787
+ cdef Py_buffer buf
1801
1788
  if padding:
1802
1789
  for i in range(udata.array.ndim):
1803
1790
  start[i] = 0
1804
1791
  slice_shape[i] = blockshape[i]
1805
1792
  blockshape_int64[i] = udata.array.blockshape[i]
1806
- buf = <Py_buffer *> malloc(sizeof(Py_buffer))
1807
- PyObject_GetBuffer(output, buf, PyBUF_SIMPLE)
1793
+ PyObject_GetBuffer(output, &buf, PyBUF_SIMPLE)
1808
1794
  rc = b2nd_copy_buffer2(udata.array.ndim, typesize,
1809
1795
  buf.buf, slice_shape, start, slice_shape,
1810
1796
  params_output, blockshape_int64, start)
1811
- PyBuffer_Release(buf)
1797
+ PyBuffer_Release(&buf)
1812
1798
  _check_rc(rc, "Could not copy the result into the buffer")
1813
1799
 
1814
1800
  return 0
@@ -2088,13 +2074,13 @@ cdef schunk_is_ndarray(blosc2_schunk* schunk):
2088
2074
 
2089
2075
 
2090
2076
  def schunk_from_cframe(cframe, copy=False):
2091
- cdef Py_buffer *buf = <Py_buffer *> malloc(sizeof(Py_buffer))
2092
- PyObject_GetBuffer(cframe, buf, PyBUF_SIMPLE)
2077
+ cdef Py_buffer buf
2078
+ PyObject_GetBuffer(cframe, &buf, PyBUF_SIMPLE)
2093
2079
  cdef blosc2_schunk *schunk_ = blosc2_schunk_from_buffer(<uint8_t *>buf.buf, buf.len, copy)
2094
2080
  if schunk_ == NULL:
2095
2081
  raise RuntimeError("Could not get the schunk from the cframe")
2096
2082
  schunk = blosc2.SChunk(_schunk=PyCapsule_New(schunk_, <char *> "blosc2_schunk*", NULL))
2097
- PyBuffer_Release(buf)
2083
+ PyBuffer_Release(&buf)
2098
2084
  if not copy:
2099
2085
  schunk._avoid_cframe_free(True)
2100
2086
  return schunk
@@ -2257,6 +2243,7 @@ cdef class slice_flatter:
2257
2243
  cdef long long[:] indices
2258
2244
  cdef long long current_slice_start
2259
2245
  cdef long long current_slice_end
2246
+ cdef long long current_flat_idx # Track the current flat index
2260
2247
 
2261
2248
  def __cinit__(self, long long[:] start not None, long long[:] stop not None, long long[:] strides not None):
2262
2249
  self.ndim = start.shape[0]
@@ -2269,6 +2256,10 @@ cdef class slice_flatter:
2269
2256
  shape = tuple(stop[i] - start[i] for i in range(self.ndim))
2270
2257
  self.shape = np.array(shape, dtype=np.int64)
2271
2258
  self.indices = np.zeros(self.ndim, dtype=np.int64)
2259
+ # Initialize the flat index
2260
+ self.current_flat_idx = 0
2261
+ for j in range(self.ndim):
2262
+ self.current_flat_idx += self.start[j] * self.strides[j]
2272
2263
 
2273
2264
  def __iter__(self):
2274
2265
  return self
@@ -2276,34 +2267,62 @@ cdef class slice_flatter:
2276
2267
  @cython.boundscheck(False)
2277
2268
  @cython.wraparound(False)
2278
2269
  def __next__(self):
2279
- cdef long long i, j, flat_idx
2270
+ cdef long long j, next_flat_idx
2271
+ cdef int extended_slice = 0
2280
2272
 
2273
+ # Check if we're done
2274
+ if self.done:
2275
+ if self.current_slice_start != -1:
2276
+ result = slice(self.current_slice_start, self.current_slice_end + 1)
2277
+ self.current_slice_start = -1
2278
+ return result
2279
+ raise StopIteration
2280
+
2281
+ # Initialize first slice point if needed
2282
+ if self.current_slice_start == -1:
2283
+ next_flat_idx = 0
2284
+ for j in range(self.ndim):
2285
+ next_flat_idx += (self.start[j] + self.indices[j]) * self.strides[j]
2286
+ self.current_slice_start = next_flat_idx
2287
+ self.current_slice_end = next_flat_idx
2288
+ self.current_flat_idx = next_flat_idx
2289
+ self.incr_indices()
2290
+
2291
+ # If we're done after the first element, return it
2292
+ if self.done:
2293
+ result = slice(self.current_slice_start, self.current_slice_end + 1)
2294
+ self.current_slice_start = -1
2295
+ return result
2296
+
2297
+ # Extend slice as long as indices remain contiguous
2281
2298
  while not self.done:
2282
- flat_idx = 0
2299
+ # Calculate next flat index
2300
+ next_flat_idx = 0
2283
2301
  for j in range(self.ndim):
2284
- flat_idx += (self.start[j] + self.indices[j]) * self.strides[j]
2302
+ next_flat_idx += (self.start[j] + self.indices[j]) * self.strides[j]
2285
2303
 
2286
- if self.current_slice_start == -1:
2287
- self.current_slice_start = flat_idx
2288
- self.current_slice_end = flat_idx
2289
- elif flat_idx == self.current_slice_end + 1:
2290
- self.current_slice_end = flat_idx
2304
+ # If indices are contiguous, extend current slice
2305
+ if next_flat_idx == self.current_slice_end + 1:
2306
+ self.current_slice_end = next_flat_idx
2307
+ self.current_flat_idx = next_flat_idx
2308
+ self.incr_indices()
2309
+ extended_slice = 1
2291
2310
  else:
2311
+ # Non-contiguous index found, return current slice
2292
2312
  result = slice(self.current_slice_start, self.current_slice_end + 1)
2293
- self.current_slice_start = flat_idx
2294
- self.current_slice_end = flat_idx
2295
- # Increment the indices (TODO: remove duplicated code)
2313
+ self.current_slice_start = next_flat_idx
2314
+ self.current_slice_end = next_flat_idx
2315
+ self.current_flat_idx = next_flat_idx
2296
2316
  self.incr_indices()
2297
2317
  return result
2298
2318
 
2299
- # Increment the indices
2300
- self.incr_indices()
2301
-
2302
- if self.current_slice_start != -1:
2319
+ # If we've reached the end after extending the slice
2320
+ if extended_slice:
2303
2321
  result = slice(self.current_slice_start, self.current_slice_end + 1)
2304
2322
  self.current_slice_start = -1
2305
2323
  return result
2306
2324
 
2325
+ # Should never reach here
2307
2326
  raise StopIteration
2308
2327
 
2309
2328
  @cython.boundscheck(False)
@@ -2441,8 +2460,8 @@ cdef class NDArray:
2441
2460
  def set_slice(self, key, ndarray):
2442
2461
  ndim = self.ndim
2443
2462
  start, stop = key
2444
- cdef Py_buffer *buf = <Py_buffer *> malloc(sizeof(Py_buffer))
2445
- PyObject_GetBuffer(ndarray, buf, PyBUF_SIMPLE)
2463
+ cdef Py_buffer buf
2464
+ PyObject_GetBuffer(ndarray, &buf, PyBUF_SIMPLE)
2446
2465
 
2447
2466
  cdef int64_t[B2ND_MAX_DIM] buffershape_, start_, stop_
2448
2467
  for i in range(ndim):
@@ -2452,7 +2471,7 @@ cdef class NDArray:
2452
2471
 
2453
2472
  _check_rc(b2nd_set_slice_cbuffer(buf.buf, buffershape_, buf.len, start_, stop_, self.array),
2454
2473
  "Error while setting the slice")
2455
- PyBuffer_Release(buf)
2474
+ PyBuffer_Release(&buf)
2456
2475
 
2457
2476
  return self
2458
2477
 
@@ -2715,12 +2734,12 @@ def full(shape, chunks, blocks, fill_value, dtype, **kwargs):
2715
2734
 
2716
2735
  dtype = np.dtype(dtype)
2717
2736
  nparr = np.array([fill_value], dtype=dtype)
2718
- cdef Py_buffer *val = <Py_buffer *> malloc(sizeof(Py_buffer))
2719
- PyObject_GetBuffer(nparr, val, PyBUF_SIMPLE)
2737
+ cdef Py_buffer val
2738
+ PyObject_GetBuffer(nparr, &val, PyBUF_SIMPLE)
2720
2739
 
2721
2740
  cdef b2nd_array_t *array
2722
2741
  _check_rc(b2nd_full(ctx, &array, val.buf), "Could not create full array")
2723
- PyBuffer_Release(val)
2742
+ PyBuffer_Release(&val)
2724
2743
 
2725
2744
  ndarray = blosc2.NDArray(_schunk=PyCapsule_New(array.sc, <char *> "blosc2_schunk*", NULL),
2726
2745
  _array=PyCapsule_New(array, <char *> "b2nd_array_t*", NULL))
@@ -2748,8 +2767,8 @@ def from_buffer(buf, shape, chunks, blocks, dtype, **kwargs):
2748
2767
 
2749
2768
  def asarray(ndarray, chunks, blocks, **kwargs):
2750
2769
  interface = ndarray.__array_interface__
2751
- cdef Py_buffer *buf = <Py_buffer *> malloc(sizeof(Py_buffer))
2752
- PyObject_GetBuffer(ndarray, buf, PyBUF_SIMPLE)
2770
+ cdef Py_buffer buf
2771
+ PyObject_GetBuffer(ndarray, &buf, PyBUF_SIMPLE)
2753
2772
 
2754
2773
  shape = interface["shape"]
2755
2774
  dtype = interface["typestr"]
@@ -2763,7 +2782,7 @@ def asarray(ndarray, chunks, blocks, **kwargs):
2763
2782
  cdef b2nd_array_t *array
2764
2783
  _check_rc(b2nd_from_cbuffer(ctx, &array, <void *> <char *> buf.buf, buf.len),
2765
2784
  "Error while creating the NDArray")
2766
- PyBuffer_Release(buf)
2785
+ PyBuffer_Release(&buf)
2767
2786
  ndarray = blosc2.NDArray(_schunk=PyCapsule_New(array.sc, <char *> "blosc2_schunk*", NULL),
2768
2787
  _array=PyCapsule_New(array, <char *> "b2nd_array_t*", NULL))
2769
2788
  _check_rc(b2nd_free_ctx(ctx), "Error while freeing the context")
@@ -2773,8 +2792,8 @@ def asarray(ndarray, chunks, blocks, **kwargs):
2773
2792
 
2774
2793
 
2775
2794
  def ndarray_from_cframe(cframe, copy=False):
2776
- cdef Py_buffer *buf = <Py_buffer *> malloc(sizeof(Py_buffer))
2777
- PyObject_GetBuffer(cframe, buf, PyBUF_SIMPLE)
2795
+ cdef Py_buffer buf
2796
+ PyObject_GetBuffer(cframe, &buf, PyBUF_SIMPLE)
2778
2797
  cdef b2nd_array_t *array
2779
2798
  cdef int rc
2780
2799
  rc = b2nd_from_cframe(<uint8_t *>buf.buf, buf.len, copy, &array)
@@ -2783,7 +2802,7 @@ def ndarray_from_cframe(cframe, copy=False):
2783
2802
  ndarray = blosc2.NDArray(_schunk=PyCapsule_New(array.sc, <char *> "blosc2_schunk*", NULL),
2784
2803
  _array=PyCapsule_New(array, <char *> "b2nd_array_t*", NULL))
2785
2804
 
2786
- PyBuffer_Release(buf)
2805
+ PyBuffer_Release(&buf)
2787
2806
  if not copy:
2788
2807
  ndarray._schunk._avoid_cframe_free(True)
2789
2808
  return ndarray