flexablelib 2.2.3__tar.gz → 2.3.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.
Files changed (71) hide show
  1. {flexablelib-2.2.3 → flexablelib-2.3.0}/CHANGELOG.md +64 -0
  2. {flexablelib-2.2.3/flexablelib.egg-info → flexablelib-2.3.0}/PKG-INFO +23 -1
  3. {flexablelib-2.2.3 → flexablelib-2.3.0}/README.md +22 -0
  4. {flexablelib-2.2.3 → flexablelib-2.3.0}/flexablelib/columns.py +3 -0
  5. {flexablelib-2.2.3 → flexablelib-2.3.0}/flexablelib/merges.py +62 -3
  6. {flexablelib-2.2.3 → flexablelib-2.3.0}/flexablelib/readers.py +9 -1
  7. {flexablelib-2.2.3 → flexablelib-2.3.0}/flexablelib/table.py +202 -57
  8. {flexablelib-2.2.3 → flexablelib-2.3.0/flexablelib.egg-info}/PKG-INFO +23 -1
  9. {flexablelib-2.2.3 → flexablelib-2.3.0}/flexablelib.egg-info/SOURCES.txt +4 -0
  10. {flexablelib-2.2.3 → flexablelib-2.3.0}/package.json +1 -1
  11. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_merges.py +3 -1
  12. flexablelib-2.3.0/tests/test_stress_matrix.py +54 -0
  13. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_v219_fixes.py +3 -2
  14. flexablelib-2.3.0/tests/test_v224_fixes.py +235 -0
  15. flexablelib-2.3.0/tests/test_v230_none.py +88 -0
  16. flexablelib-2.3.0/tools/stress_matrix.py +657 -0
  17. {flexablelib-2.2.3 → flexablelib-2.3.0}/LICENSE +0 -0
  18. {flexablelib-2.2.3 → flexablelib-2.3.0}/MANIFEST.in +0 -0
  19. {flexablelib-2.2.3 → flexablelib-2.3.0}/flexablelib/__init__.py +0 -0
  20. {flexablelib-2.2.3 → flexablelib-2.3.0}/flexablelib/_speedups.c +0 -0
  21. {flexablelib-2.2.3 → flexablelib-2.3.0}/flexablelib/_width_tables.h +0 -0
  22. {flexablelib-2.2.3 → flexablelib-2.3.0}/flexablelib/cells.py +0 -0
  23. {flexablelib-2.2.3 → flexablelib-2.3.0}/flexablelib/colors.py +0 -0
  24. {flexablelib-2.2.3 → flexablelib-2.3.0}/flexablelib/fast.py +0 -0
  25. {flexablelib-2.2.3 → flexablelib-2.3.0}/flexablelib/options.py +0 -0
  26. {flexablelib-2.2.3 → flexablelib-2.3.0}/flexablelib/py.typed +0 -0
  27. {flexablelib-2.2.3 → flexablelib-2.3.0}/flexablelib/style_compositions.py +0 -0
  28. {flexablelib-2.2.3 → flexablelib-2.3.0}/flexablelib/table_strings.py +0 -0
  29. {flexablelib-2.2.3 → flexablelib-2.3.0}/flexablelib/text_width.py +0 -0
  30. {flexablelib-2.2.3 → flexablelib-2.3.0}/flexablelib/utils.py +0 -0
  31. {flexablelib-2.2.3 → flexablelib-2.3.0}/flexablelib/writers.py +0 -0
  32. {flexablelib-2.2.3 → flexablelib-2.3.0}/flexablelib.egg-info/dependency_links.txt +0 -0
  33. {flexablelib-2.2.3 → flexablelib-2.3.0}/flexablelib.egg-info/requires.txt +0 -0
  34. {flexablelib-2.2.3 → flexablelib-2.3.0}/flexablelib.egg-info/top_level.txt +0 -0
  35. {flexablelib-2.2.3 → flexablelib-2.3.0}/pytest.ini +0 -0
  36. {flexablelib-2.2.3 → flexablelib-2.3.0}/setup.cfg +0 -0
  37. {flexablelib-2.2.3 → flexablelib-2.3.0}/setup.py +0 -0
  38. {flexablelib-2.2.3 → flexablelib-2.3.0}/style_examples.md +0 -0
  39. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/conftest.py +0 -0
  40. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/helpers.py +0 -0
  41. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_cells.py +0 -0
  42. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_columns.py +0 -0
  43. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_excel.py +0 -0
  44. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_features.py +0 -0
  45. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_issues.py +0 -0
  46. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_merge_edge_matrix.py +0 -0
  47. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_readme_examples.py +0 -0
  48. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_style_line_widths.py +0 -0
  49. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_styles.py +0 -0
  50. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_text_width.py +0 -0
  51. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_two_pass_measurement.py +0 -0
  52. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_upstream_issues.py +0 -0
  53. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_v2021_fixes.py +0 -0
  54. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_v210_rows_copy.py +0 -0
  55. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_v2110_fixes.py +0 -0
  56. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_v211_fixes.py +0 -0
  57. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_v213_features.py +0 -0
  58. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_v214_features.py +0 -0
  59. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_v215_features.py +0 -0
  60. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_v216_features.py +0 -0
  61. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_v217_features.py +0 -0
  62. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_v218_features.py +0 -0
  63. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_v219_coverage.py +0 -0
  64. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_v220_exports.py +0 -0
  65. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_v221_fixes.py +0 -0
  66. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_v222_fixes.py +0 -0
  67. {flexablelib-2.2.3 → flexablelib-2.3.0}/tests/test_v223_fixes.py +0 -0
  68. {flexablelib-2.2.3 → flexablelib-2.3.0}/tools/benchmark.py +0 -0
  69. {flexablelib-2.2.3 → flexablelib-2.3.0}/tools/generate_width_tables.py +0 -0
  70. {flexablelib-2.2.3 → flexablelib-2.3.0}/tools/readme_gallery.py +0 -0
  71. {flexablelib-2.2.3 → flexablelib-2.3.0}/tools/text_to_png.py +0 -0
