splitgrid 0.1.2__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.
Files changed (26) hide show
  1. {splitgrid-0.1.2/src/splitgrid.egg-info → splitgrid-0.2.0}/PKG-INFO +20 -4
  2. {splitgrid-0.1.2 → splitgrid-0.2.0}/README.md +19 -3
  3. {splitgrid-0.1.2 → splitgrid-0.2.0}/pyproject.toml +1 -1
  4. {splitgrid-0.1.2 → splitgrid-0.2.0}/src/splitgrid/__init__.py +9 -1
  5. splitgrid-0.2.0/src/splitgrid/codec.py +2534 -0
  6. {splitgrid-0.1.2 → splitgrid-0.2.0}/src/splitgrid/deal_shim.py +55 -4
  7. {splitgrid-0.1.2 → splitgrid-0.2.0}/src/splitgrid/pack.c +298 -143
  8. {splitgrid-0.1.2 → splitgrid-0.2.0}/src/splitgrid/pack.pyx +47 -10
  9. {splitgrid-0.1.2 → splitgrid-0.2.0/src/splitgrid.egg-info}/PKG-INFO +20 -4
  10. splitgrid-0.2.0/tests/test_payload_codec.py +2015 -0
  11. {splitgrid-0.1.2 → splitgrid-0.2.0}/tests/test_payload_codec_policy_verification.py +87 -18
  12. {splitgrid-0.1.2 → splitgrid-0.2.0}/tests/test_serialization_verification.py +32 -7
  13. splitgrid-0.1.2/src/splitgrid/codec.py +0 -1619
  14. splitgrid-0.1.2/tests/test_payload_codec.py +0 -1061
  15. {splitgrid-0.1.2 → splitgrid-0.2.0}/LICENSE +0 -0
  16. {splitgrid-0.1.2 → splitgrid-0.2.0}/MANIFEST.in +0 -0
  17. {splitgrid-0.1.2 → splitgrid-0.2.0}/Makefile +0 -0
  18. {splitgrid-0.1.2 → splitgrid-0.2.0}/setup.cfg +0 -0
  19. {splitgrid-0.1.2 → splitgrid-0.2.0}/setup.py +0 -0
  20. {splitgrid-0.1.2 → splitgrid-0.2.0}/src/splitgrid.egg-info/SOURCES.txt +0 -0
  21. {splitgrid-0.1.2 → splitgrid-0.2.0}/src/splitgrid.egg-info/dependency_links.txt +0 -0
  22. {splitgrid-0.1.2 → splitgrid-0.2.0}/src/splitgrid.egg-info/requires.txt +0 -0
  23. {splitgrid-0.1.2 → splitgrid-0.2.0}/src/splitgrid.egg-info/top_level.txt +0 -0
  24. {splitgrid-0.1.2 → splitgrid-0.2.0}/tests/test_cython_parity.py +0 -0
  25. {splitgrid-0.1.2 → splitgrid-0.2.0}/tests/test_serialization_ab.py +0 -0
  26. {splitgrid-0.1.2 → splitgrid-0.2.0}/tests/test_serialization_ab_support.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: splitgrid
3
- Version: 0.1.2
3
+ Version: 0.2.0
4
4
  Summary: Asymmetric split-grid serialization: host stdlib flatten + optional Cython, child NumPy unpack
5
5
  Author-email: Keith Cu <keithcu@gmail.com>
6
6
  License: GPL-3.0-or-later
@@ -77,13 +77,24 @@ Wire envelope (Pickle5-friendly dict):
77
77
  | Cell value | `buffer` (float64) | `strings` |
78
78
  |------------|--------------------|-----------|
79
79
  | `None` (empty cell) | `NaN` | — |
80
- | `int` / `float` | numeric value | — |
80
+ | `int` / `float` that `float()` accepts | numeric value (ints past ±2^53 round) | — |
81
+ | `int` that `float()` rejects (`10**400`) | `NaN` | decimal text |
81
82
  | `bool` | `0.0` / `1.0` | — |
82
83
  | `str` (including `"02138"`) | `NaN` | text by flat index |
84
+ | Python `complex` or a NumPy complex scalar | `NaN` | `str(val)`; imaginary part kept |
83
85
 
