From 435c13f84ddf0ff54c1a14322b4640026ec0fb80 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Thu, 5 Mar 2026 13:39:12 +0000 Subject: [PATCH 1/4] Fix compatibility with tabulate 0.10.0 Because `tabulate.PRESERVE_WHITESPACE` was replaced with a keyword argument but was not removed from the module namespace (even though modifying it no longer has any effect), the only way to check whether we should pass the new `preserve_whitespace` argument is to examine `tabulate.__version__`. This required adding a dependency on `packaging` to parse and compare the version string. --- cli_helpers/tabular_output/tabulate_adapter.py | 6 +++++- setup.py | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cli_helpers/tabular_output/tabulate_adapter.py b/cli_helpers/tabular_output/tabulate_adapter.py index 5caa55e..0872a3d 100644 --- a/cli_helpers/tabular_output/tabulate_adapter.py +++ b/cli_helpers/tabular_output/tabulate_adapter.py @@ -21,6 +21,7 @@ escape_newlines, ) +from packaging.version import Version import tabulate @@ -249,7 +250,10 @@ def adapter(data, headers, table_format=None, preserve_whitespace=False, **kwarg if table_format in supported_markup_formats: tkwargs.update(numalign=None, stralign=None) - tabulate.PRESERVE_WHITESPACE = preserve_whitespace + if Version(tabulate.__version__) < Version("0.10.0"): + tabulate.PRESERVE_WHITESPACE = preserve_whitespace + else: + tkwargs.update(preserve_whitespace=preserve_whitespace) tkwargs.update(default_kwargs.get(table_format, {})) if table_format in headless_formats: diff --git a/setup.py b/setup.py index 16ecf5b..f02c970 100755 --- a/setup.py +++ b/setup.py @@ -37,6 +37,7 @@ def open_file(filename): long_description_content_type="text/x-rst", install_requires=[ "configobj >= 5.0.5", + "packaging", "tabulate[widechars] >= 0.9.0", ], extras_require={ From eff1544712bcbede509a85ef346f8fb8fc4de718 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Thu, 5 Mar 2026 13:43:26 +0000 Subject: [PATCH 2/4] Changelog entry for tabulate 0.10 support --- CHANGELOG | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index f078662..a4aff98 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,9 @@ # Changelog +## [Unreleased] + +- Support version 0.10 of `tabulate` + ## Version 2.10.1 (released on 2025-02-18) From 9120d7e9286b9659e54cd6f22d44ec534e01d08b Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Thu, 5 Mar 2026 13:44:04 +0000 Subject: [PATCH 3/4] Add Benjamin Beasley as a contributor in AUTHORS --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index 536b972..17bf821 100644 --- a/AUTHORS +++ b/AUTHORS @@ -26,6 +26,7 @@ This project receives help from these awesome contributors: - Andrii Kohut - Roland Walker - Doug Harris +- Benjamin Beasley Thanks ------ From 4b291642952e760d0273056589b81c09165c6a79 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Thu, 5 Mar 2026 14:23:15 +0000 Subject: [PATCH 4/4] Require tabulate>=0.10.0 to avoid a packaging dependency --- CHANGELOG | 2 +- cli_helpers/tabular_output/tabulate_adapter.py | 6 +----- setup.py | 3 +-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index a4aff98..d2a3c76 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,7 +2,7 @@ ## [Unreleased] -- Support version 0.10 of `tabulate` +- Support and require version 0.10 of `tabulate` ## Version 2.10.1 diff --git a/cli_helpers/tabular_output/tabulate_adapter.py b/cli_helpers/tabular_output/tabulate_adapter.py index 0872a3d..cf32da5 100644 --- a/cli_helpers/tabular_output/tabulate_adapter.py +++ b/cli_helpers/tabular_output/tabulate_adapter.py @@ -21,7 +21,6 @@ escape_newlines, ) -from packaging.version import Version import tabulate @@ -250,10 +249,7 @@ def adapter(data, headers, table_format=None, preserve_whitespace=False, **kwarg if table_format in supported_markup_formats: tkwargs.update(numalign=None, stralign=None) - if Version(tabulate.__version__) < Version("0.10.0"): - tabulate.PRESERVE_WHITESPACE = preserve_whitespace - else: - tkwargs.update(preserve_whitespace=preserve_whitespace) + tkwargs.update(preserve_whitespace=preserve_whitespace) tkwargs.update(default_kwargs.get(table_format, {})) if table_format in headless_formats: diff --git a/setup.py b/setup.py index f02c970..3b1cc9e 100755 --- a/setup.py +++ b/setup.py @@ -37,8 +37,7 @@ def open_file(filename): long_description_content_type="text/x-rst", install_requires=[ "configobj >= 5.0.5", - "packaging", - "tabulate[widechars] >= 0.9.0", + "tabulate[widechars] >= 0.10.0", ], extras_require={ "styles": ["Pygments >= 1.6"],