Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-cli-helpers for openSUSE:Factory checked in at 2026-02-17 16:48:00 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-cli-helpers (Old) and /work/SRC/openSUSE:Factory/.python-cli-helpers.new.1977 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-cli-helpers" Tue Feb 17 16:48:00 2026 rev:13 rq:1333407 version:2.10.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-cli-helpers/python-cli-helpers.changes 2026-02-13 12:48:21.186343361 +0100 +++ /work/SRC/openSUSE:Factory/.python-cli-helpers.new.1977/python-cli-helpers.changes 2026-02-17 16:48:58.203501700 +0100 @@ -1,0 +2,9 @@ +Mon Feb 16 17:07:06 UTC 2026 - Dirk Müller <[email protected]> + +- update to 2.10.0: + * Allow TrueColor Pygments formatters, based on the `COLORTERM` + env variable. + * Add optional `convert_to_undecoded_string` preprocessor. + * Pass `colalign` argument through to `tabulate`. + +------------------------------------------------------------------- Old: ---- cli_helpers-2.7.0.tar.gz New: ---- cli_helpers-2.10.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-cli-helpers.spec ++++++ --- /var/tmp/diff_new_pack.FWxSoP/_old 2026-02-17 16:49:00.611602348 +0100 +++ /var/tmp/diff_new_pack.FWxSoP/_new 2026-02-17 16:49:00.623602850 +0100 @@ -17,7 +17,7 @@ Name: python-cli-helpers -Version: 2.7.0 +Version: 2.10.0 Release: 0 Summary: Helpers for building command-line apps License: BSD-3-Clause ++++++ cli_helpers-2.7.0.tar.gz -> cli_helpers-2.10.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-2.7.0/CHANGELOG new/cli_helpers-2.10.0/CHANGELOG --- old/cli_helpers-2.7.0/CHANGELOG 2025-07-28 12:30:41.000000000 +0200 +++ new/cli_helpers-2.10.0/CHANGELOG 2026-02-09 11:37:32.000000000 +0100 @@ -1,5 +1,35 @@ # Changelog +## Version 2.10.0 + +(released on 2026-02-09) + +- Allow TrueColor Pygments formatters, based on the `COLORTERM` env variable. + +## Version 2.9.0 + +(released on 2026-01-26) + +- Add optional `convert_to_undecoded_string` preprocessor. + +## Version 2.8.2 + +(released on 2026-01-26) + +- Revert: don't attempt to UTF-8-decode binary values. + +## Version 2.8.1 + +(released on 2026-01-24) + +- Don't attempt to UTF-8-decode binary values. + +## Version 2.8.0 + +(released on 2026-01-24) + +- Pass `colalign` argument through to `tabulate`. + ## Version 2.7.0 (released on 2025-07-28) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-2.7.0/PKG-INFO new/cli_helpers-2.10.0/PKG-INFO --- old/cli_helpers-2.7.0/PKG-INFO 2025-07-28 12:35:43.000000000 +0200 +++ new/cli_helpers-2.10.0/PKG-INFO 2026-02-09 11:40:24.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.4 Name: cli_helpers -Version: 2.7.0 +Version: 2.10.0 Summary: Helpers for building command-line apps Home-page: https://github.com/dbcli/cli_helpers Author: dbcli diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-2.7.0/cli_helpers/__init__.py new/cli_helpers-2.10.0/cli_helpers/__init__.py --- old/cli_helpers-2.7.0/cli_helpers/__init__.py 2025-07-28 12:31:07.000000000 +0200 +++ new/cli_helpers-2.10.0/cli_helpers/__init__.py 2026-02-09 11:38:31.000000000 +0100 @@ -1 +1 @@ -__version__ = "2.7.0" +__version__ = "2.10.0" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-2.7.0/cli_helpers/compat.py new/cli_helpers-2.10.0/cli_helpers/compat.py --- old/cli_helpers-2.7.0/cli_helpers/compat.py 2022-09-14 02:59:33.000000000 +0200 +++ new/cli_helpers-2.10.0/cli_helpers/compat.py 2026-02-09 11:37:32.000000000 +0100 @@ -36,10 +36,14 @@ HAS_PYGMENTS = True try: from pygments.token import Token - from pygments.formatters.terminal256 import Terminal256Formatter + from pygments.formatters.terminal256 import ( + TerminalTrueColorFormatter, + Terminal256Formatter, + ) except ImportError: HAS_PYGMENTS = False Terminal256Formatter = None + TerminalTrueColorFormatter = None Token = SimpleNamespace() Token.Output = SimpleNamespace() Token.Output.Header = None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-2.7.0/cli_helpers/tabular_output/preprocessors.py new/cli_helpers-2.10.0/cli_helpers/tabular_output/preprocessors.py --- old/cli_helpers-2.7.0/cli_helpers/tabular_output/preprocessors.py 2025-07-09 22:00:36.000000000 +0200 +++ new/cli_helpers-2.10.0/cli_helpers/tabular_output/preprocessors.py 2026-01-26 15:04:46.000000000 +0100 @@ -55,6 +55,26 @@ ) +def convert_to_undecoded_string(data, headers, **_): + """Convert all *data* and *headers* to hex, if needed. + + Binary data is converted to a hexadecimal representation via + :func:`binascii.hexlify`. + + Unlike convert_to_string(), None values are left as Nones. + + :param iterable data: An :term:`iterable` (e.g. list) of rows. + :param iterable headers: The column headers. + :return: The processed data and headers. + :rtype: tuple + + """ + return ( + ([utils.to_undecoded_string(v) for v in row] for row in data), + [utils.to_undecoded_string(h) for h in headers], + ) + + def override_missing_value( data, headers, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-2.7.0/cli_helpers/tabular_output/tabulate_adapter.py new/cli_helpers-2.10.0/cli_helpers/tabular_output/tabulate_adapter.py --- old/cli_helpers-2.7.0/cli_helpers/tabular_output/tabulate_adapter.py 2025-07-28 12:30:41.000000000 +0200 +++ new/cli_helpers-2.10.0/cli_helpers/tabular_output/tabulate_adapter.py 2026-02-09 11:37:32.000000000 +0100 @@ -3,8 +3,15 @@ from __future__ import unicode_literals +import os + from cli_helpers.utils import filter_dict_by_key -from cli_helpers.compat import Terminal256Formatter, Token, StringIO +from cli_helpers.compat import ( + Terminal256Formatter, + TerminalTrueColorFormatter, + Token, + StringIO, +) from .preprocessors import ( convert_to_string, truncate_string, @@ -193,7 +200,10 @@ """ if style and HAS_PYGMENTS and format_name in supported_table_formats: - formatter = Terminal256Formatter(style=style) + if "truecolor" in os.getenv("COLORTERM", "").lower(): + formatter = TerminalTrueColorFormatter(style=style) + else: + formatter = Terminal256Formatter(style=style) def style_field(token, field): """Get the styled text for a *field* using *token* type.""" @@ -225,7 +235,14 @@ def adapter(data, headers, table_format=None, preserve_whitespace=False, **kwargs): """Wrap tabulate inside a function for TabularOutputFormatter.""" - keys = ("floatfmt", "numalign", "stralign", "showindex", "disable_numparse") + keys = ( + "floatfmt", + "numalign", + "stralign", + "showindex", + "disable_numparse", + "colalign", + ) tkwargs = {"tablefmt": table_format} tkwargs.update(filter_dict_by_key(kwargs, keys)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-2.7.0/cli_helpers/utils.py new/cli_helpers-2.10.0/cli_helpers/utils.py --- old/cli_helpers-2.7.0/cli_helpers/utils.py 2022-09-14 02:59:33.000000000 +0200 +++ new/cli_helpers-2.10.0/cli_helpers/utils.py 2026-02-09 11:37:32.000000000 +0100 @@ -2,6 +2,7 @@ """Various utility functions and helpers.""" import binascii +import os import re from functools import lru_cache from typing import Dict @@ -11,7 +12,13 @@ if TYPE_CHECKING: from pygments.style import StyleMeta -from cli_helpers.compat import binary_type, text_type, Terminal256Formatter, StringIO +from cli_helpers.compat import ( + binary_type, + text_type, + Terminal256Formatter, + TerminalTrueColorFormatter, + StringIO, +) def bytes_to_string(b): @@ -34,6 +41,17 @@ return b +def to_hex_if_bin(b): + """Convert bytes *b* to a string. + + Pass b through if not bytes. + + """ + if isinstance(b, binary_type): + return "0x" + binascii.hexlify(b).decode("ascii") + return b + + def to_string(value): """Convert *value* to a string.""" if isinstance(value, binary_type): @@ -42,6 +60,19 @@ return text_type(value) +def to_undecoded_string(value): + """Convert *value* to an undecoded string, respecting Nones.""" + # preserve Nones so that + # * this can run before override_missing_value when stringifying + # * Nones are preserved in formats such as CSV + if value is None: + return None + elif isinstance(value, binary_type): + return to_hex_if_bin(value) + else: + return text_type(value) + + def truncate_string(value, max_width=None, skip_multiline_string=True): """Truncate string values.""" if skip_multiline_string and isinstance(value, text_type) and "\n" in value: @@ -88,8 +119,11 @@ @lru_cache() -def _get_formatter(style) -> Terminal256Formatter: - return Terminal256Formatter(style=style) +def _get_formatter(style) -> Terminal256Formatter | TerminalTrueColorFormatter: + if "truecolor" in os.getenv("COLORTERM", "").lower(): + return TerminalTrueColorFormatter(style=style) + else: + return Terminal256Formatter(style=style) def style_field(token, field, style): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-2.7.0/cli_helpers.egg-info/PKG-INFO new/cli_helpers-2.10.0/cli_helpers.egg-info/PKG-INFO --- old/cli_helpers-2.7.0/cli_helpers.egg-info/PKG-INFO 2025-07-28 12:35:43.000000000 +0200 +++ new/cli_helpers-2.10.0/cli_helpers.egg-info/PKG-INFO 2026-02-09 11:40:24.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.4 Name: cli_helpers -Version: 2.7.0 +Version: 2.10.0 Summary: Helpers for building command-line apps Home-page: https://github.com/dbcli/cli_helpers Author: dbcli diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-2.7.0/tests/tabular_output/test_preprocessors.py new/cli_helpers-2.10.0/tests/tabular_output/test_preprocessors.py --- old/cli_helpers-2.7.0/tests/tabular_output/test_preprocessors.py 2025-07-09 22:00:36.000000000 +0200 +++ new/cli_helpers-2.10.0/tests/tabular_output/test_preprocessors.py 2026-02-09 11:37:32.000000000 +0100 @@ -3,6 +3,7 @@ from __future__ import unicode_literals from decimal import Decimal +import os import pytest @@ -11,6 +12,7 @@ align_decimals, bytes_to_string, convert_to_string, + convert_to_undecoded_string, quote_whitespaces, override_missing_value, override_tab_value, @@ -28,6 +30,12 @@ import types [email protected] +def TwoFiftySixColor(): + # todo: finalize this fixture by resetting the env value + os.environ["COLORTERM"] = "" + + def test_convert_to_string(): """Test the convert_to_string() function.""" data = [[1, "John"], [2, "Jill"]] @@ -38,6 +46,16 @@ assert expected == (list(results[0]), results[1]) +def test_convert_to_undecoded_string(): + """Test the convert_to_undecoded_string() function.""" + data = [[1, "John"], [2, b"Jill"], [3, None]] + headers = [0, "name"] + expected = ([["1", "John"], ["2", "0x4a696c6c"], ["3", None]], ["0", "name"]) + results = convert_to_undecoded_string(data, headers) + + assert expected == (list(results[0]), results[1]) + + def test_override_missing_values(): """Test the override_missing_values() function.""" data = [[1, None], [2, "Jill"]] @@ -49,7 +67,7 @@ @pytest.mark.skipif(not HAS_PYGMENTS, reason="requires the Pygments library") -def test_override_missing_value_with_style(): +def test_override_missing_value_with_style(TwoFiftySixColor): """Test that *override_missing_value()* styles output.""" class NullStyle(Style): @@ -174,7 +192,7 @@ @pytest.mark.skipif(not HAS_PYGMENTS, reason="requires the Pygments library") -def test_style_output(): +def test_style_output(TwoFiftySixColor): """Test that *style_output()* styles output.""" class CliStyle(Style): @@ -199,7 +217,7 @@ @pytest.mark.skipif(not HAS_PYGMENTS, reason="requires the Pygments library") -def test_style_output_with_newlines(): +def test_style_output_with_newlines(TwoFiftySixColor): """Test that *style_output()* styles output with newlines in it.""" class CliStyle(Style): @@ -227,7 +245,7 @@ @pytest.mark.skipif(not HAS_PYGMENTS, reason="requires the Pygments library") -def test_style_output_custom_tokens(): +def test_style_output_custom_tokens(TwoFiftySixColor): """Test that *style_output()* styles output with custom token names.""" class CliStyle(Style): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-2.7.0/tests/tabular_output/test_tabulate_adapter.py new/cli_helpers-2.10.0/tests/tabular_output/test_tabulate_adapter.py --- old/cli_helpers-2.7.0/tests/tabular_output/test_tabulate_adapter.py 2022-09-14 02:59:33.000000000 +0200 +++ new/cli_helpers-2.10.0/tests/tabular_output/test_tabulate_adapter.py 2026-01-26 14:30:27.000000000 +0100 @@ -42,6 +42,24 @@ └─────────┴────────┘""" ) + data = [["abc", 1], ["d", 456]] + headers = ["letters", "number"] + output = tabulate_adapter.adapter( + iter(data), + headers, + colalign=["left", "left"], + table_format="psql_unicode", + ) + assert "\n".join(output) == dedent( + """\ + ┌─────────┬────────┐ + │ letters │ number │ + ├─────────┼────────┤ + │ abc │ 1 │ + │ d │ 456 │ + └─────────┴────────┘""" + ) + data = [["{1,2,3}", "{{1,2},{3,4}}", "{å,魚,текст}"], ["{}", "<null>", "{<null>}"]] headers = ["bigint_array", "nested_numeric_array", "配列"] output = tabulate_adapter.adapter(iter(data), headers, table_format="psql")
