dataframe-textual 2.11.0__tar.gz → 2.12.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.4
2
2
  Name: dataframe-textual
3
- Version: 2.11.0
3
+ Version: 2.12.0
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
@@ -195,6 +195,7 @@ options:
195
195
  -N, --n-rows N Stop after reading N rows from CSV/TSV
196
196
  -n, --null NULL [NULL ...]
197
197
  Values to interpret as null values when reading CSV/TSV
198
+ --theme [THEME] Set the theme for the application (use 'list' to see available themes)
198
199
  ```
199
200
 
200
201
  ### CLI Examples
@@ -233,6 +234,9 @@ dv -l 3 -a 1 -I messy_scientific_data.csv
233
234
  # Process compressed data
234
235
  dv data.csv.gz
235
236
  zcat compressed_data.csv.gz | dv -f csv
237
+
238
+ # Choose the `monokai` theme
239
+ dv --theme monokai data.csv
236
240
  ```
237
241
 
238
242
  ## Keyboard Shortcuts
@@ -306,7 +310,7 @@ zcat compressed_data.csv.gz | dv -f csv
306
310
  | `_` (underscore) | Toggle column full width |
307
311
  | `z` | Freeze rows and columns |
308
312
  | `,` | Toggle thousand separator for numeric display |
309
- | `&` | Set current row as the new header row |
313
+ | `&` | Set current row as the new header row |
310
314
  | `h` | Hide current column |
311
315
  | `H` | Show all hidden columns |
312
316
 
@@ -156,6 +156,7 @@ options:
156
156
  -N, --n-rows N Stop after reading N rows from CSV/TSV
157
157
  -n, --null NULL [NULL ...]
158
158
  Values to interpret as null values when reading CSV/TSV
159
+ --theme [THEME] Set the theme for the application (use 'list' to see available themes)
159
160
  ```
160
161
 
161
162
  ### CLI Examples
@@ -194,6 +195,9 @@ dv -l 3 -a 1 -I messy_scientific_data.csv
194
195
  # Process compressed data
195
196
  dv data.csv.gz
196
197
  zcat compressed_data.csv.gz | dv -f csv
198
+
199
+ # Choose the `monokai` theme
200
+ dv --theme monokai data.csv
197
201
  ```
198
202
 
199
203
  ## Keyboard Shortcuts
@@ -267,7 +271,7 @@ zcat compressed_data.csv.gz | dv -f csv
267
271
  | `_` (underscore) | Toggle column full width |
268
272
  | `z` | Freeze rows and columns |
269
273
  | `,` | Toggle thousand separator for numeric display |
270
- | `&` | Set current row as the new header row |
274
+ | `&` | Set current row as the new header row |
271
275
  | `h` | Hide current column |
272
276
  | `H` | Show all hidden columns |
273
277
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "dataframe-textual"
7
- version = "2.11.0"
7
+ version = "2.12.0"
8
8
  description = "Interactive terminal viewer/editor for tabular data"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -4,6 +4,8 @@ import argparse
4
4
  import sys
5
5
  from pathlib import Path
6
6
 
7
+ from textual.theme import BUILTIN_THEMES
8
+
7
9
  from . import __version__
8
10
  from .common import SUPPORTED_FORMATS, load_dataframe
9
11
  from .data_frame_viewer import DataFrameViewer
@@ -81,7 +83,23 @@ def cli() -> argparse.Namespace:
81
83
  parser.add_argument("-N", "--n-rows", metavar="N", type=int, help="Stop after reading N rows from CSV/TSV")
82
84
  parser.add_argument("-n", "--null", nargs="+", help="Values to interpret as null values when reading CSV/TSV")
83
85
 
86
+ parser.add_argument(
87
+ "--theme",
88
+ nargs="?",
89
+ const="list",
90
+ help="Set the theme for the application (use 'list' to see available themes)",
91
+ )
92
+
84
93
  args = parser.parse_args()
94
+
95
+ # List available themes and exit
96
+ if args.theme == "list":
97
+ print("Available themes:")
98
+ for theme in BUILTIN_THEMES:
99
+ print(f" - {theme}")
100
+ sys.exit(0)
101
+
102
+ # Handle files
85
103
  if args.files is None:
86
104
  args.files = []
87
105
 
@@ -119,7 +137,7 @@ def main() -> None:
119
137
  truncate_ragged_lines=args.truncate_ragged_lines,
120
138
  n_rows=args.n_rows,
121
139
  )
122
- app = DataFrameViewer(*sources)
140
+ app = DataFrameViewer(*sources, theme=args.theme)
123
141
  app.run()
124
142
 
125
143
 
@@ -88,7 +88,7 @@ class DataFrameViewer(App):
88
88
  }
89
89
  """
90
90
 
91
- def __init__(self, *sources: Source) -> None:
91
+ def __init__(self, *sources: Source, theme: str | None = None) -> None:
92
92
  """Initialize the DataFrame Viewer application.
93
93
 
94
94
  Loads data from provided sources and prepares the tabbed interface.
@@ -96,9 +96,11 @@ class DataFrameViewer(App):
96
96
  Args:
97
97
  sources: sources to load dataframes from, each as a tuple of
98
98
  (DataFrame, filename, tabname).
99
+ theme: Optional; The theme to use for the application.
99
100
  """
100
101
  super().__init__()
101
102
  self.sources = sources
103
+ self.theme = theme
102
104
  self.tabs: dict[TabPane, DataFrameTable] = {}
103
105
  self.help_panel = None
104
106
 
@@ -171,7 +171,7 @@ wheels = [
171
171
 
172
172
  [[package]]
173
173
  name = "dataframe-textual"
174
- version = "2.11.0"
174
+ version = "2.12.0"
175
175
  source = { editable = "." }
176
176
  dependencies = [
177
177
  { name = "polars" },