oups 2025.9.5__py3-none-any.whl

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 oups might be problematic. Click here for more details.

Files changed (43) hide show
  1. oups/__init__.py +40 -0
  2. oups/date_utils.py +62 -0
  3. oups/defines.py +26 -0
  4. oups/numpy_utils.py +114 -0
  5. oups/stateful_loop/__init__.py +14 -0
  6. oups/stateful_loop/loop_persistence_io.py +55 -0
  7. oups/stateful_loop/stateful_loop.py +654 -0
  8. oups/stateful_loop/validate_loop_usage.py +338 -0
  9. oups/stateful_ops/__init__.py +22 -0
  10. oups/stateful_ops/aggstream/__init__.py +12 -0
  11. oups/stateful_ops/aggstream/aggstream.py +1524 -0
  12. oups/stateful_ops/aggstream/cumsegagg.py +580 -0
  13. oups/stateful_ops/aggstream/jcumsegagg.py +416 -0
  14. oups/stateful_ops/aggstream/segmentby.py +1018 -0
  15. oups/stateful_ops/aggstream/utils.py +71 -0
  16. oups/stateful_ops/asof_merger/__init__.py +11 -0
  17. oups/stateful_ops/asof_merger/asof_merger.py +750 -0
  18. oups/stateful_ops/asof_merger/get_config.py +401 -0
  19. oups/stateful_ops/asof_merger/validate_params.py +285 -0
  20. oups/store/__init__.py +15 -0
  21. oups/store/filepath_utils.py +68 -0
  22. oups/store/indexer.py +457 -0
  23. oups/store/ordered_parquet_dataset/__init__.py +19 -0
  24. oups/store/ordered_parquet_dataset/metadata_filename.py +50 -0
  25. oups/store/ordered_parquet_dataset/ordered_parquet_dataset/__init__.py +15 -0
  26. oups/store/ordered_parquet_dataset/ordered_parquet_dataset/base.py +863 -0
  27. oups/store/ordered_parquet_dataset/ordered_parquet_dataset/read_only.py +252 -0
  28. oups/store/ordered_parquet_dataset/parquet_adapter.py +157 -0
  29. oups/store/ordered_parquet_dataset/write/__init__.py +19 -0
  30. oups/store/ordered_parquet_dataset/write/iter_merge_split_data.py +131 -0
  31. oups/store/ordered_parquet_dataset/write/merge_split_strategies/__init__.py +22 -0
  32. oups/store/ordered_parquet_dataset/write/merge_split_strategies/base.py +784 -0
  33. oups/store/ordered_parquet_dataset/write/merge_split_strategies/n_rows_strategy.py +297 -0
  34. oups/store/ordered_parquet_dataset/write/merge_split_strategies/time_period_strategy.py +319 -0
  35. oups/store/ordered_parquet_dataset/write/write.py +270 -0
  36. oups/store/store/__init__.py +11 -0
  37. oups/store/store/dataset_cache.py +50 -0
  38. oups/store/store/iter_intersections.py +397 -0
  39. oups/store/store/store.py +345 -0
  40. oups-2025.9.5.dist-info/LICENSE +201 -0
  41. oups-2025.9.5.dist-info/METADATA +44 -0
  42. oups-2025.9.5.dist-info/RECORD +43 -0
  43. oups-2025.9.5.dist-info/WHEEL +4 -0
