df2tables 0.3.4__tar.gz → 0.4.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: df2tables
3
- Version: 0.3.4
3
+ Version: 0.4.0
4
4
  Summary: df2tables: Pandas and Polars DataFrames to Interactive DataTables
5
5
  Project-URL: Homepage, https://github.com/ts-kontakt/df2tables
6
6
  Project-URL: Issues, https://github.com/ts-kontakt/df2tables/issues
@@ -27,7 +27,7 @@ Description-Content-Type: text/markdown
27
27
 
28
28
  By rendering tables directly from JavaScript arrays, this tool delivers **fast performance and compact file sizes**, enabling smooth browsing of large datasets while maintaining full responsiveness. For datasets where you'd rather not embed the rows at all, `render_ajax()` lets the same table fetch its data from an API endpoint at runtime instead - see [Main Functions](#main-functions).
29
29
 
30
- **Minimal dependencies**: only `pandas` ***or*** `polars` (you don’t need pandas installed if using polars).
30
+ **Zero dependencies** - you just need `pandas` ***or*** `polars` installed (you don’t need pandas if using polars).
31
31
 
32
32
  Converting a DataFrame to an interactive table takes just one function call:
33
33
 
@@ -41,13 +41,13 @@ render_ajax(df, data_url, **kwargs)
41
41
 
42
42
  ## Features
43
43
 
44
- - Converts `pandas` and `polars` DataFrames into interactive standalone HTML tables
44
+ - Converts `pandas` and `polars` DataFrames into interactive standalone HTML tables
45
45
  - **Web Framework Ready**: Specifically designed for easy embedding in Flask, Django, FastAPI, and other web frameworks
46
46
  - **On-demand / AJAX loading**: `render_ajax()` renders a table whose rows are fetched from an API endpoint at runtime (paired with `to_js_array()` on the server side) instead of being embedded in the page at generation time