84
- There is **no datetime lane** on the float64 buffer. Python `datetime` objects stringify into `strings`. Do not add a `'date'` column kind.
86
+ Column kinds are `int`, `float`, or `bool`. A column that mixes bool and int is `int` (`True` and `1` are the same float64). A bool next to a float stays `float`. One kind for every column, and an empty `strings` map, is the `frombuffer` path; mixed kinds stay one float64 ndarray in the child. Host unpack still restores per-column Python types, and it keeps buffer `NaN` as `float('nan')`.
85
87
 
86
- Jagged 2D grids raise `ValueError` (spreadsheet ranges are rectangular).
88
+ There is **no datetime lane** on the float64 buffer. Python `datetime` objects stringify into `strings`. `datetime64` / `timedelta64` ndarrays raise from `child_pack_split_grid` instead of becoming Unix-epoch units. Do not add a `'date'` column kind.
89
+
90
+ Other 0.2.0 rules (detail in [docs/serialization.md](docs/serialization.md)):
91
+
92
+ - Rank is 1 or 2. Rank 3+ packs as a list of planes.
93
+ - Jagged 2D grids raise `ValueError`. A row that is not a list or tuple does too.
94
+ - String-map keys must be integers. Two keys that stringify to the same index raise. `wire_str_key` raises on dict keys that collide when stringified.
95
+ - Recursive pack, unpack, and `wire_cell_count` stop at depth 128.
96
+ - A plain dict is walked so a nested envelope unpacks. `calc_range` unpacks the inner grid (no CalcRange wrapper).
97
+ - Image envelopes can be found and written with `find_image_payloads` / `write_image_payload_to_temp`.
87
98
 
88
99
  ## Numbers
89
100
 
@@ -167,6 +178,9 @@ from splitgrid import (
167
178
  child_unpack_data,
168
179
  child_pack_result,
169
180
  is_split_grid,
181
+ find_image_payloads,
182
+ write_image_payload_to_temp,
183
+ wire_str_key,
170
184
  load_cython_accelerator,
171
185
  get_cython_status_info,
172
186
  )
