cli-helpers 2.11.0__tar.gz → 2.13.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 (64) hide show
  1. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/CHANGELOG +15 -2
  2. {cli_helpers-2.11.0/cli_helpers.egg-info → cli_helpers-2.13.0}/PKG-INFO +2 -2
  3. cli_helpers-2.13.0/cli_helpers/__init__.py +1 -0
  4. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/cli_helpers/tabular_output/tabulate_adapter.py +9 -2
  5. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/cli_helpers/utils.py +13 -1
  6. {cli_helpers-2.11.0 → cli_helpers-2.13.0/cli_helpers.egg-info}/PKG-INFO +2 -2
  7. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/cli_helpers.egg-info/requires.txt +1 -1
  8. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/requirements-dev.txt +1 -1
  9. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/setup.py +1 -1
  10. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/tests/test_utils.py +25 -0
  11. cli_helpers-2.11.0/cli_helpers/__init__.py +0 -1
  12. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  13. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/.github/workflows/codeql.yml +0 -0
  14. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/.gitignore +0 -0
  15. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/.travis/install.sh +0 -0
  16. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/.travis.yml +0 -0
  17. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/AUTHORS +0 -0
  18. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/CONTRIBUTING.rst +0 -0
  19. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/LICENSE +0 -0
  20. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/MANIFEST.in +0 -0
  21. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/README.rst +0 -0
  22. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/appveyor.yml +0 -0
  23. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/cli_helpers/compat.py +0 -0
  24. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/cli_helpers/config.py +0 -0
  25. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/cli_helpers/tabular_output/__init__.py +0 -0
  26. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/cli_helpers/tabular_output/delimited_output_adapter.py +0 -0
  27. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/cli_helpers/tabular_output/json_output_adapter.py +0 -0
  28. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/cli_helpers/tabular_output/output_formatter.py +0 -0
  29. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/cli_helpers/tabular_output/preprocessors.py +0 -0
  30. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/cli_helpers/tabular_output/tsv_output_adapter.py +0 -0
  31. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/cli_helpers/tabular_output/vertical_table_adapter.py +0 -0
  32. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/cli_helpers.egg-info/SOURCES.txt +0 -0
  33. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/cli_helpers.egg-info/dependency_links.txt +0 -0
  34. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/cli_helpers.egg-info/top_level.txt +0 -0
  35. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/docs/Makefile +0 -0
  36. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/docs/source/api.rst +0 -0
  37. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/docs/source/authors.rst +0 -0
  38. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/docs/source/changelog.rst +0 -0
  39. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/docs/source/conf.py +0 -0
  40. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/docs/source/contributing.rst +0 -0
  41. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/docs/source/index.rst +0 -0
  42. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/docs/source/license.rst +0 -0
  43. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/docs/source/quickstart.rst +0 -0
  44. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/release.py +0 -0
  45. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/setup.cfg +0 -0
  46. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/tasks.py +0 -0
  47. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/tests/__init__.py +0 -0
  48. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/tests/compat.py +0 -0
  49. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/tests/config_data/configrc +0 -0
  50. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/tests/config_data/configspecrc +0 -0
  51. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/tests/config_data/invalid_configrc +0 -0
  52. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/tests/config_data/invalid_configspecrc +0 -0
  53. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/tests/tabular_output/__init__.py +0 -0
  54. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/tests/tabular_output/test_delimited_output_adapter.py +0 -0
  55. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/tests/tabular_output/test_json_output_adapter.py +0 -0
  56. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/tests/tabular_output/test_output_formatter.py +0 -0
  57. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/tests/tabular_output/test_preprocessors.py +0 -0
  58. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/tests/tabular_output/test_tabulate_adapter.py +0 -0
  59. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/tests/tabular_output/test_tsv_output_adapter.py +0 -0
  60. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/tests/tabular_output/test_vertical_table_adapter.py +0 -0
  61. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/tests/test_cli_helpers.py +0 -0
  62. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/tests/test_config.py +0 -0
  63. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/tests/utils.py +0 -0
  64. {cli_helpers-2.11.0 → cli_helpers-2.13.0}/tox.ini +0 -0
