cellarr-array 0.0.2__tar.gz → 0.0.3__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.

Potentially problematic release.


This version of cellarr-array might be problematic. Click here for more details.

Files changed (44) hide show
  1. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/.github/workflows/publish-pypi.yml +1 -1
  2. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/.pre-commit-config.yaml +1 -1
  3. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/CHANGELOG.md +4 -4
  4. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/PKG-INFO +3 -2
  5. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/setup.py +5 -5
  6. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/src/cellarr_array/CellArray.py +16 -3
  7. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/src/cellarr_array/DenseCellArray.py +6 -1
  8. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/src/cellarr_array/SparseCellArray.py +6 -1
  9. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/src/cellarr_array/__init__.py +1 -1
  10. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/src/cellarr_array/helpers.py +9 -1
  11. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/src/cellarr_array.egg-info/PKG-INFO +3 -2
  12. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/tests/conftest.py +1 -1
  13. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/tests/test_all.py +2 -2
  14. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/tests/test_dense.py +17 -0
  15. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/tests/test_inmemory.py +1 -4
  16. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/tests/test_sparse.py +5 -0
  17. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/.coveragerc +0 -0
  18. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/.github/workflows/run-tests.yml +0 -0
  19. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/.gitignore +0 -0
  20. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/.readthedocs.yml +0 -0
  21. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/AUTHORS.md +0 -0
  22. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/CONTRIBUTING.md +0 -0
  23. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/LICENSE.txt +0 -0
  24. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/README.md +0 -0
  25. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/docs/Makefile +0 -0
  26. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/docs/_static/.gitignore +0 -0
  27. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/docs/authors.md +0 -0
  28. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/docs/changelog.md +0 -0
  29. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/docs/conf.py +0 -0
  30. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/docs/contributing.md +0 -0
  31. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/docs/index.md +0 -0
  32. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/docs/license.md +0 -0
  33. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/docs/readme.md +0 -0
  34. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/docs/requirements.txt +2 -2
  35. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/pyproject.toml +0 -0
  36. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/setup.cfg +0 -0
  37. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/src/cellarr_array/config.py +0 -0
  38. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/src/cellarr_array.egg-info/SOURCES.txt +0 -0
  39. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/src/cellarr_array.egg-info/dependency_links.txt +0 -0
  40. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/src/cellarr_array.egg-info/not-zip-safe +0 -0
  41. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/src/cellarr_array.egg-info/requires.txt +0 -0
  42. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/src/cellarr_array.egg-info/top_level.txt +0 -0
  43. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/tests/test_helpers.py +0 -0
  44. {cellarr_array-0.0.2 → cellarr_array-0.0.3}/tox.ini +0 -0
@@ -52,4 +52,4 @@ jobs:
52
52
 
53
53
  # This uses the trusted publisher workflow so no token is required.
54
54
  - name: Publish to PyPI
55
- uses: pypa/gh-action-pypi-publish@release/v1
55
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -19,7 +19,7 @@ repos:
19
19
 
20
20
  - repo: https://github.com/astral-sh/ruff-pre-commit
21
21
  # Ruff version.
22
- rev: v0.8.2
22
+ rev: v0.11.5
23
23
  hooks:
24
24
  - id: ruff
25
25
  args: [--fix, --exit-non-zero-on-fix]
@@ -6,12 +6,12 @@
6
6
 
7
7
  ## Version 0.0.1
8
8
 
9
- Initial implementation of the sparse and dense arrays backed by TileDB.
9
+ Initial implementation of the sparse and dense arrays backed by TileDB.
10
10
 
11
11
  - Supports reading of objects
12
- - Directly slices the TileDB object is all arguments to subset are contiguous blocks.
13
- - Otherwise redirects them to `multi_index`, if one of the argument to subset is a slice, drops the last because of inclusive upper bounds in this method.
12
+ - Directly slices the TileDB object is all arguments to subset are contiguous blocks.
13
+ - Otherwise redirects them to `multi_index`, if one of the argument to subset is a slice, drops the last because of inclusive upper bounds in this method.
14
14
 
15
15
  This helps keeps slicing consistent across various operations and trying to be performant in the process.
16
16
 
17
- - Supports writing of various data objects into dense and sparse arrays. Expects all chunks to be aligned along the rows.
17
+ - Supports writing of various data objects into dense and sparse arrays. Expects all chunks to be aligned along the rows.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: cellarr-array
3
- Version: 0.0.2
3
+ Version: 0.0.3
4
4
  Summary: Base class for handling TileDB backed arrays.