@@ -2,6 +2,70 @@
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.3.0] - 2026-11-07
6
+
7
+ ### Changed (visible behaviour)
8
+ - Explicit ``None`` now displays ``missing_value`` (blank by default), just
9
+ like a padding gap or ``table.missing``. Previously it printed ``None``.
10
+ Use the string ``"None"`` to retain that literal output. Applies to every
11
+ style, printing/``compose``, pagination, streaming and transposition.
12
+ - A numeric column containing ``None`` keeps its numeric type, alignment
13
+ and decimal axis; wrapping no longer splits its numbers as text.
14
+ - Derived tables used for pagination/streaming preserve gaps as missing data
15
+ instead of converting the placeholder to text before inferring types.
16
+ ``Table(rows=t.rows)`` preserves the visible cells with matching settings.
17
+ Raw rows and export missing-value semantics are unchanged.
18
+
19
+ ### Tests and documentation
20
+ - Regressions across all 56 styles, three missing-value displays and all
21
+ render paths; raw/formatted exports, row round-trips and numeric wrapping.
22
+ - The stress matrix now compares None, padding sentinels and row round-trips
23
+ in every style/theme and mode; stream budgets include decimal-axis width
24
+ and a feasible terminal budget (narrow fits are covered outside stream).
25
+ - README and ``docs/MISSING_VALUES.md`` explain the visible change.
26
+
27
+ ## [2.2.4] - 2026-11-07
28
+
29
+ Found by a new stress matrix (``tools/stress_matrix.py``): every style and
30
+ theme on a 30x50 table of mixed data (CJK, emoji, multi-line, ``None``),
31
+ each feature alone, a pairwise covering set of all feature options, and
32
+ "everything at once" combos, checking line widths, border junctions,
33
+ visible rows, export order and determinism. A reduced version runs in the
34
+ test suite (``tests/test_stress_matrix.py``).
35
+
36
+ ### Fixed
37
+ - Fitting a table to the terminal (``max_width``) or capping one column
38
+ (``column_max_width``) left-aligned every other int column and the index,
39
+ even ones that were not shortened. Only a column that really loses
40
+ characters is turned into text now.
41
+ - ``add_divider`` / ``divide_every`` in a style without inter-row rules drew
42
+ a run of ASCII ``-`` across the column lines (``│ a │`` / ``-------``). The
43
+ divider now uses the style's glyphs (``├───┼───┤``, ``╞═══╪═══╡``,
44
+ ``+---+``, ``|---|`` for markdown/pipes/orgtbl, edge to edge for
45
+ ``*_ebody`` styles), skipping hidden columns; styles with no column lines
46
+ keep the dashed line.
47
+ - Merges in ``tilg_columns``, ``dots``, ``psql``/``presto`` and other
48
+ non-box styles got light box glyphs (``│ ├ ┴``) for their caps. ASCII
49
+ column lines now join with ``+`` and ``dots`` with ``:`` (dividers in
50
+ ``dots`` too).
51
+ - ``expand_to_window`` with ``column_max_width`` pulled a column that was
52
+ already wider than its cap (numbers are never cut) back to the cap, so its
53
+ cells overflowed the rules and the frame broke (also on ``paginate`` pages).
54
+ - ``stream()``:
55
+ - with ``show_index`` and ``column_min_width`` or ``column_max_width``
56
+ raised ``IndexError``; with ``show_index`` alone nothing was frozen and
57
+ the lines grew as rows arrived. The index width is now reserved for a
58
+ sized input (``len(rows)``), including roman numerals.
59
+ - with ``zebra`` or cell backgrounds lost every row and printed the bottom
60
+ border after the header and after each row.
61
+ - with ``show_headers=False`` on an empty table raised ``ValueError``
62
+ (``column_max_width must be >= 1``), and with ``panel`` / ``shadow`` on a
63
+ borderless style closed the panel after the first row.
64
+ - ``title`` and ``caption`` were not centred on a table with no rows.
65
+ - ``Table.from_csv`` accepts CSV text, so ``from_csv(table.to_csv())``
66
+ round-trips like ``from_markdown`` and ``from_html`` already did. Paths
67
+ and open handles work as before.
68
+
5
69
  ## [2.2.3] - 2026-11-06
