flexablelib 2.2.1__tar.gz → 2.2.2__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.2.1 → flexablelib-2.2.2}/CHANGELOG.md +17 -0
- {flexablelib-2.2.1/flexablelib.egg-info → flexablelib-2.2.2}/PKG-INFO +1 -1
- {flexablelib-2.2.1 → flexablelib-2.2.2}/flexablelib/table.py +29 -5
- {flexablelib-2.2.1 → flexablelib-2.2.2/flexablelib.egg-info}/PKG-INFO +1 -1
- {flexablelib-2.2.1 → flexablelib-2.2.2}/flexablelib.egg-info/SOURCES.txt +1 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/package.json +1 -1
- flexablelib-2.2.2/tests/test_v222_fixes.py +72 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/LICENSE +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/MANIFEST.in +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/README.md +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/flexablelib/__init__.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/flexablelib/_speedups.c +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/flexablelib/_width_tables.h +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/flexablelib/cells.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/flexablelib/colors.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/flexablelib/columns.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/flexablelib/fast.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/flexablelib/merges.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/flexablelib/options.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/flexablelib/py.typed +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/flexablelib/readers.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/flexablelib/style_compositions.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/flexablelib/table_strings.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/flexablelib/text_width.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/flexablelib/utils.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/flexablelib/writers.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/flexablelib.egg-info/dependency_links.txt +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/flexablelib.egg-info/requires.txt +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/flexablelib.egg-info/top_level.txt +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/pytest.ini +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/setup.cfg +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/setup.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/style_examples.md +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/conftest.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/helpers.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/test_cells.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/test_columns.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/test_excel.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/test_features.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/test_issues.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/test_merge_edge_matrix.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/test_merges.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/test_readme_examples.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/test_style_line_widths.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/test_styles.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/test_text_width.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/test_two_pass_measurement.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/test_upstream_issues.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/test_v2021_fixes.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/test_v210_rows_copy.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/test_v2110_fixes.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/test_v211_fixes.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/test_v213_features.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/test_v214_features.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/test_v215_features.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/test_v216_features.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/test_v217_features.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/test_v218_features.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/test_v219_coverage.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/test_v219_fixes.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/test_v220_exports.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tests/test_v221_fixes.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tools/benchmark.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tools/generate_width_tables.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tools/readme_gallery.py +0 -0
- {flexablelib-2.2.1 → flexablelib-2.2.2}/tools/text_to_png.py +0 -0
|
@@ -2,6 +2,18 @@
|
|
|
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.2.2] - 2026-11-05
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- ``zebra = True`` (and ``row_stripe = True``) raised ``ColourError: unknown
|
|
9
|
+
colour: 'true'`` when ``use_colors`` was on. ``True`` now enables a default
|
|
10
|
+
odd-row ``reverse`` stripe; ``False`` clears it. Other non-spec values raise
|
|
11
|
+
``TypeError`` at assignment time instead of blowing up later in ``compose()``.
|
|
12
|
+
- ``parse_str_numbers = True`` before ``add_column`` / ``add_row`` left digit
|
|
13
|
+
strings unparsed, contrary to the documented "order does not matter". New
|
|
14
|
+
cells are parsed on the way in, matching ``set_cell`` and the re-parse that
|
|
15
|
+
already ran when the flag was turned on after the data was there.
|
|
16
|
+
|
|
5
17
|
## [2.2.1] - 2026-11-04
|
|
6
18
|
|
|
7
19
|
### Fixed
|
|
@@ -25,6 +37,11 @@ All notable changes to this project will be documented in this file. See [standa
|
|
|
25
37
|
(Linux manylinux + musllinux, Windows, macOS arm64; CPython 3.8-3.14) and
|
|
26
38
|
the sdist, checks the count and that the tag matches ``package.json``, and
|
|
27
39
|
is safe to re-run. One run per ref (``concurrency``).
|
|
40
|
+
- The real reason the macOS job never started: GitHub's hosted macOS arm64
|
|
41
|
+
runners are short of capacity, and a job no runner picks up is cancelled
|
|
42
|
+
after ~15 minutes. A new ``wheels-retry`` workflow re-runs the failed or
|
|
43
|
+
cancelled jobs of a tag run (up to three more attempts), so publishing
|
|
44
|
+
finishes on its own.
|
|
28
45
|
- Actions moved off Node 20: ``checkout@v5``, ``setup-python@v6``,
|
|
29
46
|
``upload-artifact@v6``, ``download-artifact@v7``.
|
|
30
47
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flexablelib
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.2
|
|
4
4
|
Summary: Fast, dependency-free terminal tables for Python: 56 border styles, ANSI colors, cell merges, decimal alignment, width fitting, and CSV/Markdown/HTML/Excel/LaTeX I/O.
|
|
5
5
|
Home-page: https://github.com/Opus-Perpetuus/flexablelib
|
|
6
6
|
Author: Benjamin Ramirez
|
|
@@ -1455,7 +1455,8 @@ class Table(object):
|
|
|
1455
1455
|
"""
|
|
1456
1456
|
Alternating body-row colours (Rich ``row_styles`` / zebra striping).
|
|
1457
1457
|
|
|
1458
|
-
Accepts ``None`` (off),
|
|
1458
|
+
Accepts ``None`` / ``False`` (off), ``True`` (default striping:
|
|
1459
|
+
odd rows in ``reverse``), a single colour spec applied to odd rows
|
|
1459
1460
|
(1, 3, …), or a two-item sequence ``(even_spec, odd_spec)``. Empty
|
|
1460
1461
|
/ falsy specs leave that parity uncoloured. Alias: :attr:`row_stripe`.
|
|
1461
1462
|
"""
|
|
@@ -1945,11 +1946,21 @@ class Table(object):
|
|
|
1945
1946
|
|
|
1946
1947
|
@zebra.setter
|
|
1947
1948
|
def zebra(self, value):
|
|
1949
|
+
if value is True:
|
|
1950
|
+
# Common "just turn it on" request; reverse works on every terminal.
|
|
1951
|
+
value = ('', 'reverse')
|
|
1952
|
+
elif value is False:
|
|
1953
|
+
value = None
|
|
1954
|
+
elif value is not None and not isinstance(value, (str, list, tuple)):
|
|
1955
|
+
raise TypeError(
|
|
1956
|
+
'zebra must be None, False, True, a colour spec, or a '
|
|
1957
|
+
f'(even_spec, odd_spec) pair, got {type(value).__name__}'
|
|
1958
|
+
)
|
|
1948
1959
|
self.__zebra = value
|
|
1949
1960
|
|
|
1950
1961
|
@row_stripe.setter
|
|
1951
1962
|
def row_stripe(self, value):
|
|
1952
|
-
self.
|
|
1963
|
+
self.zebra = value
|
|
1953
1964
|
|
|
1954
1965
|
@footer_rows.setter
|
|
1955
1966
|
def footer_rows(self, value):
|
|
@@ -2621,6 +2632,19 @@ class Table(object):
|
|
|
2621
2632
|
if isinstance(cell, str):
|
|
2622
2633
|
row[index] = parse_value(cell, True)
|
|
2623
2634
|
|
|
2635
|
+
def __coerce_incoming_value(self, value):
|
|
2636
|
+
"""Parse a newly added cell when ``parse_str_numbers`` is on."""
|
|
2637
|
+
if self.__parse_str_numbers and isinstance(value, str):
|
|
2638
|
+
from .readers import parse_value
|
|
2639
|
+
return parse_value(value, True)
|
|
2640
|
+
return value
|
|
2641
|
+
|
|
2642
|
+
def __coerce_incoming_sequence(self, data):
|
|
2643
|
+
"""Copy ``data`` with ``__coerce_incoming_value`` applied to each cell."""
|
|
2644
|
+
if data is None or not self.__parse_str_numbers:
|
|
2645
|
+
return data
|
|
2646
|
+
return [self.__coerce_incoming_value(cell) for cell in data]
|
|
2647
|
+
|
|
2624
2648
|
@property
|
|
2625
2649
|
def missing(self):
|
|
2626
2650
|
"""
|
|
@@ -3142,6 +3166,7 @@ class Table(object):
|
|
|
3142
3166
|
# top, which is right for a column that row had just created and
|
|
3143
3167
|
# wrong for this one, and its values came out shifted down by one.
|
|
3144
3168
|
is_new_column = checked_header not in self.__headers
|
|
3169
|
+
data = self.__coerce_incoming_sequence(data)
|
|
3145
3170
|
if is_new_column:
|
|
3146
3171
|
self.__add_header(checked_header)
|
|
3147
3172
|
self.__add_column_data(
|
|
@@ -3358,6 +3383,7 @@ class Table(object):
|
|
|
3358
3383
|
... | size 5 | 39865 |
|
|
3359
3384
|
... +----------+------------+
|
|
3360
3385
|
"""
|
|
3386
|
+
data = self.__coerce_incoming_sequence(data)
|
|
3361
3387
|
self.__columns_with_i[self.__index_title].append(self.__index_counter)
|
|
3362
3388
|
added_to_column_count = self.__add_row_data(data)
|
|
3363
3389
|
add_headers = True if added_to_column_count is not None else False
|
|
@@ -3406,9 +3432,7 @@ class Table(object):
|
|
|
3406
3432
|
f'{column_count} columns'
|
|
3407
3433
|
)
|
|
3408
3434
|
column_i = column % column_count
|
|
3409
|
-
|
|
3410
|
-
from .readers import parse_value
|
|
3411
|
-
value = parse_value(value, True)
|
|
3435
|
+
value = self.__coerce_incoming_value(value)
|
|
3412
3436
|
header = self.__headers[column_i]
|
|
3413
3437
|
# Both orientations hold the same data and both are read while
|
|
3414
3438
|
# rendering, so all four stores change together.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flexablelib
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.2
|
|
4
4
|
Summary: Fast, dependency-free terminal tables for Python: 56 border styles, ANSI colors, cell merges, decimal alignment, width fitting, and CSV/Markdown/HTML/Excel/LaTeX I/O.
|
|
5
5
|
Home-page: https://github.com/Opus-Perpetuus/flexablelib
|
|
6
6
|
Author: Benjamin Ramirez
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"""2.2.2 regressions: zebra=True and parse_str_numbers on add_column/add_row."""
|
|
2
|
+
import re
|
|
3
|
+
|
|
4
|
+
import pytest
|
|
5
|
+
|
|
6
|
+
from flexablelib import Table
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
ANSI = re.compile(r'\x1b\[[0-9;]*m')
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def bare(text: str) -> str:
|
|
13
|
+
return ANSI.sub('', text)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def test_zebra_true_turns_on_default_striping():
|
|
17
|
+
table = Table(rows=[[1], [2], [3]], headers=['n'])
|
|
18
|
+
table.use_colors = True
|
|
19
|
+
table.zebra = True
|
|
20
|
+
assert table.zebra == ('', 'reverse')
|
|
21
|
+
coloured = table.compose()
|
|
22
|
+
assert '\x1b[' in coloured
|
|
23
|
+
assert '1' in bare(coloured) and '2' in bare(coloured)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def test_zebra_false_clears_striping():
|
|
27
|
+
table = Table(rows=[[1], [2]], headers=['n'])
|
|
28
|
+
table.zebra = True
|
|
29
|
+
table.zebra = False
|
|
30
|
+
assert table.zebra is None
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def test_row_stripe_true_matches_zebra():
|
|
34
|
+
table = Table(rows=[[1], [2]], headers=['n'])
|
|
35
|
+
table.row_stripe = True
|
|
36
|
+
assert table.zebra == ('', 'reverse')
|
|
37
|
+
assert table.row_stripe == ('', 'reverse')
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_zebra_rejects_non_colour_objects():
|
|
41
|
+
table = Table()
|
|
42
|
+
with pytest.raises(TypeError, match='zebra must be'):
|
|
43
|
+
table.zebra = 3
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def test_parse_str_numbers_before_add_column():
|
|
47
|
+
"""Docs: order of the flag and the data must not matter."""
|
|
48
|
+
table = Table()
|
|
49
|
+
table.parse_str_numbers = True
|
|
50
|
+
table.add_column('n', ['10', '20', '3.5', 'x'])
|
|
51
|
+
assert table.rows == [[10], [20], [3.5], ['x']]
|
|
52
|
+
# Numeric column stays right-aligned once typed.
|
|
53
|
+
assert ' 10' in bare(table.compose()) or '| 10' in bare(table.compose())
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def test_parse_str_numbers_before_add_row():
|
|
57
|
+
table = Table()
|
|
58
|
+
table.parse_str_numbers = True
|
|
59
|
+
table.add_column('a')
|
|
60
|
+
table.add_column('b')
|
|
61
|
+
# Replace empty placeholders by adding typed rows via a fresh table.
|
|
62
|
+
table = Table()
|
|
63
|
+
table.parse_str_numbers = True
|
|
64
|
+
table.add_row(['1', '2.5'])
|
|
65
|
+
table.add_row(['3', 'x'])
|
|
66
|
+
assert table.rows == [[1, 2.5], [3, 'x']]
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def test_parse_str_numbers_off_keeps_digit_strings():
|
|
70
|
+
table = Table()
|
|
71
|
+
table.add_column('code', ['007', '1.50'])
|
|
72
|
+
assert table.rows == [['007'], ['1.50']]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|