@@ -1,15 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## Version 2.13.0
4
+
5
+ (released on 2026-04-13)
6
+
7
+ - Pin Pygments library to older version v2.19.2 to fix tests.
8
+ - Fix dates in changelog.
9
+
10
+ ## Version 2.12.0
11
+
12
+ (released on 2026-03-21)
13
+
14
+ - Probe tabulate version for `preserve_whitespace` keyword support.
15
+
3
16
  ## Version 2.11.0
4
17
 
5
- (released on 2025-03-05)
18
+ (released on 2026-03-05)
6
19
 
7
20
  - Support and require version 0.10.x of `tabulate`.
8
21
  - Pin `tabulate` version more tightly.
9
22
 
10
23
  ## Version 2.10.1
11
24
 
12
- (released on 2025-02-18)
25
+ (released on 2026-02-18)
13
26
 
14
27
  - Update license dates.
15
28
  - Change `master` branch references to `main`.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cli_helpers
3
- Version: 2.11.0
3
+ Version: 2.13.0
4
4
  Summary: Helpers for building command-line apps
5
5
  Home-page: https://github.com/dbcli/cli_helpers
6
6
  Author: dbcli
@@ -22,7 +22,7 @@ License-File: AUTHORS
22
22
  Requires-Dist: configobj>=5.0.5
23
23
  Requires-Dist: tabulate[widechars]~=0.10.0
24
24
  Provides-Extra: styles
25
- Requires-Dist: Pygments>=1.6; extra == "styles"
25
+ Requires-Dist: Pygments~=2.19.2; extra == "styles"
26
26
  Dynamic: author
27
27
  Dynamic: author-email
28
28
  Dynamic: classifier
@@ -0,0 +1 @@
1
+ __version__ = "2.13.0"
@@ -5,7 +5,7 @@ from __future__ import unicode_literals
5
5
 
6
6
  import os
7
7
 