6
70
 
7
71
  ### Fixed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flexablelib
3
- Version: 2.2.3
3
+ Version: 2.3.0
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
@@ -347,6 +347,28 @@ print(new_table)
347
347
  ```
348
348
  The missing value aligns as if it was of the same type of the other data in the column.
349
349
 
350
+ **Changed in 2.3.0:** an explicit `None` is a missing cell, just like a
351
+ padding gap or `table.missing`. It displays `missing_value` (blank by default),
352
+ not the text `"None"`. Set `table.missing_value = '?'` to show gaps explicitly.
353
+ Use the string `"None"` if you want that literal text. This applies to printing,
354
+ `compose()`, pagination, streaming, and transposition in every style.
355
+
356
+ Missing cells do not turn numeric columns into text: numeric alignment and
357
+ the decimal axis are preserved, and `overflow='wrap'` does not split floats
358
+ because a column contains `None`. Raw `rows` and exports still represent gaps
359
+ as `None`; rendering `Table(rows=table.rows)` reproduces the same cells (copy
360
+ headers and display settings too if you changed them).
361
+
362
+ ```python
363
+ table = Table(rows=[[924.87], [None], [1.25]])
364
+ assert 'None' not in table.compose()
365
+ assert Table(rows=table.rows).compose() == table.compose()
366
+ table.missing_value = '?' # changes the display, not stored None values
367
+ ```
368
+
369
+ See [missing-cell semantics](docs/MISSING_VALUES.md) for migration details.
370
+
371
+
350
372
  This shows how to get the row and column count. If the index is shown, this count remains unaffected by that column, although, you can get the internal count.
351
373
 
352
374
  ### Code Example
@@ -282,6 +282,28 @@ print(new_table)
282
282
  ```
