dataframe-textual 2.40.1__tar.gz → 2.41.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 (18) hide show
  1. {dataframe_textual-2.40.1 → dataframe_textual-2.41.1}/PKG-INFO +24 -21
  2. {dataframe_textual-2.40.1 → dataframe_textual-2.41.1}/README.md +23 -20
  3. {dataframe_textual-2.40.1 → dataframe_textual-2.41.1}/pyproject.toml +9 -1
  4. {dataframe_textual-2.40.1 → dataframe_textual-2.41.1}/src/dataframe_textual/data_frame_table.py +14 -5
  5. {dataframe_textual-2.40.1 → dataframe_textual-2.41.1}/src/dataframe_textual/table_screen.py +54 -13
  6. {dataframe_textual-2.40.1 → dataframe_textual-2.41.1}/uv.lock +1 -1
  7. {dataframe_textual-2.40.1 → dataframe_textual-2.41.1}/.gitignore +0 -0
  8. {dataframe_textual-2.40.1 → dataframe_textual-2.41.1}/LICENSE +0 -0
  9. {dataframe_textual-2.40.1 → dataframe_textual-2.41.1}/main.py +0 -0
  10. {dataframe_textual-2.40.1 → dataframe_textual-2.41.1}/src/dataframe_textual/__init__.py +0 -0
  11. {dataframe_textual-2.40.1 → dataframe_textual-2.41.1}/src/dataframe_textual/__main__.py +0 -0
  12. {dataframe_textual-2.40.1 → dataframe_textual-2.41.1}/src/dataframe_textual/common.py +0 -0
  13. {dataframe_textual-2.40.1 → dataframe_textual-2.41.1}/src/dataframe_textual/data_frame_help_panel.py +0 -0
  14. {dataframe_textual-2.40.1 → dataframe_textual-2.41.1}/src/dataframe_textual/data_frame_viewer.py +0 -0
  15. {dataframe_textual-2.40.1 → dataframe_textual-2.41.1}/src/dataframe_textual/file_picker_screen.py +0 -0
  16. {dataframe_textual-2.40.1 → dataframe_textual-2.41.1}/src/dataframe_textual/loading_screen.py +0 -0
  17. {dataframe_textual-2.40.1 → dataframe_textual-2.41.1}/src/dataframe_textual/theme_screen.py +0 -0
  18. {dataframe_textual-2.40.1 → dataframe_textual-2.41.1}/src/dataframe_textual/yes_no_screen.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dataframe-textual
3
- Version: 2.40.1
3
+ Version: 2.41.1
4
4
  Summary: Interactive terminal viewer/editor for tabular data
5
5
  Project-URL: Homepage, https://github.com/need47/dataframe-textual
6
6
  Project-URL: Repository, https://github.com/need47/dataframe-textual.git
@@ -309,25 +309,25 @@ dv data.csv -o data.parquet
309
309
 
310
310
  #### Display
311
311
 
312
- | Key | Action |
313
- | ---------------- | -------------------------------------------------- |
314
- | `Enter` | Show details for the current row |
315
- | `Tab` | Show details for the current cell |
316
- | `F` | Show frequency distribution for current column |
317
- | `i` | Show histogram for current column |
318
- | `I` | Show histogram for current column with custom bins |
319
- | `s` | Show statistics for current column |
320
- | `S` | Show statistics for entire dataframe |
321
- | `m` | Show metadata for row count and column count |
322
- | `M` | Show metadata for current column |
323
- | `K` | Cycle cursor types: cell → row → column → cell |
324
- | `~` | Toggle row labels |
325
- | `_` (underscore) | Toggle column full width |
326
- | `f` | Toggle freeze rows and/or columns |
327
- | `,` | Toggle thousand separator for numeric display |
328
- | `&` | Set current row as the new header row |
329
- | `h` | Hide current column |
330
- | `H` | Show all hidden columns |
312
+ | Key | Action |
313
+ | ---------------- | ------------------------------------------------------------------ |
314
+ | `Enter` | Show details for the current row |
315
+ | `Tab` | Show current cell details; press `Tab` again there to drill deeper |
316
+ | `F` | Show frequency distribution for current column |
317
+ | `i` | Show histogram for current column |
318
+ | `I` | Show histogram for current column with custom bins |
319
+ | `s` | Show statistics for current column |
320
+ | `S` | Show statistics for entire dataframe |
321
+ | `m` | Show metadata for row count and column count |
322
+ | `M` | Show metadata for current column |
323
+ | `K` | Cycle cursor types: cell → row → column → cell |
324
+ | `~` | Toggle row labels |
325
+ | `_` (underscore) | Toggle column full width |
326
+ | `f` | Toggle freeze rows and/or columns |
327
+ | `,` | Toggle thousand separator for numeric display |
328
+ | `&` | Set current row as the new header row |
329
+ | `h` | Hide current column |
330
+ | `H` | Show all hidden columns |
331
331
 
