Commit 53c9872
feat(pkg-py): Replace pandas with narwhals (#175)
* feat(pkg-py): Replace pandas dependency with narwhals abstraction layer
Remove pandas as a required dependency in favor of narwhals, which provides
a unified DataFrame interface supporting both pandas and polars backends.
Changes:
- Add _df_compat.py module with read_csv, read_sql, and duckdb_result_to_nw helpers
- Update DataSource classes to return narwhals DataFrames
- Update df_to_html to generate HTML without pandas dependency
- Make pandas and polars optional dependencies
- Add comprehensive tests for DataFrameSource and df_compat module
Users can now install with either `pip install querychat[pandas]` or
`pip install querychat[polars]`. Use `.to_native()` on returned DataFrames
to get the underlying pandas or polars DataFrame.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Update CLAUDE.md
* feat(pkg-py): Use great_tables for DataFrame HTML rendering
Replace manual HTML table construction in df_to_html() with great_tables
GT class for richer, styled table output in chat messages.
- Add great-tables>=0.16.0 as a dependency
- Simplify df_to_html() to use GT().as_raw_html()
- Remove manual _escape_html helper (great_tables handles escaping)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(pkg-py): Pass client method reference to mod_server
Passing self.client() (calling the method) resulted in tools being
registered twice - once in client() and again in mod_server. Instead,
pass self.client (the method reference) so mod_server can call it with
the update_dashboard and reset_dashboard callbacks.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>1 parent 9ecc34a commit 53c9872
File tree
17 files changed
+632
-118
lines changed- pkg-py
- docs
- src/querychat
- data
- tests
17 files changed
+632
-118
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
72 | 80 | | |
73 | 81 | | |
74 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
10 | 16 | | |
11 | 17 | | |
12 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
223 | | - | |
| 223 | + | |
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
| |||
59 | 58 | | |
60 | 59 | | |
61 | 60 | | |
62 | | - | |
| 61 | + | |
63 | 62 | | |
64 | 63 | | |
65 | 64 | | |
| |||
71 | 70 | | |
72 | 71 | | |
73 | 72 | | |
74 | | - | |
| 73 | + | |
75 | 74 | | |
76 | 75 | | |
77 | 76 | | |
78 | 77 | | |
79 | 78 | | |
80 | 79 | | |
81 | 80 | | |
82 | | - | |
| 81 | + | |
83 | 82 | | |
84 | 83 | | |
85 | 84 | | |
| |||
94 | 93 | | |
95 | 94 | | |
96 | 95 | | |
97 | | - | |
| 96 | + | |
98 | 97 | | |
99 | 98 | | |
100 | 99 | | |
| |||
105 | 104 | | |
106 | 105 | | |
107 | 106 | | |
108 | | - | |
| 107 | + | |
109 | 108 | | |
110 | 109 | | |
111 | 110 | | |
112 | 111 | | |
113 | 112 | | |
114 | 113 | | |
115 | | - | |
| 114 | + | |
116 | 115 | | |
117 | 116 | | |
118 | 117 | | |
| |||
133 | 132 | | |
134 | 133 | | |
135 | 134 | | |
136 | | - | |
| 135 | + | |
137 | 136 | | |
138 | | - | |
| 137 | + | |
139 | 138 | | |
140 | | - | |
| 139 | + | |
141 | 140 | | |
142 | | - | |
| 141 | + | |
143 | 142 | | |
144 | 143 | | |
145 | 144 | | |
146 | 145 | | |
147 | | - | |
| 146 | + | |
148 | 147 | | |
149 | 148 | | |
150 | 149 | | |
151 | 150 | | |
152 | | - | |
| 151 | + | |
153 | 152 | | |
154 | 153 | | |
155 | 154 | | |
156 | | - | |
157 | | - | |
| 155 | + | |
158 | 156 | | |
159 | 157 | | |
160 | 158 | | |
| |||
203 | 201 | | |
204 | 202 | | |
205 | 203 | | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
| 204 | + | |
| 205 | + | |
216 | 206 | | |
217 | 207 | | |
218 | 208 | | |
| |||
228 | 218 | | |
229 | 219 | | |
230 | 220 | | |
231 | | - | |
232 | 221 | | |
233 | | - | |
| 222 | + | |
234 | 223 | | |
235 | 224 | | |
236 | 225 | | |
237 | 226 | | |
238 | | - | |
239 | | - | |
240 | 227 | | |
241 | | - | |
| 228 | + | |
242 | 229 | | |
243 | 230 | | |
244 | 231 | | |
| |||
248 | 235 | | |
249 | 236 | | |
250 | 237 | | |
251 | | - | |
| 238 | + | |
252 | 239 | | |
253 | 240 | | |
254 | 241 | | |
| 242 | + | |
| 243 | + | |
255 | 244 | | |
256 | 245 | | |
257 | 246 | | |
| |||
260 | 249 | | |
261 | 250 | | |
262 | 251 | | |
263 | | - | |
| 252 | + | |
264 | 253 | | |
265 | 254 | | |
266 | 255 | | |
| |||
269 | 258 | | |
270 | 259 | | |
271 | 260 | | |
272 | | - | |
| 261 | + | |
273 | 262 | | |
274 | 263 | | |
275 | 264 | | |
276 | | - | |
| 265 | + | |
277 | 266 | | |
278 | 267 | | |
279 | 268 | | |
| |||
298 | 287 | | |
299 | 288 | | |
300 | 289 | | |
301 | | - | |
| 290 | + | |
302 | 291 | | |
303 | 292 | | |
304 | 293 | | |
| |||
316 | 305 | | |
317 | 306 | | |
318 | 307 | | |
319 | | - | |
| 308 | + | |
320 | 309 | | |
321 | 310 | | |
322 | 311 | | |
323 | 312 | | |
324 | 313 | | |
325 | 314 | | |
326 | | - | |
| 315 | + | |
327 | 316 | | |
328 | 317 | | |
329 | | - | |
330 | | - | |
| 318 | + | |
331 | 319 | | |
332 | 320 | | |
333 | 321 | | |
| |||
519 | 507 | | |
520 | 508 | | |
521 | 509 | | |
522 | | - | |
| 510 | + | |
523 | 511 | | |
524 | 512 | | |
525 | 513 | | |
| 514 | + | |
| 515 | + | |
526 | 516 | | |
527 | 517 | | |
528 | 518 | | |
| |||
531 | 521 | | |
532 | 522 | | |
533 | 523 | | |
534 | | - | |
| 524 | + | |
535 | 525 | | |
536 | 526 | | |
537 | 527 | | |
| |||
541 | 531 | | |
542 | 532 | | |
543 | 533 | | |
544 | | - | |
| 534 | + | |
545 | 535 | | |
546 | 536 | | |
547 | 537 | | |
548 | | - | |
| 538 | + | |
549 | 539 | | |
550 | 540 | | |
551 | 541 | | |
| |||
571 | 561 | | |
572 | 562 | | |
573 | 563 | | |
574 | | - | |
| 564 | + | |
575 | 565 | | |
576 | 566 | | |
577 | | - | |
| 567 | + | |
578 | 568 | | |
579 | 569 | | |
580 | | - | |
| 570 | + | |
581 | 571 | | |
582 | 572 | | |
583 | | - | |
| 573 | + | |
584 | 574 | | |
585 | 575 | | |
586 | 576 | | |
| |||
595 | 585 | | |
596 | 586 | | |
597 | 587 | | |
598 | | - | |
| 588 | + | |
599 | 589 | | |
600 | | - | |
| 590 | + | |
601 | 591 | | |
602 | 592 | | |
603 | 593 | | |
604 | 594 | | |
605 | 595 | | |
606 | 596 | | |
607 | | - | |
| 597 | + | |
608 | 598 | | |
609 | 599 | | |
610 | 600 | | |
| |||
0 commit comments