pizzlies 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.
pizzlies-0.2.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 to present, Marco Gorelli
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,210 @@
1
+ Metadata-Version: 2.4
2
+ Name: pizzlies
3
+ Version: 0.2.0
4
+ Summary: Pure-Python eager dataframes on dicts of lists, with the Narwhals API
5
+ License-Expression: MIT
6
+ License-File: LICENSE
7
+ Requires-Dist: narwhals>=2.30.0
8
+ Requires-Dist: backports-zstd ; python_full_version < '3.14' and extra == 'zstd'
9
+ Requires-Python: >=3.10
10
+ Project-URL: Homepage, https://github.com/narwhals-dev/narwhals
11
+ Project-URL: Repository, https://github.com/narwhals-dev/narwhals
12
+ Provides-Extra: zstd
13
+ Description-Content-Type: text/markdown
14
+
15
+ # pizzlies
16
+
17
+ A pure-Python dataframe library, whose only dependency is
18
+ [Narwhals](https://github.com/narwhals-dev/narwhals), with Narwhals' API. Its eager frames
19
+ are plain `dict[str, list]`s, and it has lazy frames with projection pushdown.
20
+
21
+ ```console
22
+ pip install pizzlies
23
+ ```
24
+
25
+ ## Standalone
26
+
27
+ `pizzlies` re-exports Narwhals' API, with its constructors bound to this backend:
28
+
29
+ ```python
30
+ import pizzlies as pz
31
+
32
+ df = pz.from_dict({"a": [1, 2, 3], "b": [4.0, None, 6.0]})
33
+ df.with_columns(c=pz.col("a") * 2).select(pz.col("c").sum(), pz.col("b").mean())
34
+ df.to_native() # {'a': [1, 2, 3], 'b': [4.0, None, 6.0]}
35
+ ```
36
+
37
+ `pz.from_dict`, `pz.from_dicts`, `pz.from_numpy`, `pz.from_arrow`, `pz.new_series`,
38
+ `pz.read_csv`, `pz.read_parquet` and `pz.scan_parquet` create
39
+ `pizzlies`-backed objects. Everything else (`pz.col`, `pz.when`, `pz.concat`,
40
+ `pz.selectors`, the dtypes, ...) is Narwhals' own, so see the
41
+ [Narwhals docs](https://narwhals-dev.github.io/narwhals/) for the full API.
42
+
43
+ ## Lazy frames
44
+
45
+ `df.lazy()` and `pz.scan_parquet` return lazy frames, which record operations in a query
46
+ plan instead of running them. There's no `scan_csv`, as `pizzlies` only reads CSV files
47
+ whole: use `pz.read_csv(...).lazy()`. `collect()` first works out which columns the query
48
+ reads (projection pushdown), so that `scan_parquet` only decodes those, and then runs the
49
+ plan eagerly:
50
+
51
+ ```python
52
+ lf = pz.scan_parquet("lineitem.parquet") # reads only the footer
53
+ result = lf.filter(pz.col("l_quantity") > 45).select(pz.col("l_extendedprice").sum())
54
+ print(result.to_native().explain()) # the plan, as a tree
55
+ result.collect() # reads `l_quantity` and `l_extendedprice` only
56
+ ```
57
+
58
+ There are no other optimisations, and `collect()` runs the plan every time. Errors in
59
+ the query are raised on `collect()`, as in Polars: errors which only depend on column
60
+ names (e.g. a missing or duplicate column) before anything is read, and others while the
61
+ plan runs. Some are raised straight away though: `scan_parquet` reads the file's footer
62
+ (and checks `columns` against it), and some Narwhals methods check column names, e.g.
63
+ `cast`, so name errors can also come from those. So, unlike in eager mode, a query with
64
+ both kinds of error raises the name error. `explain()` shows a subplan used more than
65
+ once only once, and refers to it by number after that.
66
+
67
+ `columns`, `collect_schema()` and dtype selectors never run the plan: dtypes are worked
68
+ out from the operations (see [Dtypes](#dtypes)).
69
+
70
+ Inputs keep every column whenever it's unclear which ones an expression reads (for
71
+ selectors, `all()`, `nth` and `exclude`), and also for `unique()` and `drop_nulls()`
72
+ without a subset, diagonal and horizontal `concat`, and `unpivot` without `on`. Vertical
73
+ `concat` does prune its inputs, so it only checks that the dtypes of the columns which
74
+ the query reads match: unlike in eager mode, other columns may differ.
75
+
76
+ ## Dtypes
77
+
78
+ Frames, eager and lazy, know their dtypes without looking at their values, except where
79
+ they're made from data:
80
+
81
+ - `pz.read_parquet` and `pz.scan_parquet` take them from the file's metadata, and
82
+ `pz.from_arrow` from the Arrow schema (maps become lists of
83
+ `{"key": ..., "value": ...}` structs).
84
+ - Frames made from Python objects (`pz.from_dict`, `pz.read_csv`, `nw.from_native` on
85
+ a dict, ...) infer them from the first 100 rows: a column without values there is
86
+ `Unknown` (so dtype selectors don't select it), even if later rows have some.
87
+ - Every other frame gets them from its inputs', by rules for each operation. Where a
88
+ rule can't tell (e.g. `pz.lit(None)`), the dtype is `Unknown`, except that eager
89
+ frames then infer it from the first 100 rows, as above (e.g. for `map_batches`
90
+ without `return_dtype`, and for `pivot`).
91
+
92
+ The dtypes are those `pizzlies` uses for values, e.g. every integer dtype is `Int64`,
93
+ and every float dtype `Float64`. As in Polars, they don't depend on the data: e.g.
94
+ `pz.col("a").fill_null(1.5)` on an integer column is `Float64` (so its values become
95
+ floats), even if it has no nulls to fill, and a column keeps its dtype when a filter
96
+ leaves it without values. Series taken from a frame (e.g. `df["a"]`) have the frame's
97
+ dtype, as do those made with `pz.new_series(..., dtype=...)`, and results of operations
98
+ on them get theirs by the same rules. Other Series' dtypes are inferred from their
99
+ values.
100
+
101
+ ## As a Narwhals plugin
102
+
103
+ Narwhals discovers the plugin automatically, so a dict of lists can be passed straight to
104
+ `nw.from_native`, and `backend="pizzlies"` (or `backend=pz.BACKEND`) works wherever Narwhals
105
+ accepts a `backend`:
106
+
107
+ ```python
108
+ import narwhals as nw
109
+
110
+ df = nw.from_native({"a": [1, 2, 3]}, eager_only=True)
111
+ df.select(nw.col("a").sum()).to_native() # {'a': [6]}
112
+ ```
113
+
114
+ Note that, once installed, `pizzlies` claims every plain `dict` passed to `nw.from_native`.
115
+
116
+ ## Size, import time and performance
117
+
118
+ `pizzlies` is small and quick to import, but it's pure Python, so it's much slower than
119
+ Polars on anything but small data.
120
+
121
+ | | Installed size | Import time |
122
+ | --- | ---: | ---: |
123
+ | `pizzlies` (+ `narwhals`) | 0.3 MB (+ 2.1 MB) | 40 ms |
124
+ | `polars` (+ `polars-runtime-32`) | 183 MB | 125 ms |
125
+ | `pyarrow` | 171 MB | 144 ms |
126
+ | `pandas` (+ `numpy`) | 96 MB | 365 ms |
127
+
128
+ The `pizzlies` wheel is 74 KB. Import times are the median of 40 fresh interpreters, from
129
+ wheel installs; almost all of `pizzlies`' is importing Narwhals (34 ms on its own).
130
+
131
+ On the 22 [TPC-H](https://github.com/narwhals-dev/narwhals/tree/main/tpch) queries at
132
+ scale factor 0.1 (`lineitem` has 600,000 rows), run through Narwhals end to end, including
133
+ reading the Parquet files (`scan_parquet`, query, `collect` for lazy frames; `read_parquet`
134
+ and query for eager ones):
135
+
136
+ | | Total | Slowdown vs Polars lazy (geometric mean over queries) |
137
+ | --- | ---: | ---: |
138
+ | `polars` lazy | 0.76 s | 1x |
139
+ | `polars` eager | 2.95 s | 3.7x |
140
+ | `pizzlies` lazy | 10.6 s | 11.9x |
141
+ | `pizzlies` eager | 27.5 s | 31.2x |
142
+
143
+ Most of the gap between `pizzlies`' lazy and eager frames is reading: lazy frames only
144
+ decode the columns a query uses.
145
+
146
+ Measured on Linux x86-64 (AMD Ryzen AI 9 465), with Python 3.13 for import times and 3.14
147
+ for TPC-H, and pandas 3.1, Polars 2.1 and PyArrow 26. Results depend on your hardware and data, so measure your own workload.
148
+ `benchmark.py` reproduces the import times and TPC-H numbers, see its docstring.
149
+
150
+ ## Limitations
151
+
152
+ `pizzlies` may be stricter than Polars, but it's never silently wrong: where it doesn't
153
+ do what Polars does, it raises. For example, `unpivot` of columns with different dtypes
154
+ raises, where Polars casts them to a common dtype (integers with floats are fine). The
155
+ exceptions, where `pizzlies` follows Python instead, are listed below.
156
+
157
+ - **Parquet:** `pz.read_parquet` uses a small pure-Python reader. It handles flat and
158
+ nested (list, struct and map) columns, the `PLAIN`, dictionary, `RLE`,
159
+ `BYTE_STREAM_SPLIT` and `DELTA_*` encodings, and uncompressed, snappy, gzip, LZ4 and
160
+ zstd compression. Zstd, Polars' default, needs Python 3.14+ or
161
+ `pip install 'pizzlies[zstd]'`. Other files (e.g. brotli-compressed ones) raise
162
+ `NotImplementedError`: read them with pyarrow and convert them,
163
+ `pz.from_arrow(pq.read_table(path))`. Corrupt data raises `ValueError`, and page
164
+ checksums are verified when the writer stored them, though only for the columns read.
165
+ - **Dtypes** are those of the Python values, so e.g. integers are always `Int64`, see
166
+ [Dtypes](#dtypes). `Map` dtypes aren't supported, so maps are read as lists of
167
+ `{"key": ..., "value": ...}` structs, as Polars does.
168
+ - **NaN:** comparisons follow IEEE 754, as in Python: e.g. `NaN == NaN` and `NaN > 1.0`
169
+ are false, where Polars treats NaN as equal to itself and greater than any other
170
+ value. Sorting, `unique`, `group_by` and joins do treat NaN as Polars does.
171
+ - **Floats** follow Python in a few details: a `Float64` column can hold integers (e.g.
172
+ after `fill_null(1.5)` on an integer column), NaN casts to the string `"nan"` (Polars:
173
+ `"NaN"`), and `-5.0 % math.inf` is `inf` (Polars: NaN).
174
+ - **No columns, no rows:** a frame is a dict of lists, so one with no columns has no
175
+ rows either, e.g. `df.drop(*df.columns).with_columns(a=pz.lit(1))` is empty.
176
+ - **Data isn't copied,** as with Narwhals and any backend: `nw.from_native(data)` wraps
177
+ your dict as it is, so later changes to it show up in the frame, and results share the
178
+ lists of columns they leave unchanged with their inputs. `.lazy()` copies which
179
+ columns there are, but not their lists. Don't modify the lists of a frame (or of the
180
+ dict it was built from) in place.
181
+ - **Time zones:** like Python, and unlike Polars, `pizzlies` ignores `fold` when comparing
182
+ time-zone aware datetimes, so the two occurrences of an ambiguous wall time (e.g. 01:30
183
+ when clocks go back) are equal in group-bys, joins and `unique`.
184
+
185
+ ## Development
186
+
187
+ The public API lives in `pizzlies/__init__.py`, and the Narwhals-compliant implementation in
188
+ the private `pizzlies._plugin`. It only imports from Narwhals' public API
189
+ (`narwhals.compliant`, `narwhals.typing`, `narwhals.utils`, ...): anything it needs from
190
+ Narwhals' private modules is vendored in `pizzlies/_plugin/_vendored.py`. The exception is
191
+ expression metadata (`Expr._metadata`), which the plugin reads directly and which has no
192
+ stability guarantees, so the plugin needs to be kept in step with the Narwhals versions it
193
+ supports.
194
+
195
+ The package has its own environment and lock file, and is not part of the root uv workspace:
196
+ once installed, it claims every plain `dict`, which would clash with the in-repo
197
+ `test-plugin`.
198
+
199
+ `run_tests.py` runs, in this package's `.venv`, both this package's own tests and Narwhals'
200
+ test suite against the plugin. Narwhals tests which are known to fail (mostly
201
+ not-yet-implemented methods) are listed in `known_failures.txt` and deselected:
202
+
203
+ ```console
204
+ python packages/pizzlies/run_tests.py # excludes known failures
205
+ python packages/pizzlies/run_tests.py --all # includes known failures
206
+ python packages/pizzlies/run_tests.py --update # regenerate known_failures.txt
207
+ ```
208
+
209
+ `--update` exits non-zero if any test was added to the baseline, so new failures can't be
210
+ absorbed into it unnoticed.
@@ -0,0 +1,196 @@
1
+ # pizzlies
2
+
3
+ A pure-Python dataframe library, whose only dependency is
4
+ [Narwhals](https://github.com/narwhals-dev/narwhals), with Narwhals' API. Its eager frames
5
+ are plain `dict[str, list]`s, and it has lazy frames with projection pushdown.
6
+
7
+ ```console
8
+ pip install pizzlies
9
+ ```
10
+
11
+ ## Standalone
12
+
13
+ `pizzlies` re-exports Narwhals' API, with its constructors bound to this backend:
14
+
15
+ ```python
16
+ import pizzlies as pz
17
+
18
+ df = pz.from_dict({"a": [1, 2, 3], "b": [4.0, None, 6.0]})
19
+ df.with_columns(c=pz.col("a") * 2).select(pz.col("c").sum(), pz.col("b").mean())
20
+ df.to_native() # {'a': [1, 2, 3], 'b': [4.0, None, 6.0]}
21
+ ```
22
+
23
+ `pz.from_dict`, `pz.from_dicts`, `pz.from_numpy`, `pz.from_arrow`, `pz.new_series`,
24
+ `pz.read_csv`, `pz.read_parquet` and `pz.scan_parquet` create
25
+ `pizzlies`-backed objects. Everything else (`pz.col`, `pz.when`, `pz.concat`,
26
+ `pz.selectors`, the dtypes, ...) is Narwhals' own, so see the
27
+ [Narwhals docs](https://narwhals-dev.github.io/narwhals/) for the full API.
28
+
29
+ ## Lazy frames
30
+
31
+ `df.lazy()` and `pz.scan_parquet` return lazy frames, which record operations in a query
32
+ plan instead of running them. There's no `scan_csv`, as `pizzlies` only reads CSV files
33
+ whole: use `pz.read_csv(...).lazy()`. `collect()` first works out which columns the query
34
+ reads (projection pushdown), so that `scan_parquet` only decodes those, and then runs the
35
+ plan eagerly:
36
+
37
+ ```python
38
+ lf = pz.scan_parquet("lineitem.parquet") # reads only the footer
39
+ result = lf.filter(pz.col("l_quantity") > 45).select(pz.col("l_extendedprice").sum())
40
+ print(result.to_native().explain()) # the plan, as a tree
41
+ result.collect() # reads `l_quantity` and `l_extendedprice` only
42
+ ```
43
+
44
+ There are no other optimisations, and `collect()` runs the plan every time. Errors in
45
+ the query are raised on `collect()`, as in Polars: errors which only depend on column
46
+ names (e.g. a missing or duplicate column) before anything is read, and others while the
47
+ plan runs. Some are raised straight away though: `scan_parquet` reads the file's footer
48
+ (and checks `columns` against it), and some Narwhals methods check column names, e.g.
49
+ `cast`, so name errors can also come from those. So, unlike in eager mode, a query with
50
+ both kinds of error raises the name error. `explain()` shows a subplan used more than
51
+ once only once, and refers to it by number after that.
52
+
53
+ `columns`, `collect_schema()` and dtype selectors never run the plan: dtypes are worked
54
+ out from the operations (see [Dtypes](#dtypes)).
55
+
56
+ Inputs keep every column whenever it's unclear which ones an expression reads (for
57
+ selectors, `all()`, `nth` and `exclude`), and also for `unique()` and `drop_nulls()`
58
+ without a subset, diagonal and horizontal `concat`, and `unpivot` without `on`. Vertical
59
+ `concat` does prune its inputs, so it only checks that the dtypes of the columns which
60
+ the query reads match: unlike in eager mode, other columns may differ.
61
+
62
+ ## Dtypes
63
+
64
+ Frames, eager and lazy, know their dtypes without looking at their values, except where
65
+ they're made from data:
66
+
67
+ - `pz.read_parquet` and `pz.scan_parquet` take them from the file's metadata, and
68
+ `pz.from_arrow` from the Arrow schema (maps become lists of
69
+ `{"key": ..., "value": ...}` structs).
70
+ - Frames made from Python objects (`pz.from_dict`, `pz.read_csv`, `nw.from_native` on
71
+ a dict, ...) infer them from the first 100 rows: a column without values there is
72
+ `Unknown` (so dtype selectors don't select it), even if later rows have some.
73
+ - Every other frame gets them from its inputs', by rules for each operation. Where a
74
+ rule can't tell (e.g. `pz.lit(None)`), the dtype is `Unknown`, except that eager
75
+ frames then infer it from the first 100 rows, as above (e.g. for `map_batches`
76
+ without `return_dtype`, and for `pivot`).
77
+
78
+ The dtypes are those `pizzlies` uses for values, e.g. every integer dtype is `Int64`,
79
+ and every float dtype `Float64`. As in Polars, they don't depend on the data: e.g.
80
+ `pz.col("a").fill_null(1.5)` on an integer column is `Float64` (so its values become
81
+ floats), even if it has no nulls to fill, and a column keeps its dtype when a filter
82
+ leaves it without values. Series taken from a frame (e.g. `df["a"]`) have the frame's
83
+ dtype, as do those made with `pz.new_series(..., dtype=...)`, and results of operations
84
+ on them get theirs by the same rules. Other Series' dtypes are inferred from their
85
+ values.
86
+
87
+ ## As a Narwhals plugin
88
+
89
+ Narwhals discovers the plugin automatically, so a dict of lists can be passed straight to
90
+ `nw.from_native`, and `backend="pizzlies"` (or `backend=pz.BACKEND`) works wherever Narwhals
91
+ accepts a `backend`:
92
+
93
+ ```python
94
+ import narwhals as nw
95
+
96
+ df = nw.from_native({"a": [1, 2, 3]}, eager_only=True)
97
+ df.select(nw.col("a").sum()).to_native() # {'a': [6]}
98
+ ```
99
+
100
+ Note that, once installed, `pizzlies` claims every plain `dict` passed to `nw.from_native`.
101
+
102
+ ## Size, import time and performance
103
+
104
+ `pizzlies` is small and quick to import, but it's pure Python, so it's much slower than
105
+ Polars on anything but small data.
106
+
107
+ | | Installed size | Import time |
108
+ | --- | ---: | ---: |
109
+ | `pizzlies` (+ `narwhals`) | 0.3 MB (+ 2.1 MB) | 40 ms |
110
+ | `polars` (+ `polars-runtime-32`) | 183 MB | 125 ms |
111
+ | `pyarrow` | 171 MB | 144 ms |
112
+ | `pandas` (+ `numpy`) | 96 MB | 365 ms |
113
+
114
+ The `pizzlies` wheel is 74 KB. Import times are the median of 40 fresh interpreters, from
115
+ wheel installs; almost all of `pizzlies`' is importing Narwhals (34 ms on its own).
116
+
117
+ On the 22 [TPC-H](https://github.com/narwhals-dev/narwhals/tree/main/tpch) queries at
118
+ scale factor 0.1 (`lineitem` has 600,000 rows), run through Narwhals end to end, including
119
+ reading the Parquet files (`scan_parquet`, query, `collect` for lazy frames; `read_parquet`
120
+ and query for eager ones):
121
+
122
+ | | Total | Slowdown vs Polars lazy (geometric mean over queries) |
123
+ | --- | ---: | ---: |
124
+ | `polars` lazy | 0.76 s | 1x |
125
+ | `polars` eager | 2.95 s | 3.7x |
126
+ | `pizzlies` lazy | 10.6 s | 11.9x |
127
+ | `pizzlies` eager | 27.5 s | 31.2x |
128
+
129
+ Most of the gap between `pizzlies`' lazy and eager frames is reading: lazy frames only
130
+ decode the columns a query uses.
131
+
132
+ Measured on Linux x86-64 (AMD Ryzen AI 9 465), with Python 3.13 for import times and 3.14
133
+ for TPC-H, and pandas 3.1, Polars 2.1 and PyArrow 26. Results depend on your hardware and data, so measure your own workload.
134
+ `benchmark.py` reproduces the import times and TPC-H numbers, see its docstring.
135
+
136
+ ## Limitations
137
+
138
+ `pizzlies` may be stricter than Polars, but it's never silently wrong: where it doesn't
139
+ do what Polars does, it raises. For example, `unpivot` of columns with different dtypes
140
+ raises, where Polars casts them to a common dtype (integers with floats are fine). The
141
+ exceptions, where `pizzlies` follows Python instead, are listed below.
142
+
143
+ - **Parquet:** `pz.read_parquet` uses a small pure-Python reader. It handles flat and
144
+ nested (list, struct and map) columns, the `PLAIN`, dictionary, `RLE`,
145
+ `BYTE_STREAM_SPLIT` and `DELTA_*` encodings, and uncompressed, snappy, gzip, LZ4 and
146
+ zstd compression. Zstd, Polars' default, needs Python 3.14+ or
147
+ `pip install 'pizzlies[zstd]'`. Other files (e.g. brotli-compressed ones) raise
148
+ `NotImplementedError`: read them with pyarrow and convert them,
149
+ `pz.from_arrow(pq.read_table(path))`. Corrupt data raises `ValueError`, and page
150
+ checksums are verified when the writer stored them, though only for the columns read.
151
+ - **Dtypes** are those of the Python values, so e.g. integers are always `Int64`, see
152
+ [Dtypes](#dtypes). `Map` dtypes aren't supported, so maps are read as lists of
153
+ `{"key": ..., "value": ...}` structs, as Polars does.
154
+ - **NaN:** comparisons follow IEEE 754, as in Python: e.g. `NaN == NaN` and `NaN > 1.0`
155
+ are false, where Polars treats NaN as equal to itself and greater than any other
156
+ value. Sorting, `unique`, `group_by` and joins do treat NaN as Polars does.
157
+ - **Floats** follow Python in a few details: a `Float64` column can hold integers (e.g.
158
+ after `fill_null(1.5)` on an integer column), NaN casts to the string `"nan"` (Polars:
159
+ `"NaN"`), and `-5.0 % math.inf` is `inf` (Polars: NaN).
160
+ - **No columns, no rows:** a frame is a dict of lists, so one with no columns has no
161
+ rows either, e.g. `df.drop(*df.columns).with_columns(a=pz.lit(1))` is empty.
162
+ - **Data isn't copied,** as with Narwhals and any backend: `nw.from_native(data)` wraps
163
+ your dict as it is, so later changes to it show up in the frame, and results share the
164
+ lists of columns they leave unchanged with their inputs. `.lazy()` copies which
165
+ columns there are, but not their lists. Don't modify the lists of a frame (or of the
166
+ dict it was built from) in place.
167
+ - **Time zones:** like Python, and unlike Polars, `pizzlies` ignores `fold` when comparing
168
+ time-zone aware datetimes, so the two occurrences of an ambiguous wall time (e.g. 01:30
169
+ when clocks go back) are equal in group-bys, joins and `unique`.
170
+
171
+ ## Development
172
+
173
+ The public API lives in `pizzlies/__init__.py`, and the Narwhals-compliant implementation in
174
+ the private `pizzlies._plugin`. It only imports from Narwhals' public API
175
+ (`narwhals.compliant`, `narwhals.typing`, `narwhals.utils`, ...): anything it needs from
176
+ Narwhals' private modules is vendored in `pizzlies/_plugin/_vendored.py`. The exception is
177
+ expression metadata (`Expr._metadata`), which the plugin reads directly and which has no
178
+ stability guarantees, so the plugin needs to be kept in step with the Narwhals versions it
179
+ supports.
180
+
181
+ The package has its own environment and lock file, and is not part of the root uv workspace:
182
+ once installed, it claims every plain `dict`, which would clash with the in-repo
183
+ `test-plugin`.
184
+
185
+ `run_tests.py` runs, in this package's `.venv`, both this package's own tests and Narwhals'
186
+ test suite against the plugin. Narwhals tests which are known to fail (mostly
187
+ not-yet-implemented methods) are listed in `known_failures.txt` and deselected:
188
+
189
+ ```console
190
+ python packages/pizzlies/run_tests.py # excludes known failures
191
+ python packages/pizzlies/run_tests.py --all # includes known failures
192
+ python packages/pizzlies/run_tests.py --update # regenerate known_failures.txt
193
+ ```
194
+
195
+ `--update` exits non-zero if any test was added to the baseline, so new failures can't be
196
+ absorbed into it unnoticed.
@@ -0,0 +1,47 @@
1
+ [build-system]
2
+ requires = ["uv_build>=0.11.0,<0.13.0"]
3
+ build-backend = "uv_build"
4
+
5
+ [project]
6
+ name = "pizzlies"
7
+ version = "0.2.0"
8
+ description = "Pure-Python eager dataframes on dicts of lists, with the Narwhals API"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ requires-python = ">=3.10"
13
+ dependencies = ["narwhals>=2.30.0"]
14
+
15
+ [project.optional-dependencies]
16
+ zstd = ["backports.zstd; python_version < '3.14'"]
17
+
18
+ [project.urls]
19
+ Homepage = "https://github.com/narwhals-dev/narwhals"
20
+ Repository = "https://github.com/narwhals-dev/narwhals"
21
+
22
+ [project.entry-points."narwhals.plugins"]
23
+ pizzlies = "pizzlies"
24
+
25
+ [dependency-groups]
26
+ tests = [
27
+ "backports.zstd; python_version < '3.14'",
28
+ "covdefaults",
29
+ "hypothesis>=6.0.0",
30
+ "numpy",
31
+ "packaging>=21.3",
32
+ "pandas",
33
+ "polars",
34
+ "pyarrow",
35
+ "pytest>=9.0.3",
36
+ "pytest-cov",
37
+ "pytest-env",
38
+ "pytest-randomly",
39
+ "pytest-xdist",
40
+ ]
41
+
42
+ [tool.uv]
43
+ default-groups = ["tests"]
44
+
45
+ [tool.uv.sources.narwhals]
46
+ path = "../.."
47
+ editable = true
@@ -0,0 +1,48 @@
1
+ [build-system]
2
+ requires = ["uv_build>=0.11.0,<0.13.0"]
3
+ build-backend = "uv_build"
4
+
5
+ [project]
6
+ name = "pizzlies"
7
+ version = "0.2.0"
8
+ description = "Pure-Python eager dataframes on dicts of lists, with the Narwhals API"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ requires-python = ">=3.10"
13
+ dependencies = ["narwhals>=2.30.0"]
14
+
15
+ [project.optional-dependencies]
16
+ # Zstd-compressed Parquet (Polars' default) on Python < 3.14, which lacks `compression.zstd`.
17
+ zstd = ["backports.zstd; python_version < '3.14'"]
18
+
19
+ [project.urls]
20
+ Homepage = "https://github.com/narwhals-dev/narwhals"
21
+ Repository = "https://github.com/narwhals-dev/narwhals"
22
+
23
+ [project.entry-points.'narwhals.plugins']
24
+ pizzlies = 'pizzlies'
25
+
26
+ [dependency-groups]
27
+ # For running Narwhals' own test suite against this plugin, see the README.
28
+ tests = [
29
+ "backports.zstd; python_version < '3.14'",
30
+ "covdefaults",
31
+ "hypothesis>=6.0.0",
32
+ "numpy",
33
+ "packaging>=21.3",
34
+ "pandas",
35
+ "polars",
36
+ "pyarrow",
37
+ "pytest>=9.0.3",
38
+ "pytest-cov",
39
+ "pytest-env",
40
+ "pytest-randomly",
41
+ "pytest-xdist",
42
+ ]
43
+
44
+ [tool.uv]
45
+ default-groups = ["tests"]
46
+
47
+ [tool.uv.sources]
48
+ narwhals = { path = "../..", editable = true }