283
283
  The missing value aligns as if it was of the same type of the other data in the column.
284
284
 
285
+ **Changed in 2.3.0:** an explicit `None` is a missing cell, just like a
286
+ padding gap or `table.missing`. It displays `missing_value` (blank by default),
287
+ not the text `"None"`. Set `table.missing_value = '?'` to show gaps explicitly.
288
+ Use the string `"None"` if you want that literal text. This applies to printing,
289
+ `compose()`, pagination, streaming, and transposition in every style.
290
+
291
+ Missing cells do not turn numeric columns into text: numeric alignment and
292
+ the decimal axis are preserved, and `overflow='wrap'` does not split floats
293
+ because a column contains `None`. Raw `rows` and exports still represent gaps
294
+ as `None`; rendering `Table(rows=table.rows)` reproduces the same cells (copy
295
+ headers and display settings too if you changed them).
296
+
297
+ ```python
298
+ table = Table(rows=[[924.87], [None], [1.25]])
299
+ assert 'None' not in table.compose()
300
+ assert Table(rows=table.rows).compose() == table.compose()
301
+ table.missing_value = '?' # changes the display, not stored None values
302
+ ```
303
+
304
+ See [missing-cell semantics](docs/MISSING_VALUES.md) for migration details.
305
+
306
+
285
307
  This shows how to get the row and column count. If the index is shown, this count remains unaffected by that column, although, you can get the internal count.
286
308
 
287
309
  ### Code Example