8
- from cli_helpers.utils import filter_dict_by_key
8
+ from cli_helpers.utils import filter_dict_by_key, version_as_tuple
9
9
  from cli_helpers.compat import (
10
10
  Terminal256Formatter,
11
11
  TerminalTrueColorFormatter,
@@ -141,6 +141,10 @@ default_kwargs = {
141
141
  headless_formats = ("minimal",)
142
142
 
143
143
 
144
+ def has_new_preserve_whitespace_arg():
145
+ return version_as_tuple(tabulate.__version__) >= (0, 10, 0)
146
+
147
+
144
148
  def get_preprocessors(format_name):
145
149
  common_formatters = (
146
150
  override_missing_value,
@@ -249,7 +253,10 @@ def adapter(data, headers, table_format=None, preserve_whitespace=False, **kwarg
249
253
  if table_format in supported_markup_formats:
250
254
  tkwargs.update(numalign=None, stralign=None)
251
255
 
252
- tkwargs.update(preserve_whitespace=preserve_whitespace)
256
+ if has_new_preserve_whitespace_arg():
257
+ tkwargs.update(preserve_whitespace=preserve_whitespace)
258
+ else:
259
+ tabulate.PRESERVE_WHITESPACE = preserve_whitespace
253
260
 
254
261
  tkwargs.update(default_kwargs.get(table_format, {}))
255
262
  if table_format in headless_formats:
@@ -5,7 +5,7 @@ import binascii
5
5
  import os
6
6
  import re
7
7
  from functools import lru_cache
8
- from typing import Dict, Union
8
+ from typing import Dict, Tuple, Union
9
9
 
10
10
  from typing import TYPE_CHECKING
11
11
 
@@ -146,3 +146,15 @@ def filter_style_table(style: "StyleMeta", *relevant_styles: str) -> Dict:
146
146
  _styles_iter = ((key, val) for key, val in getattr(style, "styles", {}).items())
147
147
  _relevant_styles_iter = filter(lambda tpl: tpl[0] in relevant_styles, _styles_iter)
148
148
  return {key: val for key, val in _relevant_styles_iter}
149
+
150
+
151
+ @lru_cache()
152
+ def version_as_tuple(version: str) -> Tuple:
153
+ try:
154
+ list_s = [re.sub(r'(rc|alpha|beta|test|dev|post).*$', '', x) for x in version.split('.')]
155
+ list_s = [re.sub(r'[^\d]', '', x) for x in list_s]
156
+ list_i = [int(x) for x in list_s if x]
157
+ list_i.extend([0, 0, 0])
158
+ return tuple(list_i[:3])
159
+ except ValueError:
160
+ return (0, 0, 0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cli_helpers
3
- Version: 2.11.0
3
+ Version: 2.13.0
4
4
  Summary: Helpers for building command-line apps
5
5
  Home-page: https://github.com/dbcli/cli_helpers
6
6
  Author: dbcli
@@ -22,7 +22,7 @@ License-File: AUTHORS
22
22
  Requires-Dist: configobj>=5.0.5
23
23
  Requires-Dist: tabulate[widechars]~=0.10.0
24
24
  Provides-Extra: styles
25
- Requires-Dist: Pygments>=1.6; extra == "styles"
25
+ Requires-Dist: Pygments~=2.19.2; extra == "styles"
26
26
  Dynamic: author
27
27
  Dynamic: author-email
28
28
  Dynamic: classifier
@@ -2,4 +2,4 @@ configobj>=5.0.5
2
2
  tabulate[widechars]~=0.10.0
3
3
 
4
4
  [styles]
5
- Pygments>=1.6
5
+ Pygments~=2.19.2
@@ -2,7 +2,7 @@ autopep8==1.3.3
2
2
  codecov==2.1.13
3
3
  coverage==4.3.4
4
4
  black>=20.8b1
5
- Pygments>=2.4.0
5
+ Pygments~=2.19.2
6
6
  pytest==7.4.3
7
7
  pytest-cov==2.4.0
8
8
  Sphinx==1.5.5
@@ -40,7 +40,7 @@ setup(
40
40
  "tabulate[widechars] ~= 0.10.0",
41
41
  ],
42
42
  extras_require={
43
- "styles": ["Pygments >= 1.6"],
43
+ "styles": ["Pygments ~= 2.19.2"],
44
44
  },
45
45
  python_requires=">=3.6",
46
46
  classifiers=[
@@ -75,3 +75,28 @@ def test_filter_dict_by_key():
75
75
  fd = utils.filter_dict_by_key(d, keys)
76
76
  assert len(fd) == 1
77
77
  assert all([k in keys for k in fd])
78
+
79
+
80
+ def test_version_as_tuple_01():
81
+ """Test version_as_tuple() in the usual case."""
82
+ assert utils.version_as_tuple('0.10.0') == (0, 10, 0)
83
+
84
+
85
+ def test_version_as_tuple_02():
86
+ """Test version_as_tuple() with leading v."""
87
+ assert utils.version_as_tuple('v0.10.0') == (0, 10, 0)
88
+
89
+
90
+ def test_version_as_tuple_03():
91
+ """Test version_as_tuple() trailing padding."""
92
+ assert utils.version_as_tuple('0.10') == (0, 10, 0)
93
+
94
+
95
+ def test_version_as_tuple_04():
96
+ """Test version_as_tuple() stripping rc suffixes."""
97
+ assert utils.version_as_tuple('0.10.0rc1') == (0, 10, 0)
98
+
99
+
100
+ def test_version_as_tuple_05():
101
+ """Test version_as_tuple() deleting post1 elements."""
102
+ assert utils.version_as_tuple('0.10.0.post1') == (0, 10, 0)
@@ -1 +0,0 @@
1
- __version__ = "2.11.0"
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