dataframe-textual 3.1.3__tar.gz → 3.2.1__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 (24) hide show
  1. {dataframe_textual-3.1.3 → dataframe_textual-3.2.1}/PKG-INFO +1 -1
  2. {dataframe_textual-3.1.3 → dataframe_textual-3.2.1}/pyproject.toml +1 -1
  3. {dataframe_textual-3.1.3 → dataframe_textual-3.2.1}/src/dataframe_textual/data_frame_table.py +31 -36
  4. {dataframe_textual-3.1.3 → dataframe_textual-3.2.1}/uv.lock +1 -1
  5. {dataframe_textual-3.1.3 → dataframe_textual-3.2.1}/.gitignore +0 -0
  6. {dataframe_textual-3.1.3 → dataframe_textual-3.2.1}/LICENSE +0 -0
  7. {dataframe_textual-3.1.3 → dataframe_textual-3.2.1}/README.md +0 -0
  8. {dataframe_textual-3.1.3 → dataframe_textual-3.2.1}/main.py +0 -0
  9. {dataframe_textual-3.1.3 → dataframe_textual-3.2.1}/src/dataframe_textual/__init__.py +0 -0
  10. {dataframe_textual-3.1.3 → dataframe_textual-3.2.1}/src/dataframe_textual/__main__.py +0 -0
  11. {dataframe_textual-3.1.3 → dataframe_textual-3.2.1}/src/dataframe_textual/commands.py +0 -0
  12. {dataframe_textual-3.1.3 → dataframe_textual-3.2.1}/src/dataframe_textual/common.py +0 -0
  13. {dataframe_textual-3.1.3 → dataframe_textual-3.2.1}/src/dataframe_textual/console_panel.py +0 -0
  14. {dataframe_textual-3.1.3 → dataframe_textual-3.2.1}/src/dataframe_textual/data_frame_viewer.py +0 -0
  15. {dataframe_textual-3.1.3 → dataframe_textual-3.2.1}/src/dataframe_textual/file_picker_screen.py +0 -0
  16. {dataframe_textual-3.1.3 → dataframe_textual-3.2.1}/src/dataframe_textual/help_panel.py +0 -0
  17. {dataframe_textual-3.1.3 → dataframe_textual-3.2.1}/src/dataframe_textual/keybindings.py +0 -0
  18. {dataframe_textual-3.1.3 → dataframe_textual-3.2.1}/src/dataframe_textual/loading_screen.py +0 -0
  19. {dataframe_textual-3.1.3 → dataframe_textual-3.2.1}/src/dataframe_textual/run_command_screen.py +0 -0
  20. {dataframe_textual-3.1.3 → dataframe_textual-3.2.1}/src/dataframe_textual/status_bar.py +0 -0
  21. {dataframe_textual-3.1.3 → dataframe_textual-3.2.1}/src/dataframe_textual/table_screen.py +0 -0
  22. {dataframe_textual-3.1.3 → dataframe_textual-3.2.1}/src/dataframe_textual/text_screen.py +0 -0
  23. {dataframe_textual-3.1.3 → dataframe_textual-3.2.1}/src/dataframe_textual/theme_screen.py +0 -0
  24. {dataframe_textual-3.1.3 → dataframe_textual-3.2.1}/src/dataframe_textual/yes_no_screen.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: dataframe-textual
3
- Version: 3.1.3
3
+ Version: 3.2.1
4
4
  Summary: Interactive terminal viewer/editor (TUI) for CSV/TSV, Excel, Parquet, JSONL, etc.
5
5
  Project-URL: Homepage, https://github.com/need47/dataframe-textual
6
6
  Project-URL: Repository, https://github.com/need47/dataframe-textual.git
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "dataframe-textual"
7
- version = "3.1.3"
7
+ version = "3.2.1"
8
8
  description = "Interactive terminal viewer/editor (TUI) for CSV/TSV, Excel, Parquet, JSONL, etc."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -353,9 +353,13 @@ class DataFrameTable(DataTable):
353
353
  fully_loaded = False
354
354
  break
355
355
  else:
356
- self.notify(f"{total_loaded:{THOUSAND_SEPARATOR}} loaded so far", title="Load DataFrame")
356
+ self.app.call_from_thread(
357
+ self.notify, f"{total_loaded:{THOUSAND_SEPARATOR}} loaded so far", title="Load DataFrame"
358
+ )
357
359
  else:
358
- self.notify(f"{total_loaded:{THOUSAND_SEPARATOR}} loaded so far", title="Load DataFrame")
360
+ self.app.call_from_thread(
361
+ self.notify, f"{total_loaded:{THOUSAND_SEPARATOR}} loaded so far", title="Load DataFrame"
362
+ )
359
363
  except pl.exceptions.ComputeError as e:
360
364
  self.log(f"Error loading remaining batch: {e}")
361
365
  return self.app.exit(return_code=1, result=str(e))
@@ -365,15 +369,19 @@ class DataFrameTable(DataTable):
365
369
  self.df = self.dataframe
366
370
 
367
371
  if self.loaded_rows < self.BATCH_SIZE:
368
- self.load_rows_range(self.loaded_rows, self.BATCH_SIZE)
372
+ # Row insertion mutates the DataTable widget; run it on the app thread.
373
+ self.app.call_from_thread(self.load_rows_range, self.loaded_rows, self.BATCH_SIZE)
369
374
 
370
375
  # fully loaded the dataframe
371
376
  self.df_done = True
372
377
 