@@ -628,6 +628,9 @@ def _typify_column(column: Union[list, tuple],
628
628
  if index_column:
629
629
  # If it is the index column, it will be took in count as int.
630
630
  identified_types.append(int.__name__)
631
+ elif row is None:
632
+ # An explicit None is the same gap as the padding sentinel.
633
+ identified_types.append(TYPE_NAMES.value_placer_)
631
634
  elif row != '':
632
635
  # Get the type as long as is not an empty string.
633
636
  identified_types.append(type(row).__name__)
@@ -349,9 +349,13 @@ def _pick_junction(v_glyph: str, h_glyph: str, n: bool, s: bool, e: bool, w: boo
349
349
  if v_glyph in '|+' or (h_glyph and h_glyph in '-=~'):
350
350
  return h_glyph if h_glyph in '-=~' else '-'
351
351
  return h_glyph or '─'
352
- if v_glyph in '|+' or (h_glyph and h_glyph in '-=') :
353
- if v_glyph in '|+' and (h_glyph in '-=+' or not h_glyph):
354
- return _ASCII.get(key, '+')
352
+ if v_glyph in '|+':
353
+ # ASCII column lines join with '+' whatever the dash ('-', '=', '~').
354
+ return _ASCII.get(key, '+')
355
+ if v_glyph and not ('\u2500' <= v_glyph <= '\u257f'):
356
+ # Other non-box column glyphs (``dots`` draws ':') are their own
357
+ # junction; a light box tee next to them is a foreign glyph.
358
+ return v_glyph
355
359
  if v_glyph == '║' and h_glyph == '═':
356
360
  return _DOUBLE.get(key, '║')
357
361
  if v_glyph == '║':
@@ -383,6 +387,14 @@ def _synthesize_body_rule(composition):
383
387
  h = end.middle
384
388
  elif header is not None and header.middle:
385
389
  h = header.middle
390
+ if not ('\u2500' <= v.middle <= '\u257f') and v.middle not in '|+':
391
+ # Non-box column glyphs (``dots`` draws ':') are their own junction.
392
+ return SeparatorLine(
393
+ left=v.left or None,
394
+ middle=h if h and not ('\u2500' <= h <= '\u257f') else '-',
395
+ intersection=v.middle,
396
+ right=v.right or None,
397
+ )
386
398
  if v.middle in '|+':
387
399
  return SeparatorLine(
388
400
  left='+' if v.left else None,
@@ -412,6 +424,53 @@ def _synthesize_body_rule(composition):
412
424
  )
413
425
 
414
426
 
427
+ _FRAME_TEES = {
428
+ # vertical glyph -> (left tee, right tee) for a light horizontal
429
+ '│': ('├', '┤'), '┊': ('├', '┤'), '┆': ('├', '┤'), '╎': ('├', '┤'),
430
+ '┃': ('┠', '┨'), '║': ('╟', '╢'), '|': ('+', '+'),
431
+ }
432
+ _FRAME_TEES_DOUBLE_H = {
433
+ '│': ('╞', '╡'), '║': ('╠', '╣'), '|': ('+', '+'),
434
+ }
435
+
436
+
437
+ def _frame_only_body_rule(composition):
438
+ """Body rule for styles with outer verticals but no column lines.
439
+
440
+ ``*_ebody`` / ``*_empty`` styles frame the body without separating its
441
+ columns, so the rule runs edge to edge and only meets the frame.
442
+ Returns None when the body has no outer verticals either.
443
+ """
444
+ from .style_compositions import SeparatorLine
445
+ v = composition.vertical_table_body_lines
446
+ if v is None:
447
+ return None
448
+ left_v = _glyph(v.left or '')
449
+ right_v = _glyph(v.right or '')
450
+ if not (left_v.strip() or right_v.strip()):
451
+ return None
452
+ end = composition.table_end_line
453
+ h = _glyph(end.middle) if end is not None and end.middle else ''
454
+ if not h or h.isspace():
455
+ h = '-' if '|' in (left_v, right_v) else '─'
456
+ tees = _FRAME_TEES_DOUBLE_H if h == '═' else _FRAME_TEES
457
+ if '|' in (left_v, right_v) and h not in '-=~':
458
+ h = '-'
459
+
460
+ def tee(glyph, side):
461
+ if not glyph or glyph.isspace():
462
+ return None
463
+ pair = tees.get(glyph) or _FRAME_TEES.get(glyph)
464
+ return pair[side] if pair else glyph
465
+
466
+ return SeparatorLine(
467
+ left=tee(left_v, 0),
468
+ middle=h,
469
+ intersection=h,
470
+ right=tee(right_v, 1),
471
+ )
472
+
473
+
415
474
  def _build_rule_line(layout, composition, column_widths, hidden, rule=None):
416
475
  """Assemble one full horizontal rule matching the column layout."""
417
476
  rule = rule or _synthesize_body_rule(composition)
@@ -177,7 +177,11 @@ def from_csv(table_class, source, parse_numbers: bool = True,
177
177
  lineterminator=None, skipinitialspace=None, strict=None,
178
178
  **options):
179
179
  """
180
- Build from a CSV file path, or any open text handle.
180
+ Build from a CSV file path, an open text handle, or CSV text.
181
+
182
+ A string holding a line break that is not an existing file is read as
183
+ CSV text, so ``Table.from_csv(table.to_csv())`` round-trips the way
184
+ ``from_markdown`` and ``from_html`` already did with their writers.
181
185
 
182
186
  With ``has_header`` false, columns are named automatically.
183
187
 
@@ -192,6 +196,10 @@ def from_csv(table_class, source, parse_numbers: bool = True,
192
196
  doublequote=doublequote, lineterminator=lineterminator,
193
197
  skipinitialspace=skipinitialspace, strict=strict,
194
198
  )
199
+ if isinstance(source, str) and ('\n' in source or '\r' in source):
200
+ import os
201
+ if not os.path.isfile(source):
202
+ source = _io.StringIO(source, newline='')
195
203
  if hasattr(source, 'read'):
196
204
  reader = _csv.reader(source, **reader_kwargs)
197
205
  rows = [row for row in reader]