@@ -174,6 +188,8 @@ from splitgrid import (
174
188
 
175
189
  `host_pack_data(..., force="auto"|"always"|"never")` chooses split-grid vs nested list. `host_pack_multi_data` is a thin `multi_data` wrapper over the same per-grid packing.
176
190
 
191
+ Wire contract: [docs/serialization.md](docs/serialization.md). Deal / CrossHair notes: [docs/serialization-verification.md](docs/serialization-verification.md).
192
+
177
193
  ## License
178
194
 
179
195
  GPL-3.0-or-later.
@@ -42,13 +42,24 @@ Wire envelope (Pickle5-friendly dict):
42
42
  | Cell value | `buffer` (float64) | `strings` |
43
43
  |------------|--------------------|-----------|
44
44
  | `None` (empty cell) | `NaN` | — |
45
- | `int` / `float` | numeric value | — |
45
+ | `int` / `float` that `float()` accepts | numeric value (ints past ±2^53 round) | — |
46
+ | `int` that `float()` rejects (`10**400`) | `NaN` | decimal text |
46
47
  | `bool` | `0.0` / `1.0` | — |
47
48
  | `str` (including `"02138"`) | `NaN` | text by flat index |
49
+ | Python `complex` or a NumPy complex scalar | `NaN` | `str(val)`; imaginary part kept |
48
50
 
49
- There is **no datetime lane** on the float64 buffer. Python `datetime` objects stringify into `strings`. Do not add a `'date'` column kind.
51
+ Column kinds are `int`, `float`, or `bool`. A column that mixes bool and int is `int` (`True` and `1` are the same float64). A bool next to a float stays `float`. One kind for every column, and an empty `strings` map, is the `frombuffer` path; mixed kinds stay one float64 ndarray in the child. Host unpack still restores per-column Python types, and it keeps buffer `NaN` as `float('nan')`.
50
52
 
51
- Jagged 2D grids raise `ValueError` (spreadsheet ranges are rectangular).
53
+ There is **no datetime lane** on the float64 buffer. Python `datetime` objects stringify into `strings`. `datetime64` / `timedelta64` ndarrays raise from `child_pack_split_grid` instead of becoming Unix-epoch units. Do not add a `'date'` column kind.
54
+
55
+ Other 0.2.0 rules (detail in [docs/serialization.md](docs/serialization.md)):
56
+
57
+ - Rank is 1 or 2. Rank 3+ packs as a list of planes.
58
+ - Jagged 2D grids raise `ValueError`. A row that is not a list or tuple does too.
59
+ - String-map keys must be integers. Two keys that stringify to the same index raise. `wire_str_key` raises on dict keys that collide when stringified.
60
+ - Recursive pack, unpack, and `wire_cell_count` stop at depth 128.
61
+ - A plain dict is walked so a nested envelope unpacks. `calc_range` unpacks the inner grid (no CalcRange wrapper).
62
+ - Image envelopes can be found and written with `find_image_payloads` / `write_image_payload_to_temp`.
52
63
 
53
64
  ## Numbers
54
65
 
@@ -132,6 +143,9 @@ from splitgrid import (
132
143
  child_unpack_data,
133
144
  child_pack_result,
134
145
  is_split_grid,
146
+ find_image_payloads,
147
+ write_image_payload_to_temp,
148
+ wire_str_key,
135
149
  load_cython_accelerator,
136
150
  get_cython_status_info,
137
151
  )
@@ -139,6 +153,8 @@ from splitgrid import (
139
153
 
140
154
  `host_pack_data(..., force="auto"|"always"|"never")` chooses split-grid vs nested list. `host_pack_multi_data` is a thin `multi_data` wrapper over the same per-grid packing.
141
155
 
156
+ Wire contract: [docs/serialization.md](docs/serialization.md). Deal / CrossHair notes: [docs/serialization-verification.md](docs/serialization-verification.md).
157
+
142
158
  ## License
143
159
 
144
160
  GPL-3.0-or-later.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "splitgrid"
7
- version = "0.1.2"
7
+ version = "0.2.0"
8
8
  description = "Asymmetric split-grid serialization: host stdlib flatten + optional Cython, child NumPy unpack"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -33,6 +33,7 @@ from splitgrid.codec import (
33
33
  describe_wire_value,
34
34
  envelope_column_kinds,
35
35
  envelope_uniform_column_kind,
36
+ find_image_payloads,
36
37
  get_cython_status_info,
37
38
  grid_from_nested_list,
38
39
  host_cython_status_line,
@@ -41,6 +42,7 @@ from splitgrid.codec import (
41
42
  host_pack_split_grid,
42
43
  host_unpack_data,
43
44
  host_unpack_split_grid,
45
+ image_payload_suffix,
44
46
  invalidate_host_cython_accelerator,
45
47
  is_dataframe_payload,
46
48
  is_calc_range_payload,
@@ -53,9 +55,11 @@ from splitgrid.codec import (
53
55
  reload_host_cython_accelerator,
54
56
  should_use_binary_envelope,
55
57
  wire_cell_count,
58
+ wire_str_key,
59
+ write_image_payload_to_temp,
56
60
  )
57
61
 
58
- __version__ = "0.1.2"
62
+ __version__ = "0.2.0"
59
63
 
60
64
 
61
65
  def __getattr__(name: str):
@@ -92,6 +96,7 @@ __all__ = [
92
96
  "envelope_column_kinds",
93
97
  "envelope_uniform_column_kind",
94
98
  "fast_flatten_grid_1d",
99
+ "find_image_payloads",
95
100
  "fast_flatten_grid_2d",
96
101
  "get_cython_status_info",
97
102
  "grid_from_nested_list",
@@ -101,6 +106,7 @@ __all__ = [
101
106
  "host_pack_split_grid",
102
107
  "host_unpack_data",
103
108
  "host_unpack_split_grid",
109
+ "image_payload_suffix",
104
110
  "invalidate_host_cython_accelerator",
105
111
  "is_calc_range_payload",
106
112
  "is_dataframe_payload",
@@ -113,4 +119,6 @@ __all__ = [
113
119
  "reload_host_cython_accelerator",
114
120
  "should_use_binary_envelope",
115
121
  "wire_cell_count",
122
+ "wire_str_key",
123
+ "write_image_payload_to_temp",
116
124
  ]