332
332
  #### Editing
333
333
 
@@ -456,9 +456,12 @@ Press `Tab` in the main table to inspect the current cell in its own modal.
456
456
 
457
457
  You can also press `Tab` from the row-detail modal to drill into the selected field.
458
458
 
459
+ Inside the cell-detail modal, press `Tab` again on the selected row/column to keep drilling into nested values.
460
+
459
461
  - Scalar values are shown directly
460
462
  - String values are split into multiple rows using `|` by default
461
- - Lists and structs are expanded into a readable table layout
463
+ - List-like values are expanded into a one-column table
464
+ - Dict-like values are shown as key/value columns
462
465
  - Press `q` or `Escape` to close the modal
463
466
 
464
467
  ### 4. Row Selection
@@ -270,25 +270,25 @@ dv data.csv -o data.parquet
270
270
 
271
271
  #### Display
272
272
 
273
- | Key | Action |
274
- | ---------------- | -------------------------------------------------- |
275
- | `Enter` | Show details for the current row |
276
- | `Tab` | Show details for the current cell |
277
- | `F` | Show frequency distribution for current column |
278
- | `i` | Show histogram for current column |
279
- | `I` | Show histogram for current column with custom bins |
280
- | `s` | Show statistics for current column |
281
- | `S` | Show statistics for entire dataframe |
282
- | `m` | Show metadata for row count and column count |
283
- | `M` | Show metadata for current column |
284
- | `K` | Cycle cursor types: cell → row → column → cell |
285
- | `~` | Toggle row labels |
286
- | `_` (underscore) | Toggle column full width |
287
- | `f` | Toggle freeze rows and/or columns |
288
- | `,` | Toggle thousand separator for numeric display |
289
- | `&` | Set current row as the new header row |
290
- | `h` | Hide current column |
291
- | `H` | Show all hidden columns |
273
+ | Key | Action |
274
+ | ---------------- | ------------------------------------------------------------------ |
275
+ | `Enter` | Show details for the current row |
276
+ | `Tab` | Show current cell details; press `Tab` again there to drill deeper |
277
+ | `F` | Show frequency distribution for current column |
278
+ | `i` | Show histogram for current column |
279
+ | `I` | Show histogram for current column with custom bins |
280
+ | `s` | Show statistics for current column |
281
+ | `S` | Show statistics for entire dataframe |
282
+ | `m` | Show metadata for row count and column count |
283
+ | `M` | Show metadata for current column |
284
+ | `K` | Cycle cursor types: cell → row → column → cell |
285
+ | `~` | Toggle row labels |
286
+ | `_` (underscore) | Toggle column full width |
287
+ | `f` | Toggle freeze rows and/or columns |
288
+ | `,` | Toggle thousand separator for numeric display |
289
+ | `&` | Set current row as the new header row |
290
+ | `h` | Hide current column |
291
+ | `H` | Show all hidden columns |
292
292
 
293
293
  #### Editing
294
294
 
@@ -417,9 +417,12 @@ Press `Tab` in the main table to inspect the current cell in its own modal.
417
417
 
418
418
  You can also press `Tab` from the row-detail modal to drill into the selected field.
419
419
 
420
+ Inside the cell-detail modal, press `Tab` again on the selected row/column to keep drilling into nested values.
421
+
420
422
  - Scalar values are shown directly
421
423
  - String values are split into multiple rows using `|` by default
422
- - Lists and structs are expanded into a readable table layout
424
+ - List-like values are expanded into a one-column table
425
+ - Dict-like values are shown as key/value columns
423
426
  - Press `q` or `Escape` to close the modal
424
427
 