@@ -0,0 +1,345 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Created on Wed Dec 4 18:00:00 2021.
4
+
5
+ @author: pierrot
6
+
7
+ """
8
+ from collections.abc import Iterator
9
+ from pathlib import Path
10
+
11
+ from pandas import Timestamp
12
+ from sortedcontainers import SortedSet
13
+
14
+ from oups.store.filepath_utils import files_at_depth
15
+ from oups.store.indexer import StoreKey
16
+ from oups.store.indexer import TopLevelIndexer
17
+ from oups.store.indexer import is_toplevel
18
+ from oups.store.ordered_parquet_dataset import OrderedParquetDataset
19
+ from oups.store.ordered_parquet_dataset.metadata_filename import get_md_basename
20
+ from oups.store.store.dataset_cache import cached_datasets
21
+ from oups.store.store.iter_intersections import iter_intersections
22
+
23
+
24
+ def get_keys[K: StoreKey](basepath: Path, indexer: TopLevelIndexer[K]) -> SortedSet[K]:
25
+ """
26
+ Identify ordered parquet dataset in directory.
27
+
28
+ Scan 'basepath' directory and create instances of 'indexer' class from
29
+ compatible subpaths. Only file which name ends by '_opdmd' are retained
30
+ to construct a key.
31
+
32
+ Parameters
33
+ ----------
34
+ basepath : Path
35
+ Path to directory containing a dataset collection, in folders complying
36
+ with the schema defined by the indexer class.
37
+ indexer : TopLevelIndexer[K]
38
+ Class decorated with '@toplevel' decorator, and defining a path
39
+ schema.
40
+
41
+ Returns
42
+ -------
43
+ SortedSet[StoreKey]
44
+ Sorted set of keys (i.e. instances of indexer) that can be
45
+ found in 'basepath' directory and with a 'valid' opd metadata file
46
+ (ending by '_opdmd').
47
+
48
+ """
49
+ depth = indexer.depth - 1
50
+ # Filter, keeping only folders having files with correct extension,
51
+ # then materialize paths into keys, filtering out those that can't.
52
+ return SortedSet(
53
+ [
54
+ key
55
+ for path, files in files_at_depth(basepath, depth)
56
+ for file in files
57
+ if (
58
+ (opdmd_basename := get_md_basename(file))
59
+ and (
60
+ key := indexer.from_path(
61
+ Path(*path.parts[-depth:]) / opdmd_basename,
62
+ )
63
+ )
64
+ )
65
+ ],
66
+ )
67
+
68
+
69
+ class Store[K: StoreKey]:
70
+ """
71
+ Sorted list of keys (indexes to parquet datasets).
72
+
73
+ Attributes
74
+ ----------
75
+ basepath : Path
76
+ Directory path to the set of parquet datasets.
77
+ indexer : TopLevelIndexer[KT]
78
+ Indexer schema (class) to be used to index parquet datasets.
79
+ keys : SortedSet[K]
80
+ Set of indexes of existing parquet datasets.
81
+ _needs_keys_refresh : bool
82
+ Flag indicating that the 'keys' property needs to be refreshed from
83
+ disk. Set to True when a new 'OrderedParquetDataset' is accessed but
84
+ doesn't yet have a metadata file on disk. When True, the next access to
85
+ the 'keys' property will rescan the filesystem to update the keys
86
+ collection.
87
+
88
+ Methods
89
+ -------
90
+ get
91
+ Return the ``OrderedParquetDataset`` instance corresponding to ``key``.
92
+ iter_intersections
93
+ Iterate over row group intersections across multiple datasets in store.
94
+ __getitem__
95
+ Return the ``OrderedParquetDataset`` instance corresponding to ``key``.
96
+ __delitem__
97
+ Remove dataset from parquet set.
98
+ __iter__
99
+ Iterate over keys.
100
+ __len__
101
+ Return number of datasets.
102
+ __repr__
103
+ List of datasets.
104
+ __contains__
105
+ Assess presence of this dataset.
106
+
107
+ Notes
108
+ -----
109
+ ``SortedSet`` is the data structure retained for ``keys`` instead of
110
+ ``SortedList`` as its ``__contains__`` appears faster.
111
+
112
+ """
113
+
114
+ def __init__(self, basepath: str | Path, indexer: TopLevelIndexer[K]):
115
+ """
116
+ Instantiate parquet set.
117
+
118
+ Parameters
119
+ ----------
120
+ basepath : Union[str, Path]
121
+ Path of directory containing parquet datasets.
122
+ indexer : TopLevelIndexer[K]
123
+ Class (not class instance) of the indexer to be used for:
124
+
125
+ - identifying existing parquet datasets in 'basepath' directory,
126
+ - creating the folders where recording new parquet datasets.
127
+
128
+ """
129
+ if not is_toplevel(indexer):
130
+ raise TypeError(f"{indexer.__name__} has to be '@toplevel' decorated.")
131
+ self._basepath = Path(basepath).resolve()
132
+ self._indexer = indexer
133
+ self._keys = get_keys(basepath, indexer)
134
+ self._needs_keys_refresh = False
135
+
136
+ @property
137
+ def basepath(self) -> Path:
138
+ """
139
+ Return basepath.
140
+
141
+ Returns
142
+ -------
143
+ Path
144
+ Basepath.
145
+
146
+ """
147
+ return self._basepath
148
+
149
+ @property
150
+ def indexer(self) -> TopLevelIndexer[K]:
151
+ """
152
+ Return indexer.
153
+
154
+ Returns
155
+ -------
156
+ TopLevelIndexer[K]
157
+ The toplevel indexer class used by this store.
158
+
159
+ """
160
+ return self._indexer
161
+
162
+ @property
163
+ def keys(self) -> SortedSet[K]:
164
+ """
165
+ Return keys.
166
+
167
+ Returns
168
+ -------
169
+ SortedSet[K]
170
+ Sorted set of keys.
171
+
172
+ """
173
+ if self._needs_keys_refresh:
174
+ # Refresh keys.
175
+ self._keys = get_keys(self.basepath, self.indexer)
176
+ self._needs_keys_refresh = False
177
+ return self._keys
178
+
179
+ def __len__(self) -> int:
180
+ """
181
+ Return number of datasets.
182
+
183
+ Returns
184
+ -------
185
+ int
186
+ Number of datasets.
187
+
188
+ """
189
+ return len(self.keys)
190
+
191
+ def __repr__(self) -> str:
192
+ """
193
+ List of datasets.
194
+
195
+ Returns
196
+ -------
197
+ str
198
+ String representation of the store.
199
+
200
+ """
201
+ return "\n".join(map(str, self.keys))
202
+
203
+ def __contains__(self, key: K) -> bool:
204
+ """
205
+ Assess presence of this dataset.
206
+
207
+ Parameters
208
+ ----------
209
+ key : K
210
+ Key to assess presence of.
211
+
212
+ Returns
213
+ -------
214
+ bool
215
+ True if the dataset exists, False otherwise.
216
+
217
+ """
218
+ return key in self.keys
219
+
220
+ def __iter__(self) -> Iterator[K]:
221
+ """
222
+ Iterate over keys.
223
+
224
+ Yields
225
+ ------
226
+ KT
227
+ Key of each dataset.
228
+
229
+ """
230
+ yield from self.keys
231
+
232
+ def __delitem__(self, key: K):
233
+ """
234
+ Remove dataset from parquet set.
235
+
236
+ Parameter
237
+ ---------
238
+ key : K
239
+ Key specifying the location where to delete the data. It has to be
240
+ an instance produced by the indexer class provided at Store
241
+ instantiation.
242
+
243
+ Raises
244
+ ------
245
+ KeyError
246
+ If the key is not found in the store.
247
+
248
+ """
249
+ if key in self.keys:
250
+ # Get OPD instance and remove its files
251
+ self.get(key).remove_from_disk()
252
+ # Update store's key collection
253
+ self._keys.remove(key)
254
+ # Clean up empty parent directories
255
+ upper_dir = (self.basepath / key.to_path()).parent
256
+ while (upper_dir != self.basepath) and (not list(upper_dir.iterdir())):
257
+ upper_dir.rmdir()
258
+ upper_dir = upper_dir.parent
259
+ else:
260
+ raise KeyError(f"key '{key}' not found in store.")
261
+
262
+ def __getitem__(self, key: K) -> OrderedParquetDataset:
263
+ """
264
+ Return the ``OrderedParquetDataset`` instance corresponding to ``key``.
265
+
266
+ Wrapper to ``get`` method.
267
+
268
+ Parameters
269
+ ----------
270
+ key : K
271
+ Key specifying the location where to read the data from. It has to
272
+ be an instance produced by the indexer class provided at Store
273
+ instantiation.
274
+
275
+ Returns
276
+ -------
277
+ OrderedParquetDataset
278
+ The ``OrderedParquetDataset`` instance corresponding to ``key``.
279
+
280
+ """
281
+ return self.get(key)
282
+
283
+ def get(self, key: K, **kwargs) -> OrderedParquetDataset:
284
+ """
285
+ Return the OrderedParquetDataset instance with custom parameters.
286
+
287
+ Parameters
288
+ ----------
289
+ key : K
290
+ Key specifying the location where to read the data from.
291
+ **kwargs : dict
292
+ Additional parameters to pass to OrderedParquetDataset constructor
293
+ (e.g., 'ordered_on', 'lock_timeout', 'lock_lifetime').
294
+
295
+ Returns
296
+ -------
297
+ OrderedParquetDataset
298
+ The OrderedParquetDataset instance corresponding to key. Creates a
299
+ new OrderedParquetDataset object if the key doesn't exist.
300
+
301
+ """
302
+ opd = OrderedParquetDataset(self.basepath / key.to_path(), **kwargs)
303
+ if opd.is_newly_initialized:
304
+ self._needs_keys_refresh = True
305
+ return opd
306
+
307
+ def iter_intersections(
308
+ self,
309
+ keys: list[K],
310
+ start: float | Timestamp | None = None,
311
+ n_prev: int | list[int] | None = 0,
312
+ end_excl: float | Timestamp | None = None,
313
+ ):
314
+ """
315
+ Iterate over row group intersections across multiple datasets in store.
316
+
317
+ This method handles dataset caching and lifecycle management, then
318
+ delegates to the core iter_intersections function.
319
+
320
+ Parameters
321
+ ----------
322
+ keys : list[K]
323
+ List of dataset keys.
324
+ start : Optional[Union[int, float, Timestamp]], default None
325
+ Start value (inclusive) for the 'ordered_on' column range.
326
+ n_prev : Union[int, list[int]], default 0
327
+ Number of previous rows (number of values before 'start') to prepend
328
+ to first yielded dataframe for each key.
329
+ If a list, values are used for each key in the same order as 'keys'.
330
+ end_excl : Optional[Union[int, float, Timestamp]], default None
331
+ End value (exclusive) for the 'ordered_on' column range.
332
+
333
+ Yields
334
+ ------
335
+ dict[K, DataFrame]
336
+ Dictionary mapping each key to its corresponding DataFrame chunk.
337
+
338
+ """
339
+ with cached_datasets(self, keys) as datasets:
340
+ yield from iter_intersections(
341
+ datasets=datasets,
342
+ start=start,
343
+ n_prev=n_prev,
344
+ end_excl=end_excl,
345
+ )
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2025, pierrot
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,44 @@
1
+ Metadata-Version: 2.3
2
+ Name: oups
3
+ Version: 2025.9.5
4
+ Summary: Out-of-core pipelines over ordered data: StatefulLoop, stateful ops, and ordered Parquet Store.
5
+ License: Apache-2.0
6
+ Keywords: out-of-core,streaming,stateful,time-series,pandas,parquet,data-engineering
7
+ Author: pierrot
8
+ Requires-Python: >=3.13,<4.0
9
+ Classifier: License :: OSI Approved :: Apache Software License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.13
12
+ Requires-Dist: cloudpickle (>=3.1.1)
13
+ Requires-Dist: fastparquet (>=2023.10.1)
14
+ Requires-Dist: flufl-lock (>=8.2.0)
15
+ Requires-Dist: joblib (>=1.3.2)
16
+ Requires-Dist: numba (>=0.61.2)
17
+ Requires-Dist: numpy (>=2.0)
18
+ Requires-Dist: pandas (>=2.2.3)
19
+ Requires-Dist: sortedcontainers (>=2.4.0)
20
+ Project-URL: Changelog, https://codeberg.org/pierrot/oups/src/branch/main/CHANGELOG.md
21
+ Project-URL: Documentation, https://codeberg.org/pierrot/oups/src/branch/main/docs
22
+ Project-URL: Homepage, https://codeberg.org/pierrot/oups
23
+ Project-URL: Issues, https://codeberg.org/pierrot/oups/issues
24
+ Project-URL: Source, https://codeberg.org/pierrot/oups
25
+ Description-Content-Type: text/markdown
26
+
27
+ # Welcome to oups!
28
+
29
+ ## What is oups?
30
+ *oups* stands for Ordered Unified Processing Stack — out-of-core processing for ordered data (batch + live).
31
+
32
+ *oups* is a Python toolkit for building end-to-end pipelines over ordered data with the same code in offline training and live streaming/batch contexts.
33
+
34
+ It centers on ``StatefulLoop`` (``loop.bind_function_state``, ``loop.iterate``, ``loop.buffer``), which binds and persists function/object state, orchestrates chunked iteration, and buffers DataFrames under a memory cap with flush-on-limit or last-iteration semantics.
35
+ Complementing the loop, ``stateful_ops`` provides vectorized, chunk-friendly primitives like ``AsofMerger`` for multi-DataFrame as-of joins (with optional windows of previous values) and ``SegmentedAggregator`` (planned) for streamed segmentation and aggregation.
36
+ The ``store`` package manages ordered Parquet datasets via schema-driven keys (``@toplevel``), supports incremental updates (``store[key].write(...)``) and duplicate handling, and offers synchronized iteration across datasets via ``store.iter_intersections(...)`` with optional warm-up (``n_prev``).
37
+
38
+ Together these pieces enable out-of-core processing with resumability, and deterministic buffering. The design favors explicit, minimal APIs and reproducible results, aligning offline feature generation with online serving.
39
+
40
+ ## Links
41
+
42
+ - 📖 **[Documentation](https://pierrot.codeberg.page/oups/)** - Guides and API reference
43
+ - 📋 **[Changelog](CHANGELOG.md)** - Release notes and version history
44
+
@@ -0,0 +1,43 @@
1
+ oups/__init__.py,sha256=Tkw_6ZVwI7Ajr9P2YqDJV-AOAt-MJhxAwYSjLV1Xmq0,1060
2
+ oups/date_utils.py,sha256=3E1K1b2oIZVlI0FO4Eq8hW24ZFTEL-2UwnRLPHnPXxA,1501
3
+ oups/defines.py,sha256=d4f0O1m717WlqN8lP9jGdY3q0Z2qyzpSJVMkukqySog,959
4
+ oups/numpy_utils.py,sha256=KmtBillsNwKdB-1Nv8k-fbJHsADvYfPE2uMBNGdpMoY,3404
5
+ oups/stateful_loop/__init__.py,sha256=hSPoYRGm0nZZKE5ieYze5d5zIdU3pVGTrBIRHuwNUPg,210
6
+ oups/stateful_loop/loop_persistence_io.py,sha256=Dx41DgEa2KQ9-BCfGQnajjcbIi3YWbiPfxS400qJXY4,1666
7
+ oups/stateful_loop/stateful_loop.py,sha256=w7NUyY4SwbzCfgCJQvMW_DaFuEN39DRqPbo-s0gKTmM,26144
8
+ oups/stateful_loop/validate_loop_usage.py,sha256=mnJWjcYKZZ_9446ao7IPy5kkrd3QQgxVcT9yxnzr-To,12249
9
+ oups/stateful_ops/__init__.py,sha256=nRxqMdhYHkB8_7aKY6Oa_Ah05Kp-PFnKwSVIDqaGi5w,470
10
+ oups/stateful_ops/aggstream/__init__.py,sha256=iVbdABSRg1l14h9cO0oCuNPppmnYLlHEbz3MAOUWpAw,204
11
+ oups/stateful_ops/aggstream/aggstream.py,sha256=g9bbNAuFTpiOmmP8tZ8KXOz8gh-ln1d-kdaaLjWXSXU,70392
12
+ oups/stateful_ops/aggstream/cumsegagg.py,sha256=G_jz2FNfrVv9Ix-qcgnC3OYC9QGMlRtd_b6wyF9rXPc,27389
13
+ oups/stateful_ops/aggstream/jcumsegagg.py,sha256=Zm_yojGxFEGnBv9zuIexWpWSCEJmFFT89EpAuoGQHhE,14607
14
+ oups/stateful_ops/aggstream/segmentby.py,sha256=nJEI2-_y6k7_8-RCDSOEsheSHTkvotke2kw716YBrBs,46485
15
+ oups/stateful_ops/aggstream/utils.py,sha256=lIWJmLDY3mT71CJ1J_Fv-tECKEKKqIE0yhCkniJxF1k,2054
16
+ oups/stateful_ops/asof_merger/__init__.py,sha256=vHSmkxKrDg4wU9s1oj88IAe0t1z5PZQ-5xLcuf6U-0Y,161
17
+ oups/stateful_ops/asof_merger/asof_merger.py,sha256=djPKMPXYS91bsIGeJrP_uXID6Glkt8k-98A3uVCho7o,36652
18
+ oups/stateful_ops/asof_merger/get_config.py,sha256=cUo6JwzneruhsSYWJzstnulfFn0uTqnFT7p-0n3WiiI,16974
19
+ oups/stateful_ops/asof_merger/validate_params.py,sha256=W7oEpF8XC0Il6swGMAY75KQotSlp8MwUseo3sXbjPOg,10148
20
+ oups/store/__init__.py,sha256=cApoS3iSXwcegv-iqbSOh5bXXN5ezNNdqGGABTSwWlM,422
21
+ oups/store/filepath_utils.py,sha256=bBkFCIExgeJgrk_TAOT7jsK1UjYe-eQTkQsVDmgmOHo,1811
22
+ oups/store/indexer.py,sha256=KQr1TcWnGx4C1-iBJs9N0JhrIA44BuSk04OiClmbP2w,14831
23
+ oups/store/ordered_parquet_dataset/__init__.py,sha256=KT0-7oOY1GZl2hTwjAYDVWFS22OUMCKMfb7hKxp_K9o,372
24
+ oups/store/ordered_parquet_dataset/metadata_filename.py,sha256=YqhmKUQ6T5QyxixU_KTF9j5vD1w6uhSOeUipz1vuN44,1059
25
+ oups/store/ordered_parquet_dataset/ordered_parquet_dataset/__init__.py,sha256=SKQxlX-xzTfxwBef2rzgn2BbUdE5c3UJ0IMXhgz_Zmc,248
26
+ oups/store/ordered_parquet_dataset/ordered_parquet_dataset/base.py,sha256=Rju3mBIDJ8sS4BpPDL4CavmYkvx4LjJe6j-rKJ2USFQ,33358
27
+ oups/store/ordered_parquet_dataset/ordered_parquet_dataset/read_only.py,sha256=3Cv4OH2UM5gj1ekyGmcVkgABtMwDSujfcJEanght1rs,8832
28
+ oups/store/ordered_parquet_dataset/parquet_adapter.py,sha256=xhOhudNLi0bDvxObT0Rvx3_t5HB_ojIF72uWKiNJ0Vs,4988
29
+ oups/store/ordered_parquet_dataset/write/__init__.py,sha256=IwjAp3s0y7dtsR_MQ3HvV-JxrIZUcWmJX3l5rf6eNUk,396
30
+ oups/store/ordered_parquet_dataset/write/iter_merge_split_data.py,sha256=zU-oRz20kQOeYDA3RHVmzXjTQKJhMBQ0tYpAeNm3caw,5270
31
+ oups/store/ordered_parquet_dataset/write/merge_split_strategies/__init__.py,sha256=kjNLNjojUjKedK7ZAVVyKLOK1dXWzWsEV0qZsEEyivo,700
32
+ oups/store/ordered_parquet_dataset/write/merge_split_strategies/base.py,sha256=hl-7Q1iyslbBZE3HY4SEEuKOETgTuLoTJomuglOQdx4,34029
33
+ oups/store/ordered_parquet_dataset/write/merge_split_strategies/n_rows_strategy.py,sha256=uRtDO8vS0CvPXF3b73pI7d1W1F22NeKE43poKn24PbQ,11801
34
+ oups/store/ordered_parquet_dataset/write/merge_split_strategies/time_period_strategy.py,sha256=Ye47ZoBy6P7TEL2Glmq_34qzpSeKvTBQrRqsDh_n3f8,12691
35
+ oups/store/ordered_parquet_dataset/write/write.py,sha256=CAZgPkXgpjM7mq6PgiJg4rlocl61P2CDr8TCqy8mM4c,12052
36
+ oups/store/store/__init__.py,sha256=OVm6fQncS1_726-K5O1cob68DVc9cGizPwfnfrKmozc,121
37
+ oups/store/store/dataset_cache.py,sha256=J0fE4RHyA2TWNQehgI580ndlrtJZfOyez_wtv1IbEg8,1091
38
+ oups/store/store/iter_intersections.py,sha256=xgPWHxDhbJH6pOwuNy3pabcU9_4s3-iN8RJQ1V86JOk,16740
39
+ oups/store/store/store.py,sha256=aJg2p9O_YVPG3-SPbCXTuCyX4BoJwU6UEKK29nj4rb8,10460
40
+ oups-2025.9.5.dist-info/LICENSE,sha256=feEGyubvFPPWktFR_FTDkcjTaosHXBhKdi9IB4klelk,11539
41
+ oups-2025.9.5.dist-info/METADATA,sha256=g6qoIN2Mkhklk94z9lXNGO2oOycEa26QKF_iGKIPVaw,2671
42
+ oups-2025.9.5.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
43
+ oups-2025.9.5.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 2.1.3
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any