373
- self.notify(
374
- "Data fully loaded" if fully_loaded else "Data loading stopped by user",
375
- title="Load DataFrame",
376
- severity="information" if fully_loaded else "warning",
378
+ self.app.call_from_thread(
379
+ partial(
380
+ self.notify,
381
+ "Data fully loaded" if fully_loaded else "Data loading stopped by user",
382
+ title="Load DataFrame",
383
+ severity="information" if fully_loaded else "warning",
384
+ )
377
385
  )
378
386
 
379
387
  def with_full_df(func: Callable) -> Callable:
@@ -1362,7 +1370,7 @@ class DataFrameTable(DataTable):
1362
1370
  - The column label width is always the floor (label is never clipped).
1363
1371
  - Bar columns are fixed to BAR_COLUMN_WIDTH.
1364
1372
  - User-overridden columns (positive width) are fixed to ``max(label, override)``.
1365
- - URL-only string columns are skipped (let Textual auto-size so they stay clickable).
1373
+ - URL-only string columns are not capped.
1366
1374
  - String columns whose sampled max exceeds COLUMN_WIDTH_CAP are capped at
1367
1375
  ``max(label_width, COLUMN_WIDTH_CAP)`` and queued for phase 2.
1368
1376
  - All other columns (numeric, bool, temporal, short strings, expanded columns)
@@ -1422,17 +1430,6 @@ class DataFrameTable(DataTable):
1422
1430
 
1423
1431
  try:
1424
1432
  sample_values = sample_lf.select(col).collect().get_column(col).drop_nulls().to_list()
1425
-
1426
- # URL columns: leave for Textual auto-sizing so links stay clickable
1427
- if (
1428
- is_string
1429
- and sample_values
1430
- and any(val.startswith(("https://", "http://")) for val in sample_values)
1431
- ):
1432
- col_widths[col] = label_width
1433
- col_ideal_widths[col] = label_width
1434
- continue
1435
-
1436
1433
  max_cell_width = max(
1437
1434
  (
1438
1435
  measure(self.app.console, str(val[:3]) if isinstance(val, list) else str(val), 1)
@@ -1446,8 +1443,11 @@ class DataFrameTable(DataTable):
1446
1443
 
1447
1444
  ideal_width = max(label_width, max_cell_width)
1448
1445
  col_ideal_widths[col] = ideal_width
1446
+ is_url = (
1447
+ is_string and sample_values and any(val.startswith(("https://", "http://")) for val in sample_values)
1448
+ )
1449
1449
 
1450
- if is_string and not is_expanded and ideal_width > COLUMN_WIDTH_CAP:
1450
+ if is_string and not is_expanded and not is_url and ideal_width > COLUMN_WIDTH_CAP:
1451
1451
  # Cap and queue for phase 2
1452
1452
  col_widths[col] = max(label_width, COLUMN_WIDTH_CAP)
1453
1453
  capped_cols.append(col)
@@ -2410,7 +2410,7 @@ class DataFrameTable(DataTable):
2410
2410
  # Otherwise, expand to widest cell
2411
2411
  try:
2412
2412
  new_width = label_width
2413
- need_expand = False
2413
+ max_cell_value = ""
2414
2414
 
2415
2415
  for row_start, row_end in self.loaded_ranges:
2416
2416
  for ridx in range(row_start, row_end):
@@ -2425,12 +2425,13 @@ class DataFrameTable(DataTable):
2425
2425
  else:
2426
2426
  cell_value = str(cell)
2427
2427
 
2428
- cell_width = measure(self.app.console, cell_value, 1)
2429
- if cell_width > new_width:
2430
- need_expand = True
2431
- new_width = cell_width
2428
+ if len(cell_value) > len(max_cell_value):
2429
+ max_cell_value = cell_value
2432
2430
 
2433
- if not need_expand:
2431
+ max_cell_width = measure(self.app.console, max_cell_value, 1)
2432
+ if max_cell_width > new_width:
2433
+ new_width = max_cell_width
2434
+ else:
2434
2435
  return None
2435
2436
 
2436
2437
  self.column_widths[col_name] = -1 # Mark as expanded
@@ -2442,17 +2443,15 @@ class DataFrameTable(DataTable):
2442
2443
  return None
2443
2444
 
2444
2445
  def cmd_expand_column(self, expand_all: bool = False) -> None:
2445
- """Expand/unexpand string/list columns.
2446
+ """Expand/unexpand visible columns.
2446
2447
 
2447
2448
  Args:
2448
- expand_all: If True, expand or unexpand all string/list columns.
2449
+ expand_all: If True, expand or unexpand all visible columns.
2449
2450
  Otherwise: expand or unexpand the current column only.
2450
2451
  """
2451
2452
  if expand_all:
2452
- # Collect all string/list column names
2453
- target_cols = [
2454
- col for col, dtype in self.visible_columns.items() if DtypeConfig(dtype).gtype in ("string", "list")
2455
- ]
2453
+ # Collect all visiblecolumn names
2454
+ target_cols = [col for col in self.visible_columns]
2456
2455
 
2457
2456
  if not target_cols:
2458
2457
  return
@@ -2474,10 +2473,6 @@ class DataFrameTable(DataTable):
2474
2473
  title="Expand Columns",
2475
2474
  )
2476
2475
  else:
2477
- dtype = self.cursor_col_dtype
2478
- if dtype != pl.String and dtype != pl.List:
2479
- return
2480
-
2481
2476
  col_name = self.cursor_col_key.value
2482
2477
 
2483
2478
  if not (result := self._expand_single_column(col_name)):
@@ -187,7 +187,7 @@ wheels = [
187
187
 
188
188
  [[package]]
189
189
  name = "dataframe-textual"
190
- version = "3.1.3"
190
+ version = "3.2.1"
191
191
  source = { editable = "." }
192
192
  dependencies = [
193
193
  { name = "fastexcel" },