425
428
  ### 4. Row Selection
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "dataframe-textual"
7
- version = "2.40.1"
7
+ version = "2.41.1"
8
8
  description = "Interactive terminal viewer/editor for tabular data"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -53,6 +53,14 @@ dev = [
53
53
 
54
54
  [tool.hatch.build.targets.wheel]
55
55
  packages = ["src/dataframe_textual"]
56
+ include = [
57
+ "main.py",
58
+ "src/*",
59
+ "LICENSE",
60
+ "README.md",
61
+ "pyproject.toml",
62
+ "uv.lock",
63
+ ]
56
64
  exclude = [
57
65
  "*.png",
58
66
  "*.gz",
@@ -207,7 +207,7 @@ class DataFrameTable(DataTable):
207
207
 
208
208
  ## 👁️ Display
209
209
  - **Enter** - 📋 Show row details in modal
210
- - **Tab** - 🔍 Show current cell details in modal
210
+ - **Tab** - 🔍 Show current cell details in modal; use `Tab` again there to drill deeper
211
211
  - **F** - 📊 Show frequency distribution for current column
212
212
  - **i** - 📊 Show histogram for current column
213
213
  - **I** - 📊 Show histogram for current column with custom bins
@@ -1868,9 +1868,18 @@ class DataFrameTable(DataTable):
1868
1868
  """Open a modal screen to view the selected cell's details."""
1869
1869
  ridx = self.cursor_ridx
1870
1870
  cidx = self.cursor_cidx
1871
-
1872
- # Push the modal screen
1873
- self.app.push_screen(CellDetailScreen(self, ridx, cidx))
1871
+ dtype = self.df.dtypes[cidx]
1872
+ cell_value = self.df.item(ridx, cidx)
1873
+
1874
+ # Only show cell detail screen if the value is a non-empty list, non-empty dict,
1875
+ # or string containing the delimiter (indicating a potential list of values).
1876
+ # This prevents unnecessary screens for simple scalar values.
1877
+ if (
1878
+ (dtype == pl.List and not cell_value.is_empty())
1879
+ or (dtype == pl.Struct and cell_value)
1880
+ or (dtype == pl.String and "|" in cell_value)
1881
+ ):
1882
+ self.app.push_screen(CellDetailScreen(self.df, ridx, cidx))
1874
1883
 
1875
1884
  def do_show_frequency(self, cidx: int | None = None) -> None:
1876
1885
  """Show frequency distribution for a given columnn."""
@@ -2959,7 +2968,7 @@ class DataFrameTable(DataTable):
2959
2968
 
2960
2969
  def do_uniq_rows(self) -> None:
2961
2970
  """Remove duplicate rows from the current dataframe, keeping the first occurrence."""
2962
- subset = [col for col in self.df.columns if col != RID]
2971
+ subset = [col for col in self.df.columns if col != RID and col not in self.hidden_columns]
2963
2972
 
2964
2973
  if not subset:
2965
2974
  return
@@ -43,14 +43,14 @@ class TableScreen(ModalScreen):
43
43
  }
44
44
  """
45
45
 
46
- def __init__(self, dftable: "DataFrameTable") -> None:
46
+ def __init__(self, dftable: "DataFrameTable | None") -> None:
47
47
  """Initialize the table screen.
48
48
 
49
49
  Sets up the base modal screen with reference to the main DataFrameTable widget
50
50
  and stores the DataFrame for display.
51
51
 
52
52
  Args:
53
- dftable: Reference to the parent DataFrameTable widget.
53
+ dftable: Reference to the parent DataFrameTable widget, if applicable.
54
54
  """
55
55
  super().__init__()
56
56
  self.dftable = dftable # DataFrameTable
@@ -302,7 +302,20 @@ class RowDetailScreen(TableScreen):
302
302
  self.show_statistics(self.get_cidx_name_value())
303
303
  event.stop()
304
304
  elif event.key == "tab":
305
- self.app.push_screen(CellDetailScreen(self.dftable, self.ridx, self.table.cursor_row))
305
+ ridx = self.ridx
306
+ cidx = self.table.cursor_row
307
+ dtype = self.dftable.df.dtypes[cidx]
308
+ cell_value = self.dftable.df.item(ridx, cidx)
309
+
310
+ # Only show cell detail screen if the value is a non-empty list, non-empty dict,
311
+ # or string containing the delimiter (indicating a potential list of values).
312
+ # This prevents unnecessary screens for simple scalar values.
313
+ if (
314
+ (dtype == pl.List and not cell_value.is_empty())
315
+ or (dtype == pl.Struct and cell_value)
316
+ or (dtype == pl.String and "|" in cell_value)
317
+ ):
318
+ self.app.push_screen(CellDetailScreen(self.dftable.df, ridx, cidx))
306
319
  event.stop()
307
320
 
308
321
  def get_cidx_name_value(self) -> tuple[int, str, Any] | None:
@@ -821,8 +834,9 @@ class MetaColumnScreen(TableScreen):
821
834
  class CellDetailScreen(TableScreen):
822
835
  """Modal screen to display details of a cell value, including support for nested structures like lists and dicts."""
823
836
 
824
- def __init__(self, dftable: "DataFrameTable", ridx: int, cidx: int, delimiter: str | None = "|") -> None:
825
- super().__init__(dftable)
837
+ def __init__(self, dfsrc: pl.DataFrame, ridx: int, cidx: int, delimiter: str | None = "|") -> None:
838
+ super().__init__(None)
839
+ self.dfsrc = dfsrc
826
840
  self.cidx = cidx
827
841
  self.ridx = ridx
828
842
  self.delimiter = delimiter
@@ -834,18 +848,21 @@ class CellDetailScreen(TableScreen):
834
848
  def build_table(self) -> None:
835
849
  """Build the list table."""
836
850
  # Get the column values as a list
837
- col_name = self.dftable.df.columns[self.cidx]
838
- dtype = self.dftable.df.dtypes[self.cidx]
839
- cell_value = self.dftable.df.item(self.ridx, self.cidx)
851
+ col_name = self.dfsrc.columns[self.cidx]
852
+ dtype = self.dfsrc.dtypes[self.cidx]
853
+ cell_value = self.dfsrc.item(self.ridx, self.cidx)
840
854
 
841
855
  if isinstance(cell_value, pl.Series) and not cell_value.is_empty():
842
856
  self.df = pl.DataFrame({col_name: cell_value})
843
857
  df2table(self.df, table=self.table)
844
858
  elif isinstance(cell_value, dict) and cell_value:
845
- self.table.add_column(f"{col_name} (Key)")
846
- self.table.add_column(f"{col_name} (Value)")
847
- for idx, (key, value) in enumerate(cell_value.items()):
848
- self.table.add_row(str(key), str(value), label=str(idx + 1))
859
+ self.df = pl.DataFrame(
860
+ {
861
+ f"{col_name} (Key)": pl.Series(cell_value.keys(), strict=False),
862
+ f"{col_name} (Value)": pl.Series(cell_value.values(), strict=False),
863
+ }
864
+ )
865
+ df2table(self.df, table=self.table)
849
866
  elif dtype == pl.String and cell_value:
850
867
  self.df = pl.DataFrame({col_name: cell_value.split(self.delimiter)})
851
868
  df2table(self.df, table=self.table)
@@ -853,4 +870,28 @@ class CellDetailScreen(TableScreen):
853
870
  self.df = pl.DataFrame({col_name: [cell_value]})
854
871
  df2table(self.df, table=self.table)
855
872
 
856
- self.table.cursor_type = "row"
873
+ def on_key(self, event) -> None:
874
+ """Handle key press events on the column metadata screen.
875
+
876
+ Supports keys:
877
+ - 'tab': Show cell details for the selected value.
878
+
879
+ Args:
880
+ event: The key event object.
881
+ """
882
+ if event.key == "tab":
883
+ cidx = self.table.cursor_column
884
+ ridx = self.table.cursor_row
885
+ dtype = self.df.dtypes[cidx]
886
+ cell_value = self.df.item(ridx, cidx)
887
+
888
+ # Only show cell detail screen if the value is a non-empty list, non-empty dict,
889
+ # or string containing the delimiter (indicating a potential list of values).
890
+ # This prevents unnecessary screens for simple scalar values.
891
+ if (
892
+ (dtype == pl.List and not cell_value.is_empty())
893
+ or (dtype == pl.Struct and cell_value)
894
+ or (dtype == pl.String and "|" in cell_value)
895
+ ):
896
+ self.app.push_screen(CellDetailScreen(self.df, ridx, cidx))
897
+ event.stop()
@@ -171,7 +171,7 @@ wheels = [
171
171
 
172
172
  [[package]]
173
173
  name = "dataframe-textual"
174
- version = "2.40.1"
174
+ version = "2.41.1"
175
175
  source = { editable = "." }
176
176
  dependencies = [
177
177
  { name = "fastexcel" },