5
5
  Home-page: https://github.com/cellarr/cellarr-array
6
6
  Author: Jayaram Kancherla
@@ -20,6 +20,7 @@ Provides-Extra: testing
20
20
  Requires-Dist: setuptools; extra == "testing"
21
21
  Requires-Dist: pytest; extra == "testing"
22
22
  Requires-Dist: pytest-cov; extra == "testing"
23
+ Dynamic: license-file
23
24
 
24
25
  [![PyPI-Server](https://img.shields.io/pypi/v/cellarr-array.svg)](https://pypi.org/project/cellarr-array/)
25
26
  ![Unit tests](https://github.com/cellarr/cellarr-array/actions/workflows/run-tests.yml/badge.svg)
@@ -1,10 +1,10 @@
1
1
  """
2
- Setup file for cellarr-array.
3
- Use setup.cfg to configure your project.
2
+ Setup file for cellarr-array.
3
+ Use setup.cfg to configure your project.
4
4
 
5
- This file was generated with PyScaffold 4.6.
6
- PyScaffold helps you to put up the scaffold of your new Python project.
7
- Learn more under: https://pyscaffold.org/
5
+ This file was generated with PyScaffold 4.6.
6
+ PyScaffold helps you to put up the scaffold of your new Python project.
7
+ Learn more under: https://pyscaffold.org/
8
8
  """
9
9
 
10
10
  from setuptools import setup
@@ -1,5 +1,11 @@
1
1
  from abc import ABC, abstractmethod
2
2
  from contextlib import contextmanager
3
+
4
+ try:
5
+ from types import EllipsisType
6
+ except ImportError:
7
+ # TODO: This is required for Python <3.10. Remove once Python 3.9 reaches EOL in October 2025
8
+ EllipsisType = type(...)
3
9
  from typing import List, Literal, Optional, Tuple, Union
4
10
 
5
11
  import numpy as np
@@ -70,6 +76,7 @@ class CellArray(ABC):
70
76
  self._ndim = None
71
77
  self._dim_names = None
72
78
  self._attr_names = None
79
+ self._nonempty_domain = None
73
80
 
74
81
  if validate:
75
82
  self._validate(attr=attr)
@@ -159,7 +166,7 @@ class CellArray(ABC):
159
166
  finally:
160
167
  array.close()
161
168
 
162
- def __getitem__(self, key: Union[slice, Tuple[Union[slice, List[int]], ...]]):
169
+ def __getitem__(self, key: Union[slice, EllipsisType, Tuple[Union[slice, List[int]], ...], EllipsisType]):
163
170
  """Get item implementation that routes to either direct slicing or multi_index
164
171
  based on the type of indices provided.
165
172
 
@@ -176,16 +183,22 @@ class CellArray(ABC):
176
183
  # Normalize all indices
177
184
  normalized_key = tuple(SliceHelper.normalize_index(idx, self.shape[i]) for i, idx in enumerate(key))
178
185
 
186
+ num_ellipsis = sum(isinstance(i, EllipsisType) for i in normalized_key)
187
+ if num_ellipsis > 1:
188
+ raise IndexError(f"Found more than 1 Ellipsis (...) in key: {normalized_key}")
189
+
179
190
  # Check if we can use direct slicing
180
- use_direct = all(isinstance(idx, slice) for idx in normalized_key)
191
+ use_direct = all(isinstance(idx, (slice, EllipsisType)) for idx in normalized_key)
181
192
 
182
193
  if use_direct:
183
194
  return self._direct_slice(normalized_key)
184
195
  else:
196
+ if num_ellipsis > 0:
197
+ raise IndexError(f"tiledb does not support ellipsis in multi-index access: {normalized_key}")
185
198
  return self._multi_index(normalized_key)
186
199
 
187
200
  @abstractmethod
188
- def _direct_slice(self, key: Tuple[slice, ...]) -> np.ndarray:
201
+ def _direct_slice(self, key: Tuple[Union[slice, EllipsisType], ...]) -> np.ndarray:
189
202
  """Implementation for direct slicing."""
190
203
  pass
191
204
 
@@ -1,3 +1,8 @@
1
+ try:
2
+ from types import EllipsisType
3
+ except ImportError:
4
+ # TODO: This is required for Python <3.10. Remove once Python 3.9 reaches EOL in October 2025
5
+ EllipsisType = type(...)
1
6
  from typing import List, Tuple, Union
2
7
 
3
8
  import numpy as np
@@ -13,7 +18,7 @@ __license__ = "MIT"
13
18
  class DenseCellArray(CellArray):
14
19
  """Implementation for dense TileDB arrays."""
15
20
 
16
- def _direct_slice(self, key: Tuple[slice, ...]) -> np.ndarray:
21
+ def _direct_slice(self, key: Tuple[Union[slice, EllipsisType], ...]) -> np.ndarray:
17
22
  """Implementation for direct slicing of dense arrays.
18
23
 
19
24
  Args:
@@ -1,3 +1,8 @@
1
+ try:
2
+ from types import EllipsisType
3
+ except ImportError:
4
+ # TODO: This is required for Python <3.10. Remove once Python 3.9 reaches EOL in October 2025
5
+ EllipsisType = type(...)
1
6
  from typing import Dict, List, Optional, Tuple, Union
2
7
 
3
8
  import numpy as np
@@ -118,7 +123,7 @@ class SparseCellArray(CellArray):
118
123
 
119
124
  return sliced[key]
120
125
 
121
- def _direct_slice(self, key: Tuple[slice, ...]) -> Union[np.ndarray, sparse.coo_matrix]:
126
+ def _direct_slice(self, key: Tuple[Union[slice, EllipsisType], ...]) -> Union[np.ndarray, sparse.coo_matrix]:
122
127
  """Implementation for direct slicing of sparse arrays."""
123
128
  with self.open_array(mode="r") as array:
124
129
  result = array[key]
@@ -18,4 +18,4 @@ finally:
18
18
  from .config import CellArrConfig, ConsolidationConfig
19
19
  from .DenseCellArray import DenseCellArray
20
20
  from .SparseCellArray import SparseCellArray
21
- from .helpers import create_cellarray, SliceHelper
21
+ from .helpers import create_cellarray, SliceHelper
@@ -1,3 +1,8 @@
1
+ try:
2
+ from types import EllipsisType
3
+ except ImportError:
4
+ # TODO: This is required for Python <3.10. Remove once Python 3.9 reaches EOL in October 2025
5
+ EllipsisType = type(...)
1
6
  from typing import List, Optional, Tuple, Union
2
7
 
3
8
  import numpy as np
@@ -150,9 +155,12 @@ class SliceHelper:
150
155
  return None
151
156
 
152
157
  @staticmethod
153
- def normalize_index(idx: Union[int, slice, List[int]], dim_size: int) -> Union[slice, List[int]]:
158
+ def normalize_index(idx: Union[int, slice, List[int]], dim_size: int) -> Union[slice, List[int], EllipsisType]:
154
159
  """Normalize index to handle negative indices and ensure consistency."""
155
160
 
161
+ if isinstance(idx, EllipsisType):
162
+ return idx
163
+
156
164
  # Convert ranges to slices
157
165
  if isinstance(idx, range):
158
166
  idx = slice(idx.start, idx.stop, idx.step)
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: cellarr-array
3
- Version: 0.0.2
3
+ Version: 0.0.3
4
4
  Summary: Base class for handling TileDB backed arrays.
5
5
  Home-page: https://github.com/cellarr/cellarr-array
6
6
  Author: Jayaram Kancherla
@@ -20,6 +20,7 @@ Provides-Extra: testing
20
20
  Requires-Dist: setuptools; extra == "testing"
21
21
  Requires-Dist: pytest; extra == "testing"
22
22
  Requires-Dist: pytest-cov; extra == "testing"
23
+ Dynamic: license-file
23
24
 
24
25
  [![PyPI-Server](https://img.shields.io/pypi/v/cellarr-array.svg)](https://pypi.org/project/cellarr-array/)
25
26
  ![Unit tests](https://github.com/cellarr/cellarr-array/actions/workflows/run-tests.yml/badge.svg)
@@ -16,7 +16,7 @@ from pathlib import Path
16
16
  import numpy as np
17
17
  import pytest
18
18
 
19
- from cellarr_array import CellArrConfig, create_cellarray
19
+ from cellarr_array import create_cellarray
20
20
 
21
21
 
22
22
  @pytest.fixture(scope="function")
@@ -4,7 +4,7 @@ import numpy as np
4
4
  import pytest
5
5
  from scipy import sparse
6
6
 
7
- from cellarr_array import CellArrConfig, ConsolidationConfig, DenseCellArray, SparseCellArray, create_cellarray
7
+ from cellarr_array import CellArrConfig, ConsolidationConfig, DenseCellArray, create_cellarray
8
8
 
9
9
  __author__ = "Jayaram Kancherla"
10
10
  __copyright__ = "Jayaram Kancherla"
@@ -21,7 +21,7 @@ def test_dimension_validation(temp_dir):
21
21
  def test_attribute_validation(temp_dir):
22
22
  uri = str(Path(temp_dir) / "attr_test")
23
23
 
24
- array = create_cellarray(uri=uri, shape=(10, 10), attr_dtype=np.float32, attr_name="values")
24
+ create_cellarray(uri=uri, shape=(10, 10), attr_dtype=np.float32, attr_name="values")
25
25
 
26
26
  with pytest.raises(ValueError, match="Attribute 'invalid' does not exist"):
27
27
  DenseCellArray(uri, attr="invalid")
@@ -84,6 +84,11 @@ def test_1d_slicing(sample_dense_array_1d):
84
84
  result = sample_dense_array_1d[-10:]
85
85
  np.testing.assert_array_almost_equal(result, data[-10:])
86
86
 
87
+ # Ellipsis
88
+ result = sample_dense_array_1d[...]
89
+ actual = data[...]
90
+ np.testing.assert_array_almost_equal(result, actual), f"{actual} != {result}"
91
+
87
92
 
88
93
  def test_2d_slicing(sample_dense_array_2d):
89
94
  data = np.random.random((100, 50)).astype(np.float32)
@@ -105,6 +110,18 @@ def test_2d_slicing(sample_dense_array_2d):
105
110
  result = sample_dense_array_2d[-10:, -5:]
106
111
  np.testing.assert_array_almost_equal(result, data[-10:, -5:])
107
112
 
113
+ # Ellipsis
114
+ result = sample_dense_array_2d[..., :1]
115
+ np.testing.assert_array_almost_equal(result, data[..., :1])
116
+ result = sample_dense_array_2d[..., :]
117
+ np.testing.assert_array_almost_equal(result, data[..., :])
118
+ result = sample_dense_array_2d[-1:, ...]
119
+ np.testing.assert_array_almost_equal(result, data[-1:, ...])
120
+ with pytest.raises(IndexError):
121
+ _ = sample_dense_array_2d[..., ...]
122
+ with pytest.raises(IndexError):
123
+ _ = sample_dense_array_2d[[0, 3], ...]
124
+
108
125
 
109
126
  def test_multi_index_access(sample_dense_array_2d):
110
127
  data = np.random.random((100, 50)).astype(np.float32)
@@ -1,10 +1,7 @@
1
- from pathlib import Path
2
-
3
1
  import numpy as np
4
- import pytest
5
2
  import scipy as sp
6
3
 
7
- from cellarr_array import DenseCellArray, create_cellarray
4
+ from cellarr_array import create_cellarray
8
5
 
9
6
  __author__ = "Jayaram Kancherla"
10
7
  __copyright__ = "Jayaram Kancherla"
@@ -98,6 +98,11 @@ def test_coo_output(sample_sparse_array_2d):
98
98
  assert sparse.isspmatrix_csr(result)
99
99
  np.testing.assert_array_almost_equal(result.toarray(), data.toarray())
100
100
 
101
+ # Test full slice with ellipsis
102
+ result = array_coo[0:10, ...]
103
+ assert sparse.isspmatrix_csr(result)
104
+ np.testing.assert_array_almost_equal(result.toarray(), data.toarray())
105
+
101
106
  # Test partial slice
102
107
  data_csr = data.tocsr()
103
108
  result = array_coo[2:5, 10:20]
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,9 +1,9 @@
1
+ furo
2
+ myst-nb
1
3
  # Requirements file for ReadTheDocs, check .readthedocs.yml.
2
4
  # To build the module reference correctly, make sure every external package
3
5
  # under `install_requires` in `setup.cfg` is also listed here!
4
6
  # sphinx_rtd_theme
5
7
  myst-parser[linkify]
6
8
  sphinx>=3.2.1
7
- myst-nb
8
- furo
9
9
  sphinx-autodoc-typehints
File without changes
File without changes