flexablelib 2.0.14__tar.gz → 2.0.16__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.
- {flexablelib-2.0.14 → flexablelib-2.0.16}/CHANGELOG.md +43 -1
- {flexablelib-2.0.14/flexablelib.egg-info → flexablelib-2.0.16}/PKG-INFO +1 -1
- {flexablelib-2.0.14 → flexablelib-2.0.16}/flexablelib/columns.py +12 -6
- {flexablelib-2.0.14 → flexablelib-2.0.16}/flexablelib/readers.py +44 -3
- {flexablelib-2.0.14 → flexablelib-2.0.16}/flexablelib/table.py +774 -47
- {flexablelib-2.0.14 → flexablelib-2.0.16}/flexablelib/table_strings.py +14 -7
- {flexablelib-2.0.14 → flexablelib-2.0.16}/flexablelib/utils.py +26 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/flexablelib/writers.py +16 -2
- {flexablelib-2.0.14 → flexablelib-2.0.16/flexablelib.egg-info}/PKG-INFO +1 -1
- {flexablelib-2.0.14 → flexablelib-2.0.16}/flexablelib.egg-info/SOURCES.txt +2 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/package.json +1 -1
- flexablelib-2.0.16/tests/test_v215_features.py +101 -0
- flexablelib-2.0.16/tests/test_v216_features.py +155 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/LICENSE +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/MANIFEST.in +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/README.md +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/flexablelib/__init__.py +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/flexablelib/_speedups.c +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/flexablelib/_width_tables.h +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/flexablelib/cells.py +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/flexablelib/colors.py +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/flexablelib/fast.py +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/flexablelib/merges.py +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/flexablelib/options.py +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/flexablelib/style_compositions.py +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/flexablelib/text_width.py +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/flexablelib.egg-info/dependency_links.txt +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/flexablelib.egg-info/requires.txt +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/flexablelib.egg-info/top_level.txt +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/setup.cfg +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/setup.py +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/tests/test_cells.py +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/tests/test_columns.py +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/tests/test_excel.py +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/tests/test_features.py +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/tests/test_issues.py +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/tests/test_merge_edge_matrix.py +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/tests/test_merges.py +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/tests/test_readme_examples.py +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/tests/test_styles.py +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/tests/test_text_width.py +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/tests/test_two_pass_measurement.py +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/tests/test_upstream_issues.py +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/tests/test_v213_features.py +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/tests/test_v214_features.py +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/tools/benchmark.py +0 -0
- {flexablelib-2.0.14 → flexablelib-2.0.16}/tools/generate_width_tables.py +0 -0
|
@@ -2,6 +2,48 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [2.0.16] - 2026-10-28
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- ``Table.index_title``: rename the ``show_index`` column header (default ``i``).
|
|
9
|
+
- ``Table.roman_index``: render index values as Roman numerals.
|
|
10
|
+
- ``Table.number_columns``: display data headers as ``1``, ``2``, … (stored names kept).
|
|
11
|
+
- ``Table.strip_cells``: strip whitespace from string cells on display.
|
|
12
|
+
- ``Table.hrules`` / ``Table.vrules``: PrettyTable-style rule toggles
|
|
13
|
+
(``all`` / ``frame`` / ``header`` / ``none`` for hrules; ``all`` / ``frame`` /
|
|
14
|
+
``none`` for vrules).
|
|
15
|
+
- ``Table.add_dividers(*indexes)`` and ``Table.divide_every(n, start=0)``.
|
|
16
|
+
- ``Table.fit_terminal(margin=0)``: pin ``max_width`` to the live terminal.
|
|
17
|
+
- Aliases ``max_table_width`` (``max_width``) and ``justify`` (``table_align``).
|
|
18
|
+
- ``Table.suppress_empty``: hide empty rows and columns together.
|
|
19
|
+
- CSV dialect extras on ``from_csv`` / ``to_csv``: ``dialect``, ``quoting``,
|
|
20
|
+
``quotechar``, ``escapechar``, ``doublequote``, ``lineterminator``,
|
|
21
|
+
``skipinitialspace``, ``strict``.
|
|
22
|
+
- Themes: ``solarized``, ``neon``, ``mono``, ``autumn``, ``contrast``,
|
|
23
|
+
``forest``, ``ember``, ``slate``.
|
|
24
|
+
- ``paginate(..., freeze_header=True, page_label=False)``: opt-out of repeating
|
|
25
|
+
headers after page 1; optional ``page k/n`` title labels.
|
|
26
|
+
|
|
27
|
+
### Notes
|
|
28
|
+
- ``from_html`` was already present (2.0.x); no API change this release.
|
|
29
|
+
|
|
30
|
+
## [2.0.15] - 2026-10-28
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
- ``Table.stream(rows, append=False)``: beautifultable-style incremental
|
|
34
|
+
print — yields composed lines as rows arrive with widths frozen from
|
|
35
|
+
headers / seed rows / ``column_min_width`` (F13).
|
|
36
|
+
- ``Table.hide_columns``: omit columns by name or index at display time
|
|
37
|
+
(go-pretty / prettytable suppress); stored data unchanged.
|
|
38
|
+
- ``Table.apply_theme(name)`` + ``Table.THEMES``: named style+colour
|
|
39
|
+
bundles (``plain``, ``dark``, ``midnight``, ``matrix``, ``report``,
|
|
40
|
+
``markdown``, ``ocean``).
|
|
41
|
+
- ``sort_by`` accepts a callable ``key(row)`` in addition to header/index.
|
|
42
|
+
|
|
43
|
+
### Notes
|
|
44
|
+
- Streaming pins column widths; set ``column_min_width`` when later rows
|
|
45
|
+
are wider than the seed content.
|
|
46
|
+
|
|
5
47
|
## [2.0.14] - 2026-10-28
|
|
6
48
|
|
|
7
49
|
### Added
|
|
@@ -19,7 +61,7 @@ All notable changes to this project will be documented in this file. See [standa
|
|
|
19
61
|
### Notes
|
|
20
62
|
- Column percent-width constraints (F10) remain covered by existing
|
|
21
63
|
``column_min_width`` / ``column_max_width``; no API change.
|
|
22
|
-
- Streaming / incremental print (F13)
|
|
64
|
+
- Streaming / incremental print (F13) shipped in 2.0.15.
|
|
23
65
|
|
|
24
66
|
## [2.0.13] - 2026-10-28
|
|
25
67
|
|
|
@@ -789,19 +789,22 @@ def _align_columns(style_composition: TableComposition,
|
|
|
789
789
|
col_widths: List[int],
|
|
790
790
|
empty_columns_i: List[int],
|
|
791
791
|
show_empty: bool,
|
|
792
|
-
float_cols_sizes: dict
|
|
792
|
+
float_cols_sizes: dict,
|
|
793
|
+
hidden_columns_i=()
|
|
793
794
|
) -> Generator[str, None, None]:
|
|
794
795
|
"""
|
|
795
796
|
Aligns the columns and adds margin to the cells.
|
|
796
797
|
"""
|
|
797
798
|
# The margin that the selected style has.
|
|
798
799
|
margin = style_composition.margin
|
|
800
|
+
hidden = set(hidden_columns_i or ())
|
|
799
801
|
|
|
800
802
|
for column_i, column in enumerate(columns):
|
|
801
803
|
|
|
802
804
|
# Align only the columns that are shown.
|
|
803
|
-
if
|
|
804
|
-
|
|
805
|
+
if column_i not in hidden and (
|
|
806
|
+
show_empty or column_i not in empty_columns_i
|
|
807
|
+
):
|
|
805
808
|
|
|
806
809
|
# Get the header of the column.
|
|
807
810
|
header = headers[column_i]
|
|
@@ -859,13 +862,15 @@ def _align_headers(style_composition: TableComposition,
|
|
|
859
862
|
col_widths: List[int],
|
|
860
863
|
empty_columns_i: List[int],
|
|
861
864
|
show_empty: bool,
|
|
862
|
-
float_cols_sizes: dict
|
|
865
|
+
float_cols_sizes: dict,
|
|
866
|
+
hidden_columns_i=()):
|
|
863
867
|
"""
|
|
864
868
|
Will align the headers using the provided column alignments.
|
|
865
869
|
"""
|
|
866
870
|
|
|
867
871
|
# The margin that the selected style has.
|
|
868
872
|
margin = style_composition.margin
|
|
873
|
+
hidden = set(hidden_columns_i or ())
|
|
869
874
|
|
|
870
875
|
for column_i, column in enumerate(headers):
|
|
871
876
|
# Get the alignment of the current column.
|
|
@@ -887,8 +892,9 @@ def _align_headers(style_composition: TableComposition,
|
|
|
887
892
|
float_column_sizes = None
|
|
888
893
|
|
|
889
894
|
# Only align the headers if its column is shown.
|
|
890
|
-
if
|
|
891
|
-
|
|
895
|
+
if column_i not in hidden and (
|
|
896
|
+
show_empty or column_i not in empty_columns_i
|
|
897
|
+
):
|
|
892
898
|
yield from __align_one_header(
|
|
893
899
|
column,
|
|
894
900
|
col_width,
|
|
@@ -132,20 +132,61 @@ def from_dicts(table_class, records: Iterable[Dict[str, Any]],
|
|
|
132
132
|
return _new_table(table_class, headers, rows, parse_numbers, **options)
|
|
133
133
|
|
|
134
134
|
|
|
135
|
+
def _csv_reader_kwargs(delimiter=',', dialect=None, quoting=None,
|
|
136
|
+
quotechar=None, escapechar=None, doublequote=None,
|
|
137
|
+
lineterminator=None, skipinitialspace=None,
|
|
138
|
+
strict=None):
|
|
139
|
+
"""Build kwargs for ``csv.reader`` / ``csv.writer`` from optional extras."""
|
|
140
|
+
kwargs = {}
|
|
141
|
+
if dialect is not None:
|
|
142
|
+
kwargs['dialect'] = dialect
|
|
143
|
+
else:
|
|
144
|
+
kwargs['delimiter'] = delimiter
|
|
145
|
+
for key, value in (
|
|
146
|
+
('quoting', quoting),
|
|
147
|
+
('quotechar', quotechar),
|
|
148
|
+
('escapechar', escapechar),
|
|
149
|
+
('doublequote', doublequote),
|
|
150
|
+
('lineterminator', lineterminator),
|
|
151
|
+
('skipinitialspace', skipinitialspace),
|
|
152
|
+
('strict', strict),
|
|
153
|
+
):
|
|
154
|
+
if value is not None:
|
|
155
|
+
kwargs[key] = value
|
|
156
|
+
# dialect already carries delimiter; still allow override when both given
|
|
157
|
+
if dialect is not None and delimiter is not None and delimiter != ',':
|
|
158
|
+
kwargs['delimiter'] = delimiter
|
|
159
|
+
return kwargs
|
|
160
|
+
|
|
161
|
+
|
|
135
162
|
def from_csv(table_class, source, parse_numbers: bool = True,
|
|
136
163
|
has_header: bool = True, delimiter: str = ',',
|
|
137
|
-
encoding: str = 'utf-8',
|
|
164
|
+
encoding: str = 'utf-8', dialect=None, quoting=None,
|
|
165
|
+
quotechar=None, escapechar=None, doublequote=None,
|
|
166
|
+
lineterminator=None, skipinitialspace=None, strict=None,
|
|
167
|
+
**options):
|
|
138
168
|
"""
|
|
139
169
|
Build from a CSV file path, or any open text handle.
|
|
140
170
|
|
|
141
171
|
With ``has_header`` false, columns are named automatically.
|
|
172
|
+
|
|
173
|
+
Extra ``csv`` dialect knobs (``quoting``, ``quotechar``, ``escapechar``,
|
|
174
|
+
``doublequote``, ``lineterminator``, ``skipinitialspace``, ``strict``,
|
|
175
|
+
and a registered ``dialect`` name or Dialect instance) are forwarded to
|
|
176
|
+
``csv.reader``.
|
|
142
177
|
"""
|
|
178
|
+
reader_kwargs = _csv_reader_kwargs(
|
|
179
|
+
delimiter=delimiter, dialect=dialect, quoting=quoting,
|
|
180
|
+
quotechar=quotechar, escapechar=escapechar,
|
|
181
|
+
doublequote=doublequote, lineterminator=lineterminator,
|
|
182
|
+
skipinitialspace=skipinitialspace, strict=strict,
|
|
183
|
+
)
|
|
143
184
|
if hasattr(source, 'read'):
|
|
144
|
-
reader = _csv.reader(source,
|
|
185
|
+
reader = _csv.reader(source, **reader_kwargs)
|
|
145
186
|
rows = [row for row in reader]
|
|
146
187
|
else:
|
|
147
188
|
with open(source, 'r', newline='', encoding=encoding) as handle:
|
|
148
|
-
rows = [row for row in _csv.reader(handle,
|
|
189
|
+
rows = [row for row in _csv.reader(handle, **reader_kwargs)]
|
|
149
190
|
|
|
150
191
|
if not rows:
|
|
151
192
|
return table_class(**options)
|