ndarrayarray 0.1.0__tar.gz → 0.2.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.
- ndarrayarray-0.2.0/LICENSE +30 -0
- ndarrayarray-0.2.0/MANIFEST.in +1 -0
- ndarrayarray-0.2.0/PKG-INFO +182 -0
- ndarrayarray-0.2.0/README.rst +164 -0
- ndarrayarray-0.2.0/ndarrayarray/__init__.py +12 -0
- ndarrayarray-0.2.0/ndarrayarray/ndarrayarray.py +339 -0
- ndarrayarray-0.2.0/ndarrayarray.egg-info/PKG-INFO +182 -0
- {ndarrayarray-0.1.0 → ndarrayarray-0.2.0}/ndarrayarray.egg-info/SOURCES.txt +4 -5
- ndarrayarray-0.2.0/ndarrayarray.egg-info/requires.txt +5 -0
- ndarrayarray-0.2.0/pyproject.toml +28 -0
- ndarrayarray-0.2.0/setup.cfg +4 -0
- ndarrayarray-0.2.0/setup.py +4 -0
- ndarrayarray-0.2.0/tests/test_ndarrayarray.py +386 -0
- ndarrayarray-0.1.0/MANIFEST.in +0 -2
- ndarrayarray-0.1.0/PKG-INFO +0 -12
- ndarrayarray-0.1.0/README.rst +0 -45
- ndarrayarray-0.1.0/ndarrayarray/__init__.py +0 -18
- ndarrayarray-0.1.0/ndarrayarray/_version.py +0 -21
- ndarrayarray-0.1.0/ndarrayarray/ndarrayarray.py +0 -551
- ndarrayarray-0.1.0/ndarrayarray/readcode.py +0 -63
- ndarrayarray-0.1.0/ndarrayarray.egg-info/PKG-INFO +0 -12
- ndarrayarray-0.1.0/ndarrayarray.egg-info/requires.txt +0 -1
- ndarrayarray-0.1.0/setup.cfg +0 -12
- ndarrayarray-0.1.0/setup.py +0 -15
- ndarrayarray-0.1.0/versioneer.py +0 -2140
- {ndarrayarray-0.1.0 → ndarrayarray-0.2.0}/ndarrayarray.egg-info/dependency_links.txt +0 -0
- {ndarrayarray-0.1.0 → ndarrayarray-0.2.0}/ndarrayarray.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022-2026, Gabriël Beckers
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
10
|
+
this list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
23
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
24
|
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
25
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
26
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
27
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
28
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
29
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
30
|
+
POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
include LICENSE
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ndarrayarray
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: A disk-backed sequence of arbitrarily shaped numeric NumPy arrays.
|
|
5
|
+
Author-email: Gabriël Beckers <gabriel@gbeckers.nl>
|
|
6
|
+
License-Expression: BSD-3-Clause
|
|
7
|
+
Classifier: Development Status :: 3 - Alpha
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Topic :: Scientific/Engineering
|
|
10
|
+
Requires-Python: >=3.12
|
|
11
|
+
Description-Content-Type: text/x-rst
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: darr>=0.6.4
|
|
14
|
+
Requires-Dist: numpy
|
|
15
|
+
Provides-Extra: test
|
|
16
|
+
Requires-Dist: pytest>=8; extra == "test"
|
|
17
|
+
Dynamic: license-file
|
|
18
|
+
|
|
19
|
+
Ndarrayarray
|
|
20
|
+
============
|
|
21
|
+
|
|
22
|
+
Ndarrayarray stores a disk-backed sequence of numeric NumPy arrays whose
|
|
23
|
+
shapes and numbers of dimensions may differ. It is a small companion to
|
|
24
|
+
`Darr <https://github.com/gbeckers/Darr/>`_, using Darr's public API for
|
|
25
|
+
storage, memory mapping and metadata.
|
|
26
|
+
|
|
27
|
+
This package is experimental. Version 0.2 introduces a new storage format
|
|
28
|
+
and deliberately rejects directories created by the old work-in-progress
|
|
29
|
+
implementation. Keep old data unchanged until it has been explicitly migrated.
|
|
30
|
+
|
|
31
|
+
Installation
|
|
32
|
+
------------
|
|
33
|
+
|
|
34
|
+
Requires Python 3.12 or newer, NumPy, and Darr 0.6.4 or newer::
|
|
35
|
+
|
|
36
|
+
pip install ndarrayarray
|
|
37
|
+
|
|
38
|
+
For development against the sibling Darr checkout::
|
|
39
|
+
|
|
40
|
+
python -m pip install -e ../darr
|
|
41
|
+
python -m pip install -e '.[test]'
|
|
42
|
+
python -m pytest
|
|
43
|
+
|
|
44
|
+
Darr 0.6.4 must be released before publishing this package: the implementation
|
|
45
|
+
relies on its public truncation and append recovery behavior, including
|
|
46
|
+
truncation to an empty collection.
|
|
47
|
+
|
|
48
|
+
Example
|
|
49
|
+
-------
|
|
50
|
+
|
|
51
|
+
.. code:: python
|
|
52
|
+
|
|
53
|
+
import numpy as np
|
|
54
|
+
import ndarrayarray as ndaa
|
|
55
|
+
|
|
56
|
+
with ndaa.create_ndarrayarray('example.ndaa', dtype='float64',
|
|
57
|
+
metadata={'unit': 'mV'}) as a:
|
|
58
|
+
a.append(np.ones((3, 1, 3)))
|
|
59
|
+
a.append(2 * np.ones((2, 4)))
|
|
60
|
+
a.append(np.array(7)) # zero-dimensional array
|
|
61
|
+
a.append(np.empty((0, 3))) # empty axes retain their shape
|
|
62
|
+
print(len(a)) # 4
|
|
63
|
+
print(a[1].shape) # (2, 4)
|
|
64
|
+
|
|
65
|
+
with ndaa.open('example.ndaa') as a: # read-only by default
|
|
66
|
+
print(a[-1].shape) # (0, 3)
|
|
67
|
+
print(a.metadata['unit']) # mV
|
|
68
|
+
for subarray in a:
|
|
69
|
+
print(subarray.shape)
|
|
70
|
+
|
|
71
|
+
A collection can exceed RAM because its backing data is memory-mapped by
|
|
72
|
+
Darr. Indexing returns an independent NumPy copy, so each retrieved subarray
|
|
73
|
+
must fit in RAM. Mutating that copy does not modify the stored data.
|
|
74
|
+
|
|
75
|
+
API
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
* ``create_ndarrayarray(path, dtype='float64', metadata=None,
|
|
79
|
+
accessmode='r+', indextype='int64', overwrite=False)`` creates an empty
|
|
80
|
+
collection. The parent directory must exist.
|
|
81
|
+
* ``asndarrayarray(path, arrayiterable, dtype=None, metadata=None,
|
|
82
|
+
accessmode='r+', indextype='int64', overwrite=False)`` streams an iterable
|
|
83
|
+
into a collection. If omitted, dtype comes from the first item; an empty
|
|
84
|
+
iterable requires an explicit dtype. Later items are converted to that
|
|
85
|
+
dtype using NumPy conversion rules. Construction can return a read-only
|
|
86
|
+
collection after writing its contents.
|
|
87
|
+
* ``open(path, accessmode='r')`` or ``NDArrayArray(path, accessmode='r')``
|
|
88
|
+
opens an existing collection. This opens ndarrayarray directories only;
|
|
89
|
+
use ``darr.open`` for ordinary Darr arrays.
|
|
90
|
+
* ``a[i]`` accepts positive or negative integer indices. Slices and advanced
|
|
91
|
+
indexing are not supported. ``iter(a)`` and
|
|
92
|
+
``a.iter_arrays(startindex=0, endindex=None, stepsize=1)`` yield subarrays;
|
|
93
|
+
iteration bounds follow Python's ``range`` convention.
|
|
94
|
+
* ``a.append(array)`` and ``a.iterappend(iterable)`` append data. If a batch
|
|
95
|
+
fails, its completed entries remain readable.
|
|
96
|
+
* ``a.metadata`` is Darr's persistent dictionary-like metadata interface.
|
|
97
|
+
``a.accessmode = 'r+'`` enables appending and metadata changes.
|
|
98
|
+
* ``a.copy(path, dtype=None, accessmode='r', overwrite=False)`` copies one
|
|
99
|
+
subarray at a time. Source and destination directories must not overlap.
|
|
100
|
+
* ``a.archive(filepath=None, compressiontype='xz', overwrite=False)``
|
|
101
|
+
creates a Darr directory archive. Supported compression types are
|
|
102
|
+
``xz``, ``gz`` and ``bz2``.
|
|
103
|
+
* ``delete_ndarrayarray(a_or_path)`` deletes a recognized collection.
|
|
104
|
+
Passing a read-only object is rejected; passing a path explicitly requests
|
|
105
|
+
deletion. Deletion and overwrite refuse symlinks and extra user files
|
|
106
|
+
before removing any collection files. Overwrite accepts only the new
|
|
107
|
+
recognized format, including an empty collection.
|
|
108
|
+
|
|
109
|
+
``len(a)`` and ``a.narrays`` count committed subarrays. ``a.size`` counts
|
|
110
|
+
their numeric values; ``a.dtype`` describes their shared numeric type.
|
|
111
|
+
``a.mb`` reports component storage in decimal megabytes, excluding text
|
|
112
|
+
files (including uncommitted trailing storage if present).
|
|
113
|
+
``a.path`` and ``a.datadir`` provide the directory path and Darr's directory
|
|
114
|
+
utilities. ``with a.open_arrays():`` keeps both components open for repeated
|
|
115
|
+
reads; the context yields the collection. ``a.close()`` explicitly closes
|
|
116
|
+
resources, and collections also support ``with`` statements.
|
|
117
|
+
|
|
118
|
+
Signed and unsigned integers, float16/32/64 and complex64/128 are supported.
|
|
119
|
+
Object, string, boolean, structured and masked arrays are not supported.
|
|
120
|
+
Subarrays share a numeric dtype, but can otherwise have arbitrary shapes.
|
|
121
|
+
Scalars and empty arrays are supported. Shape-changing replacement and
|
|
122
|
+
in-place modification of stored subarrays are outside this API.
|
|
123
|
+
|
|
124
|
+
Format and recovery
|
|
125
|
+
-------------------
|
|
126
|
+
|
|
127
|
+
Each collection contains::
|
|
128
|
+
|
|
129
|
+
arraydescription.json # {"ndarrayarray": 1, "order": "C"}
|
|
130
|
+
README.txt # self-contained reconstruction instructions
|
|
131
|
+
values/ # Darr RaggedArray: flattened subarrays
|
|
132
|
+
shapes/ # Darr RaggedArray: int64 dimension lengths
|
|
133
|
+
|
|
134
|
+
User metadata belongs to the values component. ``indextype`` controls the
|
|
135
|
+
offset types in both components; shapes themselves always use int64.
|
|
136
|
+
The format version is independent of the package version.
|
|
137
|
+
|
|
138
|
+
Each component is an ordinary Darr RaggedArray, independently readable
|
|
139
|
+
with ``darr.open``. Reconstruction uses C order::
|
|
140
|
+
|
|
141
|
+
values[i].reshape(tuple(shapes[i]), order='C')
|
|
142
|
+
|
|
143
|
+
The component READMEs include Darr's reading code for other languages.
|
|
144
|
+
For column-major languages, reshape to the reversed shape and then reverse
|
|
145
|
+
the axes. A scalar has an empty shape record and one value; an empty array
|
|
146
|
+
has zero values and a shape containing at least one zero.
|
|
147
|
+
|
|
148
|
+
Appending writes values first and then shape. A shape entry commits its
|
|
149
|
+
corresponding values. Read-only opening ignores extra trailing values
|
|
150
|
+
entries without modifying disk. Before the next append, trailing values
|
|
151
|
+
are removed through Darr's public truncation API. Missing values for
|
|
152
|
+
committed shapes are rejected on opening; malformed shape/value pairs
|
|
153
|
+
are rejected when accessed. Opening does not scan every stored subarray.
|
|
154
|
+
If an append raises after its shape was committed, that entry may already
|
|
155
|
+
be present; inspect the collection before retrying.
|
|
156
|
+
|
|
157
|
+
Only one writer is supported. Close and reopen other collection objects
|
|
158
|
+
after writes to refresh their state. The components must not be modified
|
|
159
|
+
separately. Recovery handles incomplete pairs when the underlying Darr
|
|
160
|
+
components remain readable; it is not a cross-file transaction or a
|
|
161
|
+
power-loss durability guarantee. Overwrite stages an empty replacement
|
|
162
|
+
before removing the old collection, but replacement is not atomic.
|
|
163
|
+
|
|
164
|
+
Development and release
|
|
165
|
+
-----------------------
|
|
166
|
+
|
|
167
|
+
The test suite covers mixed shapes, scalar and empty arrays, dtype
|
|
168
|
+
conversion, read-only access, metadata, copying, recovery, failed iterators,
|
|
169
|
+
index overflow, safe deletion and overwrite, and legacy-format rejection.
|
|
170
|
+
Run it with ``python -m pytest``. Build distributions with
|
|
171
|
+
``python -m build`` after installing the ``build`` package.
|
|
172
|
+
|
|
173
|
+
GitHub Actions runs on pushes, pull requests and manual dispatch. It builds
|
|
174
|
+
both distributions and runs the tests against an installed wheel outside
|
|
175
|
+
the checkout on Linux, macOS and Windows, using Python 3.12 and 3.14.
|
|
176
|
+
An additional Linux job pins Darr to the minimum supported version, 0.6.4;
|
|
177
|
+
the other jobs use the latest compatible release. CI installs dependencies
|
|
178
|
+
from PyPI, so Darr 0.6.4 must be published before these jobs can pass.
|
|
179
|
+
The workflow tests packages without publishing them.
|
|
180
|
+
|
|
181
|
+
Ndarrayarray is distributed under the BSD 3-Clause License.
|
|
182
|
+
Copyright (c) 2022-2026, Gabriël Beckers.
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
Ndarrayarray
|
|
2
|
+
============
|
|
3
|
+
|
|
4
|
+
Ndarrayarray stores a disk-backed sequence of numeric NumPy arrays whose
|
|
5
|
+
shapes and numbers of dimensions may differ. It is a small companion to
|
|
6
|
+
`Darr <https://github.com/gbeckers/Darr/>`_, using Darr's public API for
|
|
7
|
+
storage, memory mapping and metadata.
|
|
8
|
+
|
|
9
|
+
This package is experimental. Version 0.2 introduces a new storage format
|
|
10
|
+
and deliberately rejects directories created by the old work-in-progress
|
|
11
|
+
implementation. Keep old data unchanged until it has been explicitly migrated.
|
|
12
|
+
|
|
13
|
+
Installation
|
|
14
|
+
------------
|
|
15
|
+
|
|
16
|
+
Requires Python 3.12 or newer, NumPy, and Darr 0.6.4 or newer::
|
|
17
|
+
|
|
18
|
+
pip install ndarrayarray
|
|
19
|
+
|
|
20
|
+
For development against the sibling Darr checkout::
|
|
21
|
+
|
|
22
|
+
python -m pip install -e ../darr
|
|
23
|
+
python -m pip install -e '.[test]'
|
|
24
|
+
python -m pytest
|
|
25
|
+
|
|
26
|
+
Darr 0.6.4 must be released before publishing this package: the implementation
|
|
27
|
+
relies on its public truncation and append recovery behavior, including
|
|
28
|
+
truncation to an empty collection.
|
|
29
|
+
|
|
30
|
+
Example
|
|
31
|
+
-------
|
|
32
|
+
|
|
33
|
+
.. code:: python
|
|
34
|
+
|
|
35
|
+
import numpy as np
|
|
36
|
+
import ndarrayarray as ndaa
|
|
37
|
+
|
|
38
|
+
with ndaa.create_ndarrayarray('example.ndaa', dtype='float64',
|
|
39
|
+
metadata={'unit': 'mV'}) as a:
|
|
40
|
+
a.append(np.ones((3, 1, 3)))
|
|
41
|
+
a.append(2 * np.ones((2, 4)))
|
|
42
|
+
a.append(np.array(7)) # zero-dimensional array
|
|
43
|
+
a.append(np.empty((0, 3))) # empty axes retain their shape
|
|
44
|
+
print(len(a)) # 4
|
|
45
|
+
print(a[1].shape) # (2, 4)
|
|
46
|
+
|
|
47
|
+
with ndaa.open('example.ndaa') as a: # read-only by default
|
|
48
|
+
print(a[-1].shape) # (0, 3)
|
|
49
|
+
print(a.metadata['unit']) # mV
|
|
50
|
+
for subarray in a:
|
|
51
|
+
print(subarray.shape)
|
|
52
|
+
|
|
53
|
+
A collection can exceed RAM because its backing data is memory-mapped by
|
|
54
|
+
Darr. Indexing returns an independent NumPy copy, so each retrieved subarray
|
|
55
|
+
must fit in RAM. Mutating that copy does not modify the stored data.
|
|
56
|
+
|
|
57
|
+
API
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
* ``create_ndarrayarray(path, dtype='float64', metadata=None,
|
|
61
|
+
accessmode='r+', indextype='int64', overwrite=False)`` creates an empty
|
|
62
|
+
collection. The parent directory must exist.
|
|
63
|
+
* ``asndarrayarray(path, arrayiterable, dtype=None, metadata=None,
|
|
64
|
+
accessmode='r+', indextype='int64', overwrite=False)`` streams an iterable
|
|
65
|
+
into a collection. If omitted, dtype comes from the first item; an empty
|
|
66
|
+
iterable requires an explicit dtype. Later items are converted to that
|
|
67
|
+
dtype using NumPy conversion rules. Construction can return a read-only
|
|
68
|
+
collection after writing its contents.
|
|
69
|
+
* ``open(path, accessmode='r')`` or ``NDArrayArray(path, accessmode='r')``
|
|
70
|
+
opens an existing collection. This opens ndarrayarray directories only;
|
|
71
|
+
use ``darr.open`` for ordinary Darr arrays.
|
|
72
|
+
* ``a[i]`` accepts positive or negative integer indices. Slices and advanced
|
|
73
|
+
indexing are not supported. ``iter(a)`` and
|
|
74
|
+
``a.iter_arrays(startindex=0, endindex=None, stepsize=1)`` yield subarrays;
|
|
75
|
+
iteration bounds follow Python's ``range`` convention.
|
|
76
|
+
* ``a.append(array)`` and ``a.iterappend(iterable)`` append data. If a batch
|
|
77
|
+
fails, its completed entries remain readable.
|
|
78
|
+
* ``a.metadata`` is Darr's persistent dictionary-like metadata interface.
|
|
79
|
+
``a.accessmode = 'r+'`` enables appending and metadata changes.
|
|
80
|
+
* ``a.copy(path, dtype=None, accessmode='r', overwrite=False)`` copies one
|
|
81
|
+
subarray at a time. Source and destination directories must not overlap.
|
|
82
|
+
* ``a.archive(filepath=None, compressiontype='xz', overwrite=False)``
|
|
83
|
+
creates a Darr directory archive. Supported compression types are
|
|
84
|
+
``xz``, ``gz`` and ``bz2``.
|
|
85
|
+
* ``delete_ndarrayarray(a_or_path)`` deletes a recognized collection.
|
|
86
|
+
Passing a read-only object is rejected; passing a path explicitly requests
|
|
87
|
+
deletion. Deletion and overwrite refuse symlinks and extra user files
|
|
88
|
+
before removing any collection files. Overwrite accepts only the new
|
|
89
|
+
recognized format, including an empty collection.
|
|
90
|
+
|
|
91
|
+
``len(a)`` and ``a.narrays`` count committed subarrays. ``a.size`` counts
|
|
92
|
+
their numeric values; ``a.dtype`` describes their shared numeric type.
|
|
93
|
+
``a.mb`` reports component storage in decimal megabytes, excluding text
|
|
94
|
+
files (including uncommitted trailing storage if present).
|
|
95
|
+
``a.path`` and ``a.datadir`` provide the directory path and Darr's directory
|
|
96
|
+
utilities. ``with a.open_arrays():`` keeps both components open for repeated
|
|
97
|
+
reads; the context yields the collection. ``a.close()`` explicitly closes
|
|
98
|
+
resources, and collections also support ``with`` statements.
|
|
99
|
+
|
|
100
|
+
Signed and unsigned integers, float16/32/64 and complex64/128 are supported.
|
|
101
|
+
Object, string, boolean, structured and masked arrays are not supported.
|
|
102
|
+
Subarrays share a numeric dtype, but can otherwise have arbitrary shapes.
|
|
103
|
+
Scalars and empty arrays are supported. Shape-changing replacement and
|
|
104
|
+
in-place modification of stored subarrays are outside this API.
|
|
105
|
+
|
|
106
|
+
Format and recovery
|
|
107
|
+
-------------------
|
|
108
|
+
|
|
109
|
+
Each collection contains::
|
|
110
|
+
|
|
111
|
+
arraydescription.json # {"ndarrayarray": 1, "order": "C"}
|
|
112
|
+
README.txt # self-contained reconstruction instructions
|
|
113
|
+
values/ # Darr RaggedArray: flattened subarrays
|
|
114
|
+
shapes/ # Darr RaggedArray: int64 dimension lengths
|
|
115
|
+
|
|
116
|
+
User metadata belongs to the values component. ``indextype`` controls the
|
|
117
|
+
offset types in both components; shapes themselves always use int64.
|
|
118
|
+
The format version is independent of the package version.
|
|
119
|
+
|
|
120
|
+
Each component is an ordinary Darr RaggedArray, independently readable
|
|
121
|
+
with ``darr.open``. Reconstruction uses C order::
|
|
122
|
+
|
|
123
|
+
values[i].reshape(tuple(shapes[i]), order='C')
|
|
124
|
+
|
|
125
|
+
The component READMEs include Darr's reading code for other languages.
|
|
126
|
+
For column-major languages, reshape to the reversed shape and then reverse
|
|
127
|
+
the axes. A scalar has an empty shape record and one value; an empty array
|
|
128
|
+
has zero values and a shape containing at least one zero.
|
|
129
|
+
|
|
130
|
+
Appending writes values first and then shape. A shape entry commits its
|
|
131
|
+
corresponding values. Read-only opening ignores extra trailing values
|
|
132
|
+
entries without modifying disk. Before the next append, trailing values
|
|
133
|
+
are removed through Darr's public truncation API. Missing values for
|
|
134
|
+
committed shapes are rejected on opening; malformed shape/value pairs
|
|
135
|
+
are rejected when accessed. Opening does not scan every stored subarray.
|
|
136
|
+
If an append raises after its shape was committed, that entry may already
|
|
137
|
+
be present; inspect the collection before retrying.
|
|
138
|
+
|
|
139
|
+
Only one writer is supported. Close and reopen other collection objects
|
|
140
|
+
after writes to refresh their state. The components must not be modified
|
|
141
|
+
separately. Recovery handles incomplete pairs when the underlying Darr
|
|
142
|
+
components remain readable; it is not a cross-file transaction or a
|
|
143
|
+
power-loss durability guarantee. Overwrite stages an empty replacement
|
|
144
|
+
before removing the old collection, but replacement is not atomic.
|
|
145
|
+
|
|
146
|
+
Development and release
|
|
147
|
+
-----------------------
|
|
148
|
+
|
|
149
|
+
The test suite covers mixed shapes, scalar and empty arrays, dtype
|
|
150
|
+
conversion, read-only access, metadata, copying, recovery, failed iterators,
|
|
151
|
+
index overflow, safe deletion and overwrite, and legacy-format rejection.
|
|
152
|
+
Run it with ``python -m pytest``. Build distributions with
|
|
153
|
+
``python -m build`` after installing the ``build`` package.
|
|
154
|
+
|
|
155
|
+
GitHub Actions runs on pushes, pull requests and manual dispatch. It builds
|
|
156
|
+
both distributions and runs the tests against an installed wheel outside
|
|
157
|
+
the checkout on Linux, macOS and Windows, using Python 3.12 and 3.14.
|
|
158
|
+
An additional Linux job pins Darr to the minimum supported version, 0.6.4;
|
|
159
|
+
the other jobs use the latest compatible release. CI installs dependencies
|
|
160
|
+
from PyPI, so Darr 0.6.4 must be published before these jobs can pass.
|
|
161
|
+
The workflow tests packages without publishing them.
|
|
162
|
+
|
|
163
|
+
Ndarrayarray is distributed under the BSD 3-Clause License.
|
|
164
|
+
Copyright (c) 2022-2026, Gabriël Beckers.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""A disk-backed sequence of arbitrarily shaped numeric arrays."""
|
|
2
|
+
from .ndarrayarray import (NDArrayArray, asndarrayarray, create_ndarrayarray,
|
|
3
|
+
delete_ndarrayarray)
|
|
4
|
+
|
|
5
|
+
__version__ = '0.2.0'
|
|
6
|
+
__all__ = ['NDArrayArray', 'asndarrayarray', 'create_ndarrayarray',
|
|
7
|
+
'delete_ndarrayarray', 'open']
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def open(path, accessmode='r'):
|
|
11
|
+
"""Open an NDArrayArray directory (read-only by default)."""
|
|
12
|
+
return NDArrayArray(path, accessmode)
|