47
- - Browse **large datasets** using filters and sorting
48
- - Works **independently of Jupyter** or a running web server (though [notebook](#rendering-in-notebook) rendering is supported)
47
+ - Browse **large datasets** using filters and sorting
48
+ - Works **independently of Jupyter** or a running web server (though [notebook](#rendering-in-notebook) rendering is supported)
49
49
  - Useful for training dataset inspection and feature engineering: Quickly browse through large datasets, identify outliers, and catch data quality issues interactively
50
- - **Customization**: [Configuring DataTables from Python](#configure-datatables-directly-from-python-using-js_opts)
50
+ - **Customization**: [Configuring DataTables from Python](#configure-datatables-directly-from-python-using-js_opts)
51
51
 
52
52
  ## Screenshots
53
53
 
@@ -149,6 +149,8 @@ df2t.render(
149
149
  - `scroll_collapse` (bool): Collapse the container height when there are fewer rows than `scroll_y` (default: True)
150
150
  - `list_preview` (int): How many elements of a list/dict cell are shown in its basic preview before the tail is elided (default: 5)
151
151
  - `paging_warn_limit` (int | None): Row-count threshold for the in-page performance warning when paging is disabled; `None` keeps the template default (500) (default: None)
152
+ - `fragment_css` (bool): Include the portable layout `<style>` block in inline fragments; set to `False` when the host page styles the table itself (default: True)
153
+ - `table_theme` (str | None): Apply a visual theme - `"condensed"` or `"narrow"`; `None` is the built-in look (see [Table themes](#table-themes)) (default: None)
152
154
 
153
155
  **Returns:**
154
156
 
@@ -164,7 +166,7 @@ df2t.render(
164
166
  - `RuntimeError`: If the template cannot be read or rendered
165
167
  - `OSError`: If the output file at `to_file` cannot be written
166
168
 
167
- > All of the above now raise unconditionally - see [Error Handling](#error-handling) for what changed.
169
+ > All of the above raise unconditionally - see [Error Handling](#error-handling).
168
170
 
169
171
  ---
170
172
 
@@ -186,12 +188,14 @@ This function is designed for integration with web applications and has the foll
186
188
  - Returns only the `<table>` markup and the associated JavaScript
187
189
  - Excludes `<html>`, `<head>`, and `<body>` tags
188
190
  - Useful for pages with multiple tables, as you can assign unique IDs via the `table_attrs` dictionary (e.g., `{'id': 'my-unique-table'}`)
189
- - By default (`add_scripts=False`), the snippet does not include jQuery or DataTables library dependencies. You must include them manually in your host HTML page for the table to function correctly. Set `add_scripts=True` to prepend the CDN `<link>`/`<script>` assets to the returned snippet.
191
+ - By default (`add_scripts=False`), the snippet does not include the DataTables library or its extension assets - you must include them manually in your host HTML page for the table to work. Set `add_scripts=True` to prepend the CDN `<link>`/`<script>` assets to the returned snippet.
190
192
 
191
193
  The **`table_attrs`** argument accepts a dictionary of HTML table attributes, such as an ID or CSS class. This is especially useful for multiple tables on a single page (each must have a different ID). For `render_inline`, use `table_attrs` instead of the `render_opts['table_id']` option. If you don't pass an `id`, each call generates its own unique one automatically.
192
194
 
193
195
  **Note:** Some arguments from `render()` are not applicable here, such as `title`, `display_logo`, or `startfile`, because the returned HTML contains only the table element and its initialization script.
194
196
 
197
+ **Fragment stylesheet:** a fragment ships a small `<style>` block of its own with the table *layout* rules (content-wide table, margin reset, cell truncation), scoped to `table.dataTable.df2t` so the host page's tables are never touched. Turn it off with `render_opts={"fragment_css": False}` when the host page styles the table itself; the AJAX loader CSS still ships. To override a single declaration, use a more specific host rule, e.g. `#my-page .df2t td { max-width: 30em }`.
198
+
195
199
  **Example:**
196
200
 
197
201
  See an example of multiple tables with different configuration options placed in separate tabs (jQuery UI Tabs): [flask_multiple_tables_tabs.py](https://github.com/ts-kontakt/df2tables/blob/main/flask_multiple_tables_tabs.py)
@@ -216,6 +220,7 @@ df2t.render_ajax(
216
220
  button_label: str = "Load data",
217
221
  autoload: bool = False,
218
222
  fetch_opts: Optional[dict] = None,
223
+ status_messages: Optional[dict] = None,
219
224
  render_opts: Optional[dict] = None,
220
225
  js_opts: Optional[dict] = None,
221
226
  templ_path: str = TEMPLATE_PATH,
@@ -243,7 +248,29 @@ By default it returns an **inline fragment**, the same shape as `render_inline()
243
248
  - `button_label`: label of the "load data" button, used only when `autoload=False` (default: "Load data")
244
249
  - `autoload`: if `True`, rows are fetched immediately with no button - a pulsing "Loading data…" indicator is shown, with a Retry button shown only on failure. If `False` (default), the rows are fetched on click of the `button_label` button
245
250
  - `fetch_opts`: dict merged into the `fetch()` call's options (defaults to `{"credentials": "same-origin"}`)
246
- - `templ_path`: path to the HTML template - a custom template must contain the same comnt tags as the bundled `datatable_templ.html`, **including the AJAX loader regions and the `data_url` / `button_label` / `autoload` / `fetch_opts` tags** (see [Custom Templates](#custom-templates))
251
+ - `status_messages`: texts of the loader status line. `None` (default) = English defaults; `False` = every message switched off; or a dict overriding single entries. An empty string switches that message off. The texts are **HTML** and support the placeholders `{n}` (row count) and `{error}` (error message), so a fully translated page is one argument away:
252
+
253
+ | key | default |
254
+ |---|---|
255
+ | `loading` | `Loading data…` (the spinner is prepended) |
256
+ | `loaded` | `Loaded <strong>{n}</strong> rows.` |
257
+ | `error` | `Failed to load data: {error}` |
258
+ | `retry` | `Retry` — `''` also means the autoload Retry button is never created |
259
+
260
+ ```python
261
+ # hide the redundant "Loaded N rows." (the page has its own KPI counters)
262
+ df2t.render_ajax(df, "/api/table", status_messages={"loaded": ""})
263
+ # Polish page, everything translated
264
+ df2t.render_ajax(df, "/api/table", status_messages={
265
+ "loading": "Trwa łączenie z CDN…",
266
+ "loaded": "Załadowano <strong>{n}</strong> wierszy.",
267
+ "error": "Nie udało się pobrać danych: {error}",
268
+ "retry": "Ponów",
269
+ })
270
+ # a silent loader (no status line at all)
271
+ df2t.render_ajax(df, "/api/table", autoload=True, status_messages=False)
272
+ ```
273
+ - `templ_path`: path to the HTML template - a custom template must contain the same comnt tags as the bundled `datatable_templ.html`, **including the AJAX loader regions and the `data_url` / `button_label` / `autoload` / `fetch_opts` tags** (see [Custom Templates](#custom-templates)). The `msg_loading` / `msg_loaded` / `msg_error` / `msg_retry` tags are optional: an older template without them simply keeps its own hard-coded texts (no error)
247
274
  - `full_page`: return a complete standalone HTML document instead of the default inline fragment
248
275
  - `add_scripts`: prepend the DataTables CDN `<link>`/`<script>` block (inline mode only; default: False)
249
276
  - `table_attrs`: extra HTML attributes for the `<table>` element (inline mode only). If you don't pin an `id` here (or via `render_opts['table_id']`), each call generates its own unique one automatically
@@ -345,6 +372,27 @@ The following are kept for backward compatibility but will be removed in a futur
345
372
  - `num_html` - renamed to `format_negatives`; pass `format_negatives=...` instead
346
373
  - `load_datatables()` - **removed** (it was a no-op and hasn't been needed since v0.1.8); any remaining import of it now fails - just delete it
347
374
 
375
+ ## Table themes
376
+
377
+ A ready-made visual style can be switched on with one option, in all three
378
+ modes (`render()`, `render_inline()`, `render_ajax()`):
379
+
380
+ ```python
381
+ df2tables.render(df, render_opts={"table_theme": "condensed"})
382
+ ```
383
+
384
+ Built-in themes (`list(df2tables.THEMES)`):
385
+
386
+ - **`condensed`** — dense look: condensed face throughout, zebra striping,
387
+ per-column separators.
388
+ - **`narrow`** — booktabs look: body keeps the default face, condensed header
389
+ band, no zebra.
390
+
391
+ A theme is a pure CSS layer on top of the layout — it never touches the data
392
+ or the DataTables features, works in fragments and full pages alike, and is
393
+ scoped to the table's own class (self-contained, no external font requests).
394
+ Widget chrome (search box, pager, …) and number formatting are not themed.
395
+
348
396
  ## Configure DataTables directly from Python using `js_opts`
349
397
 
350
398
  Customize DataTables behavior directly from Python using the `js_opts` parameter. This allows you to control [DataTables options](https://datatables.net/reference/option/) and [features](https://datatables.net/reference/feature/) without modifying the HTML template.
@@ -368,7 +416,7 @@ custom_cfg = {
368
416
  "layout": {
369
417
  "topStart": "info",
370
418
  "top1Start": "pageLength",
371
- "topEnd": "search",
419
+ "topEnd": "search",
372
420
  "bottomEnd": "paging"
373
421
  }
374
422
  }
@@ -379,12 +427,12 @@ df2t.render(df, js_opts=custom_cfg, to_file="localized_table.html")
379
427
 
380
428
  Disable pagination and enable vertical and horizontal scrolling for easier navigation of large datasets.
381
429
 
382
- _Note_: Using `scrollY` with disabled `paging` can be slow for large DataFrames. Rendering more than 500 rows with `paging: False` also triggers a performance-warning banner in the browser (that threshold isn't currently configurable from Python).
430
+ _Note_: Using `scrollY` with disabled `paging` can be slow for large DataFrames. Rendering more than 500 rows with `paging: False` also triggers a performance-warning banner in the browser - raise or lower that threshold with `render_opts={"paging_warn_limit": N}`.
383
431
  ```python
384
432
  scroll_cfg = {
385
433
  "paging": False, # slow for large tables
386
434
  "scrollCollapse": False,
387
- "scrollY": '50vh',
435
+ "scrollY": '50vh',
388
436
  "scrollX": "70vw"
389
437
  }
390
438
  df2t.render(df, js_opts=scroll_cfg, to_file="scrolling_table.html")
@@ -418,18 +466,12 @@ Invalid keys are ignored by DataTables, so malformed or non-existent options **u
418
466
 
419
467
  Some DataTables options require additional extensions (e.g., FixedColumns or FixedHeader). When using render(), availability depends on the extensions loaded by the default template. When using render_inline(), you must ensure the required DataTables extensions are loaded by your application. Otherwise, the related options will be ignored or may generate JavaScript console warnings.
420
468
 
421
-
422
- For best results, start with core features such as `layout` or `language` options before exploring more advanced configurations.
423
-
424
- For a complete list of available settings, refer to the official DataTables documentation and:
425
- https://datatables.net/examples/
426
-
427
- It’s best to start with the core DataTables Features before adding advanced configurations.
469
+ Start with core features such as `layout` or `language` before exploring more advanced configurations. For the full reference:
428
470
 
429
471
  * [Feature Reference](https://datatables.net/reference/feature/)
430
472
  * [Configuration Options Reference](https://datatables.net/reference/option/)
431
473
  * [Layout Configuration](https://datatables.net/reference/option/layout)
432
- * [Language configuration ](https://datatables.net/reference/option/language)
474
+ * [Language configuration](https://datatables.net/reference/option/language)
433
475
 
434
476
  ## Additional Notes
435
477
 
@@ -440,14 +482,14 @@ For better readability in table headers, `df2tables` automatically converts unde
440
482
  To disable this automatic word wrapping behavior, add the following CSS to your custom template:
441
483
 
442
484
  ```css
443
- span.dt-column-title {
444
- white-space: nowrap;
485
+ span.dt-column-title {
486
+ white-space: nowrap;
445
487
  }
446
488
  ```
447
489
 
448
490
  ### Bulk Dataset Processing
449
491
 
450
- For exploratory data analysis across multiple datasets, you can generate tables programmatically.
492
+ For exploratory data analysis across multiple datasets, you can generate tables programmatically.
451
493
  The example below uses the [vega_datasets](https://github.com/altair-viz/vega_datasets) package, which provides easy access to a variety of sample datasets commonly used in data visualization and analysis.
452
494
 
453
495
  *Note: Install vega_datasets with `pip install vega_datasets` to run this example.*
@@ -462,7 +504,7 @@ The module includes handling for:
462
504
  - **Column compatibility**: Automatically converts problematic column types to string representation
463
505
 
464
506
  ### Offline Usage
465
- *Note: "Offline" viewing assumes internet connectivity for CDN resources - DataTables core, the DataTables extensions in use (Buttons, ColReorder, ColumnControl, FixedColumns), and jQuery. For truly offline usage, modify the template to reference local copies of these libraries instead of CDN links.*
507
+ *Note: "Offline" viewing assumes internet connectivity for CDN resources - DataTables core (v3, dependency-free: no jQuery needed), the DataTables extensions in use (Buttons, ColReorder, ColumnControl, FixedColumns). For truly offline usage, modify the template to reference local copies of these libraries instead of CDN links.*
466
508
 
467
509
  ## Appendix: Template Customization
468
510
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  By rendering tables directly from JavaScript arrays, this tool delivers **fast performance and compact file sizes**, enabling smooth browsing of large datasets while maintaining full responsiveness. For datasets where you'd rather not embed the rows at all, `render_ajax()` lets the same table fetch its data from an API endpoint at runtime instead - see [Main Functions](#main-functions).
8
8
 
9
- **Minimal dependencies**: only `pandas` ***or*** `polars` (you don’t need pandas installed if using polars).
9
+ **Zero dependencies** - you just need `pandas` ***or*** `polars` installed (you don’t need pandas if using polars).
10
10
 
11
11
  Converting a DataFrame to an interactive table takes just one function call:
12
12
 
@@ -20,13 +20,13 @@ render_ajax(df, data_url, **kwargs)
20
20
 
21
21
  ## Features
22
22
 
23
- - Converts `pandas` and `polars` DataFrames into interactive standalone HTML tables
23
+ - Converts `pandas` and `polars` DataFrames into interactive standalone HTML tables
24
24
  - **Web Framework Ready**: Specifically designed for easy embedding in Flask, Django, FastAPI, and other web frameworks
25
25
  - **On-demand / AJAX loading**: `render_ajax()` renders a table whose rows are fetched from an API endpoint at runtime (paired with `to_js_array()` on the server side) instead of being embedded in the page at generation time
26
- - Browse **large datasets** using filters and sorting
27
- - Works **independently of Jupyter** or a running web server (though [notebook](#rendering-in-notebook) rendering is supported)
26
+ - Browse **large datasets** using filters and sorting
27
+ - Works **independently of Jupyter** or a running web server (though [notebook](#rendering-in-notebook) rendering is supported)
28
28
  - Useful for training dataset inspection and feature engineering: Quickly browse through large datasets, identify outliers, and catch data quality issues interactively
29
- - **Customization**: [Configuring DataTables from Python](#configure-datatables-directly-from-python-using-js_opts)
29
+ - **Customization**: [Configuring DataTables from Python](#configure-datatables-directly-from-python-using-js_opts)
30
30
 
31
31
  ## Screenshots
32
32
 
@@ -128,6 +128,8 @@ df2t.render(
128
128
  - `scroll_collapse` (bool): Collapse the container height when there are fewer rows than `scroll_y` (default: True)
129
129
  - `list_preview` (int): How many elements of a list/dict cell are shown in its basic preview before the tail is elided (default: 5)
130
130
  - `paging_warn_limit` (int | None): Row-count threshold for the in-page performance warning when paging is disabled; `None` keeps the template default (500) (default: None)
131
+ - `fragment_css` (bool): Include the portable layout `<style>` block in inline fragments; set to `False` when the host page styles the table itself (default: True)
132
+ - `table_theme` (str | None): Apply a visual theme - `"condensed"` or `"narrow"`; `None` is the built-in look (see [Table themes](#table-themes)) (default: None)
131
133
 
132
134
  **Returns:**
133
135
 
@@ -143,7 +145,7 @@ df2t.render(
143
145
  - `RuntimeError`: If the template cannot be read or rendered
144
146
  - `OSError`: If the output file at `to_file` cannot be written
145
147
 
146
- > All of the above now raise unconditionally - see [Error Handling](#error-handling) for what changed.
148
+ > All of the above raise unconditionally - see [Error Handling](#error-handling).
147
149
 
148
150
  ---
149
151
 
@@ -165,12 +167,14 @@ This function is designed for integration with web applications and has the foll
165
167
  - Returns only the `<table>` markup and the associated JavaScript
166
168
  - Excludes `<html>`, `<head>`, and `<body>` tags
167
169
  - Useful for pages with multiple tables, as you can assign unique IDs via the `table_attrs` dictionary (e.g., `{'id': 'my-unique-table'}`)
168
- - By default (`add_scripts=False`), the snippet does not include jQuery or DataTables library dependencies. You must include them manually in your host HTML page for the table to function correctly. Set `add_scripts=True` to prepend the CDN `<link>`/`<script>` assets to the returned snippet.
170
+ - By default (`add_scripts=False`), the snippet does not include the DataTables library or its extension assets - you must include them manually in your host HTML page for the table to work. Set `add_scripts=True` to prepend the CDN `<link>`/`<script>` assets to the returned snippet.
169
171
 
170
172
  The **`table_attrs`** argument accepts a dictionary of HTML table attributes, such as an ID or CSS class. This is especially useful for multiple tables on a single page (each must have a different ID). For `render_inline`, use `table_attrs` instead of the `render_opts['table_id']` option. If you don't pass an `id`, each call generates its own unique one automatically.
171
173
 
172
174
  **Note:** Some arguments from `render()` are not applicable here, such as `title`, `display_logo`, or `startfile`, because the returned HTML contains only the table element and its initialization script.
173
175
 
176
+ **Fragment stylesheet:** a fragment ships a small `<style>` block of its own with the table *layout* rules (content-wide table, margin reset, cell truncation), scoped to `table.dataTable.df2t` so the host page's tables are never touched. Turn it off with `render_opts={"fragment_css": False}` when the host page styles the table itself; the AJAX loader CSS still ships. To override a single declaration, use a more specific host rule, e.g. `#my-page .df2t td { max-width: 30em }`.
177
+
174
178
  **Example:**
175
179
 
176
180
  See an example of multiple tables with different configuration options placed in separate tabs (jQuery UI Tabs): [flask_multiple_tables_tabs.py](https://github.com/ts-kontakt/df2tables/blob/main/flask_multiple_tables_tabs.py)
@@ -195,6 +199,7 @@ df2t.render_ajax(
195
199
  button_label: str = "Load data",
196
200
  autoload: bool = False,
197
201
  fetch_opts: Optional[dict] = None,
202
+ status_messages: Optional[dict] = None,
198
203
  render_opts: Optional[dict] = None,
199
204
  js_opts: Optional[dict] = None,
200
205
  templ_path: str = TEMPLATE_PATH,
@@ -222,7 +227,29 @@ By default it returns an **inline fragment**, the same shape as `render_inline()
222
227
  - `button_label`: label of the "load data" button, used only when `autoload=False` (default: "Load data")
223
228
  - `autoload`: if `True`, rows are fetched immediately with no button - a pulsing "Loading data…" indicator is shown, with a Retry button shown only on failure. If `False` (default), the rows are fetched on click of the `button_label` button
224
229
  - `fetch_opts`: dict merged into the `fetch()` call's options (defaults to `{"credentials": "same-origin"}`)
225
- - `templ_path`: path to the HTML template - a custom template must contain the same comnt tags as the bundled `datatable_templ.html`, **including the AJAX loader regions and the `data_url` / `button_label` / `autoload` / `fetch_opts` tags** (see [Custom Templates](#custom-templates))
230
+ - `status_messages`: texts of the loader status line. `None` (default) = English defaults; `False` = every message switched off; or a dict overriding single entries. An empty string switches that message off. The texts are **HTML** and support the placeholders `{n}` (row count) and `{error}` (error message), so a fully translated page is one argument away:
231
+
232
+ | key | default |
233
+ |---|---|
234
+ | `loading` | `Loading data…` (the spinner is prepended) |
235
+ | `loaded` | `Loaded <strong>{n}</strong> rows.` |
236
+ | `error` | `Failed to load data: {error}` |
237
+ | `retry` | `Retry` — `''` also means the autoload Retry button is never created |
238
+
239
+ ```python
240
+ # hide the redundant "Loaded N rows." (the page has its own KPI counters)
241
+ df2t.render_ajax(df, "/api/table", status_messages={"loaded": ""})
242
+ # Polish page, everything translated
243
+ df2t.render_ajax(df, "/api/table", status_messages={
244
+ "loading": "Trwa łączenie z CDN…",
245
+ "loaded": "Załadowano <strong>{n}</strong> wierszy.",
246
+ "error": "Nie udało się pobrać danych: {error}",
247
+ "retry": "Ponów",
248
+ })
249
+ # a silent loader (no status line at all)
250
+ df2t.render_ajax(df, "/api/table", autoload=True, status_messages=False)
251
+ ```
252
+ - `templ_path`: path to the HTML template - a custom template must contain the same comnt tags as the bundled `datatable_templ.html`, **including the AJAX loader regions and the `data_url` / `button_label` / `autoload` / `fetch_opts` tags** (see [Custom Templates](#custom-templates)). The `msg_loading` / `msg_loaded` / `msg_error` / `msg_retry` tags are optional: an older template without them simply keeps its own hard-coded texts (no error)
226
253
  - `full_page`: return a complete standalone HTML document instead of the default inline fragment
227
254
  - `add_scripts`: prepend the DataTables CDN `<link>`/`<script>` block (inline mode only; default: False)
228
255
  - `table_attrs`: extra HTML attributes for the `<table>` element (inline mode only). If you don't pin an `id` here (or via `render_opts['table_id']`), each call generates its own unique one automatically
@@ -324,6 +351,27 @@ The following are kept for backward compatibility but will be removed in a futur
324
351
  - `num_html` - renamed to `format_negatives`; pass `format_negatives=...` instead
325
352
  - `load_datatables()` - **removed** (it was a no-op and hasn't been needed since v0.1.8); any remaining import of it now fails - just delete it
326
353
 
354
+ ## Table themes
355
+
356
+ A ready-made visual style can be switched on with one option, in all three
357
+ modes (`render()`, `render_inline()`, `render_ajax()`):
358
+
359
+ ```python
360
+ df2tables.render(df, render_opts={"table_theme": "condensed"})
361
+ ```
362
+
363
+ Built-in themes (`list(df2tables.THEMES)`):
364
+
365
+ - **`condensed`** — dense look: condensed face throughout, zebra striping,
366
+ per-column separators.
367
+ - **`narrow`** — booktabs look: body keeps the default face, condensed header
368
+ band, no zebra.
369
+
370
+ A theme is a pure CSS layer on top of the layout — it never touches the data
371
+ or the DataTables features, works in fragments and full pages alike, and is
372
+ scoped to the table's own class (self-contained, no external font requests).
373
+ Widget chrome (search box, pager, …) and number formatting are not themed.
374
+
327
375
  ## Configure DataTables directly from Python using `js_opts`
328
376
 
329
377
  Customize DataTables behavior directly from Python using the `js_opts` parameter. This allows you to control [DataTables options](https://datatables.net/reference/option/) and [features](https://datatables.net/reference/feature/) without modifying the HTML template.
@@ -347,7 +395,7 @@ custom_cfg = {
347
395
  "layout": {
348
396
  "topStart": "info",
349
397
  "top1Start": "pageLength",
350
- "topEnd": "search",
398
+ "topEnd": "search",
351
399
  "bottomEnd": "paging"
352
400
  }
353
401
  }
@@ -358,12 +406,12 @@ df2t.render(df, js_opts=custom_cfg, to_file="localized_table.html")
358
406
 
359
407
  Disable pagination and enable vertical and horizontal scrolling for easier navigation of large datasets.
360
408
 
361
- _Note_: Using `scrollY` with disabled `paging` can be slow for large DataFrames. Rendering more than 500 rows with `paging: False` also triggers a performance-warning banner in the browser (that threshold isn't currently configurable from Python).
409
+ _Note_: Using `scrollY` with disabled `paging` can be slow for large DataFrames. Rendering more than 500 rows with `paging: False` also triggers a performance-warning banner in the browser - raise or lower that threshold with `render_opts={"paging_warn_limit": N}`.
362
410
  ```python
363
411
  scroll_cfg = {
364
412
  "paging": False, # slow for large tables
365
413
  "scrollCollapse": False,
366
- "scrollY": '50vh',
414
+ "scrollY": '50vh',
367
415
  "scrollX": "70vw"
368
416
  }
369
417
  df2t.render(df, js_opts=scroll_cfg, to_file="scrolling_table.html")
@@ -397,18 +445,12 @@ Invalid keys are ignored by DataTables, so malformed or non-existent options **u
397
445
 
398
446
  Some DataTables options require additional extensions (e.g., FixedColumns or FixedHeader). When using render(), availability depends on the extensions loaded by the default template. When using render_inline(), you must ensure the required DataTables extensions are loaded by your application. Otherwise, the related options will be ignored or may generate JavaScript console warnings.
399
447
 
400
-
401
- For best results, start with core features such as `layout` or `language` options before exploring more advanced configurations.
402
-
403
- For a complete list of available settings, refer to the official DataTables documentation and:
404
- https://datatables.net/examples/
405
-
406
- It’s best to start with the core DataTables Features before adding advanced configurations.
448
+ Start with core features such as `layout` or `language` before exploring more advanced configurations. For the full reference:
407
449
 
408
450
  * [Feature Reference](https://datatables.net/reference/feature/)
409
451
  * [Configuration Options Reference](https://datatables.net/reference/option/)
410
452
  * [Layout Configuration](https://datatables.net/reference/option/layout)
411
- * [Language configuration ](https://datatables.net/reference/option/language)
453
+ * [Language configuration](https://datatables.net/reference/option/language)
412
454
 
413
455
  ## Additional Notes
414
456
 
@@ -419,14 +461,14 @@ For better readability in table headers, `df2tables` automatically converts unde
419
461
  To disable this automatic word wrapping behavior, add the following CSS to your custom template:
420
462
 
421
463
  ```css
422
- span.dt-column-title {
423
- white-space: nowrap;
464
+ span.dt-column-title {
465
+ white-space: nowrap;
424
466
  }
425
467
  ```
426
468
 
427
469
  ### Bulk Dataset Processing
428
470
 
429
- For exploratory data analysis across multiple datasets, you can generate tables programmatically.
471
+ For exploratory data analysis across multiple datasets, you can generate tables programmatically.
430
472
  The example below uses the [vega_datasets](https://github.com/altair-viz/vega_datasets) package, which provides easy access to a variety of sample datasets commonly used in data visualization and analysis.
431
473
 
432
474
  *Note: Install vega_datasets with `pip install vega_datasets` to run this example.*
@@ -441,7 +483,7 @@ The module includes handling for:
441
483
  - **Column compatibility**: Automatically converts problematic column types to string representation
442
484
 
443
485
  ### Offline Usage
444
- *Note: "Offline" viewing assumes internet connectivity for CDN resources - DataTables core, the DataTables extensions in use (Buttons, ColReorder, ColumnControl, FixedColumns), and jQuery. For truly offline usage, modify the template to reference local copies of these libraries instead of CDN links.*
486
+ *Note: "Offline" viewing assumes internet connectivity for CDN resources - DataTables core (v3, dependency-free: no jQuery needed), the DataTables extensions in use (Buttons, ColReorder, ColumnControl, FixedColumns). For truly offline usage, modify the template to reference local copies of these libraries instead of CDN links.*
445
487
 
446
488
  ## Appendix: Template Customization
447
489
 
@@ -1,5 +1,5 @@
1
1
  from .df2tables import *
2
- __version__ = "0.3.4"
2
+ __version__ = "0.4.0"
3
3
  __author__ = "Tomasz Slugocki"
4
4
  __license__ = "MIT"
5
5