Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-rich-argparse for
openSUSE:Factory checked in at 2026-06-15 19:40:37
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-rich-argparse (Old)
and /work/SRC/openSUSE:Factory/.python-rich-argparse.new.1981 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-rich-argparse"
Mon Jun 15 19:40:37 2026 rev:4 rq:1359312 version:1.8.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-rich-argparse/python-rich-argparse.changes
2026-02-21 21:00:44.353885684 +0100
+++
/work/SRC/openSUSE:Factory/.python-rich-argparse.new.1981/python-rich-argparse.changes
2026-06-15 19:42:10.300215514 +0200
@@ -1,0 +2,12 @@
+Sun Jun 14 20:12:49 UTC 2026 - Dirk Müller <[email protected]>
+
+- update to 1.8.0:
+ * Python 3.8 is no longer supported (EOL since 7/10/2024)
+ * Add support for PyPy 3.11
+ * Add `ExtendedParagraphRichHelpFormatter` to
+ `rich_argparse.contrib`. This is similar to
+ `ParagraphRichHelpFormatter` but with better support for
+ paragraph spacing.
+- drop fix-tests.patch, py3141.patch: upstream
+
+-------------------------------------------------------------------
Old:
----
fix-tests.patch
py3141.patch
rich_argparse-1.7.2.tar.gz
New:
----
rich_argparse-1.8.0.tar.gz
----------(Old B)----------
Old: paragraph spacing.
- drop fix-tests.patch, py3141.patch: upstream
Old: paragraph spacing.
- drop fix-tests.patch, py3141.patch: upstream
----------(Old E)----------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-rich-argparse.spec ++++++
--- /var/tmp/diff_new_pack.Bh66oH/_old 2026-06-15 19:42:10.852238646 +0200
+++ /var/tmp/diff_new_pack.Bh66oH/_new 2026-06-15 19:42:10.856238813 +0200
@@ -17,16 +17,12 @@
Name: python-rich-argparse
-Version: 1.7.2
+Version: 1.8.0
Release: 0
Summary: Rich help formatters for argparse and optparse
License: MIT
URL: https://github.com/hamdanal/rich-argparse
Source:
https://files.pythonhosted.org/packages/source/r/rich-argparse/rich_argparse-%{version}.tar.gz
-# PATCH-FIX-UPSTREAM fix-tests.patch
https://github.com/hamdanal/rich-argparse/pull/178
-Patch0: fix-tests.patch
-# PATCH-FIX-UPSTREAM py3141.patch
https://github.com/hamdanal/rich-argparse/pull/172
-Patch1: py3141.patch
BuildRequires: %{python_module hatchling >= 1.11.0}
BuildRequires: %{python_module pip}
BuildRequires: python-rpm-macros
++++++ rich_argparse-1.7.2.tar.gz -> rich_argparse-1.8.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/rich_argparse-1.7.2/CHANGELOG.md
new/rich_argparse-1.8.0/CHANGELOG.md
--- old/rich_argparse-1.7.2/CHANGELOG.md 2020-02-02 01:00:00.000000000
+0100
+++ new/rich_argparse-1.8.0/CHANGELOG.md 2020-02-02 01:00:00.000000000
+0100
@@ -1,5 +1,21 @@
# Change Log
+## Unreleased
+
+## 1.8.0 - 2026-05-01
+
+### Features
+- [GH-155](https://github.com/hamdanal/rich-argparse/issues/155),
+ [PR-160](https://github.com/hamdanal/rich-argparse/pull/160)
+ Python 3.8 is no longer supported (EOL since 7/10/2024)
+- [GH-164](https://github.com/hamdanal/rich-argparse/issues/164),
+ [PR-165](https://github.com/hamdanal/rich-argparse/pull/165)
+ Add support for PyPy 3.11
+- [GH-180](https://github.com/hamdanal/rich-argparse/issues/180),
+ [PR-182](https://github.com/hamdanal/rich-argparse/pull/182)
+ Add `ExtendedParagraphRichHelpFormatter` to `rich_argparse.contrib`. This is
similar to
+ `ParagraphRichHelpFormatter` but with better support for paragraph spacing.
+
## 1.7.2 - 2025-11-01
### Fixes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/rich_argparse-1.7.2/CONTRIBUTING.md
new/rich_argparse-1.8.0/CONTRIBUTING.md
--- old/rich_argparse-1.7.2/CONTRIBUTING.md 2020-02-02 01:00:00.000000000
+0100
+++ new/rich_argparse-1.8.0/CONTRIBUTING.md 2020-02-02 01:00:00.000000000
+0100
@@ -11,7 +11,7 @@
## Getting started
-*python* version 3.8 or higher is required for development.
+*python* version 3.9 or higher is required for development.
1. Fork the repository on GitHub.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/rich_argparse-1.7.2/PKG-INFO
new/rich_argparse-1.8.0/PKG-INFO
--- old/rich_argparse-1.7.2/PKG-INFO 2020-02-02 01:00:00.000000000 +0100
+++ new/rich_argparse-1.8.0/PKG-INFO 2020-02-02 01:00:00.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.4
Name: rich-argparse
-Version: 1.7.2
+Version: 1.8.0
Summary: Rich help formatters for argparse and optparse
Project-URL: Homepage, https://github.com/hamdanal/rich-argparse
Project-URL: Documentation,
https://github.com/hamdanal/rich-argparse#rich-argparse
@@ -13,9 +13,7 @@
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
@@ -23,7 +21,7 @@
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: User Interfaces
-Requires-Python: >=3.8
+Requires-Python: >=3.9
Requires-Dist: rich>=11.0.0
Description-Content-Type: text/markdown
@@ -281,8 +279,12 @@
breaks. A paragraph break is defined as two consecutive newlines (`\n\n`) in
the help or
description text. Leading and trailing trailing whitespace are stripped
similar to
`RichHelpFormatter`.
+* `ExtendedParagraphRichHelpFormatter`: A formatter that preserves paragraph
breaks similar to
+ `ParagraphRichHelpFormatter` but with control over paragraph spacing. A
paragraph break with
+ spacing is defined as three consecutive newlines (`\n\n\n`) and a paragraph
break without spacing
+ is defined as two consecutive newlines (`\n\n`).
-_More formatters will be added in the future._
+_Your use case is not covered by the existing formatters? Please open an issue
on GitHub!_
## Django support
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/rich_argparse-1.7.2/README.md
new/rich_argparse-1.8.0/README.md
--- old/rich_argparse-1.7.2/README.md 2020-02-02 01:00:00.000000000 +0100
+++ new/rich_argparse-1.8.0/README.md 2020-02-02 01:00:00.000000000 +0100
@@ -252,8 +252,12 @@
breaks. A paragraph break is defined as two consecutive newlines (`\n\n`) in
the help or
description text. Leading and trailing trailing whitespace are stripped
similar to
`RichHelpFormatter`.
+* `ExtendedParagraphRichHelpFormatter`: A formatter that preserves paragraph
breaks similar to
+ `ParagraphRichHelpFormatter` but with control over paragraph spacing. A
paragraph break with
+ spacing is defined as three consecutive newlines (`\n\n\n`) and a paragraph
break without spacing
+ is defined as two consecutive newlines (`\n\n`).
-_More formatters will be added in the future._
+_Your use case is not covered by the existing formatters? Please open an issue
on GitHub!_
## Django support
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/rich_argparse-1.7.2/pyproject.toml
new/rich_argparse-1.8.0/pyproject.toml
--- old/rich_argparse-1.7.2/pyproject.toml 2020-02-02 01:00:00.000000000
+0100
+++ new/rich_argparse-1.8.0/pyproject.toml 2020-02-02 01:00:00.000000000
+0100
@@ -4,7 +4,7 @@
[project]
name = "rich-argparse"
-version = "1.7.2"
+version = "1.8.0"
description = "Rich help formatters for argparse and optparse"
authors = [
{name="Ali Hamdan", email="[email protected]"},
@@ -15,9 +15,7 @@
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
- "License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
- "Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
@@ -30,7 +28,7 @@
dependencies = [
"rich >= 11.0.0",
]
-requires-python = ">=3.8"
+requires-python = ">=3.9"
[project.urls]
Homepage = "https://github.com/hamdanal/rich-argparse"
@@ -65,9 +63,10 @@
flake8-tidy-imports.ban-relative-imports = "all"
[tool.mypy]
-python_version = "3.8"
+python_version = "3.9"
strict = true
local_partial_types = true
+allow_redefinition_new = true
[[tool.mypy.overrides]]
module = ["tests.*"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/rich_argparse-1.7.2/rich_argparse/_argparse.py
new/rich_argparse-1.8.0/rich_argparse/_argparse.py
--- old/rich_argparse-1.7.2/rich_argparse/_argparse.py 2020-02-02
01:00:00.000000000 +0100
+++ new/rich_argparse-1.8.0/rich_argparse/_argparse.py 2020-02-02
01:00:00.000000000 +0100
@@ -117,9 +117,9 @@
if sys.version_info >= (3, 14): # pragma: >=3.14 cover
- def _set_color(self, color: bool) -> None:
+ def _set_color(self, color: bool, *args, **kwargs) -> None:
# Override to disable color setting in argparse.HelpFormatter for
Python 3.14+
- return super()._set_color(False)
+ return super()._set_color(False, *args, **kwargs)
class _Section(argparse.HelpFormatter._Section):
def __init__(
@@ -299,16 +299,13 @@
return _start, _end
for action in options: # start with the options
- if sys.version_info >= (3, 9): # pragma: >=3.9 cover
- usage = action.format_usage()
- if isinstance(action, argparse.BooleanOptionalAction):
- for option_string in action.option_strings:
- start, end = find_span(option_string)
- yield r.Span(start, end, "argparse.args")
- pos = end + 1
- continue
- else: # pragma: <3.9 cover
- usage = action.option_strings[0]
+ usage = action.format_usage()
+ if isinstance(action, argparse.BooleanOptionalAction):
+ for option_string in action.option_strings:
+ start, end = find_span(option_string)
+ yield r.Span(start, end, "argparse.args")
+ pos = end + 1
+ continue
start, end = find_span(usage)
yield r.Span(start, end, "argparse.args")
pos = end + 1
@@ -345,7 +342,7 @@
("]", False),
)
elif action.nargs == argparse.ZERO_OR_MORE:
- if sys.version_info < (3, 9) or len(get_metavar(1)) == 2: #
pragma: <3.9 cover
+ if len(get_metavar(1)) == 2:
metavar = get_metavar(2)
# '[%s [%s ...]]' % metavar
yield from (
@@ -357,7 +354,7 @@
("...", True),
("]]", False),
)
- else: # pragma: >=3.9 cover
+ else:
# '[%s ...]' % metavar
yield from (
("[", False),
@@ -467,7 +464,7 @@
for m in
re.finditer(rf"\[([^\]]*{printf_pat}[^\]]*)\]", help_string, re.X)
if m.group("mapping") == "default"
),
- "default: %(default)s", # pragma: >=3.9 cover # fails on
Python 3.8!
+ "default: %(default)s",
)
msg = (
f"Failed to process default value in help string of
argument {action_id!r}."
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/rich_argparse-1.7.2/rich_argparse/_contrib.py
new/rich_argparse-1.8.0/rich_argparse/_contrib.py
--- old/rich_argparse-1.7.2/rich_argparse/_contrib.py 2020-02-02
01:00:00.000000000 +0100
+++ new/rich_argparse-1.8.0/rich_argparse/_contrib.py 2020-02-02
01:00:00.000000000 +0100
@@ -10,7 +10,7 @@
class ParagraphRichHelpFormatter(RichHelpFormatter):
- """Rich help message formatter which retains paragraph separation."""
+ """Rich help message formatter which retains paragraph separation with
spacing using `\\n\\n`."""
def _rich_split_lines(self, text: r.Text, width: int) -> r.Lines:
text = rich_strip(text)
@@ -25,6 +25,32 @@
# Add a blank line between paragraphs
lines.append(r.Text("\n"))
if lines: # pragma: no cover
+ lines.pop() # Remove trailing newline
+ return lines
+
+ def _rich_fill_text(self, text: r.Text, width: int, indent: r.Text) ->
r.Text:
+ lines = self._rich_split_lines(text, width)
+ return r.Text("\n").join(indent + line for line in lines) + "\n"
+
+
+class ExtendedParagraphRichHelpFormatter(RichHelpFormatter):
+ """Rich help message formatter which retains paragraph separation without
spacing using `\\n\\n` and
+ paragraph spacing using `\\n\\n\\n`."""
+
+ def _rich_split_lines(self, text: r.Text, width: int) -> r.Lines:
+ text = rich_strip(text)
+ lines = r.Lines()
+ for paragraph in text.split("\n\n\n"):
+ for subparagraph in paragraph.split("\n\n"):
+ # Normalize whitespace in the subparagraph
+ subparagraph = self._rich_whitespace_sub(subparagraph)
+ # Wrap the subparagraph to the specified width
+ paragraph_lines = rich_wrap(self.console, subparagraph, width)
+ # Add the wrapped lines to the output
+ lines.extend(paragraph_lines)
+ # Add a blank line between paragraphs
+ lines.append(r.Text("\n"))
+ if lines: # pragma: no cover
lines.pop() # Remove trailing newline
return lines
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/rich_argparse-1.7.2/rich_argparse/contrib.py
new/rich_argparse-1.8.0/rich_argparse/contrib.py
--- old/rich_argparse-1.7.2/rich_argparse/contrib.py 2020-02-02
01:00:00.000000000 +0100
+++ new/rich_argparse-1.8.0/rich_argparse/contrib.py 2020-02-02
01:00:00.000000000 +0100
@@ -9,8 +9,9 @@
from __future__ import annotations
-from rich_argparse._contrib import ParagraphRichHelpFormatter
+from rich_argparse._contrib import ExtendedParagraphRichHelpFormatter,
ParagraphRichHelpFormatter
__all__ = [
+ "ExtendedParagraphRichHelpFormatter",
"ParagraphRichHelpFormatter",
]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/rich_argparse-1.7.2/tests/test_argparse.py
new/rich_argparse-1.8.0/tests/test_argparse.py
--- old/rich_argparse-1.7.2/tests/test_argparse.py 2020-02-02
01:00:00.000000000 +0100
+++ new/rich_argparse-1.8.0/tests/test_argparse.py 2020-02-02
01:00:00.000000000 +0100
@@ -362,18 +362,12 @@
mut_ex.add_argument("--opt", nargs="?")
mut_ex.add_argument("--opts", nargs="+")
- # https://github.com/python/cpython/issues/82619
- if sys.version_info < (3, 9): # pragma: <3.9 cover
- zom_metavar = "[\x1b[36mzom\x1b[0m [\x1b[36mzom\x1b[0m
\x1b[36m...\x1b[0m]]"
- else: # pragma: >=3.9 cover
- zom_metavar = "[\x1b[36mzom\x1b[0m \x1b[36m...\x1b[0m]"
-
usage_text = (
- f"\x1b[38;5;208mUsage:\x1b[0m \x1b[38;5;244mPROG\x1b[0m
[\x1b[36m-h\x1b[0m] "
- f"[\x1b[36m--opt\x1b[0m [\x1b[38;5;36mOPT\x1b[0m] | "
- f"\x1b[36m--opts\x1b[0m \x1b[38;5;36mOPTS\x1b[0m
[\x1b[38;5;36mOPTS\x1b[0m \x1b[38;5;36m...\x1b[0m]]\n "
- f"\x1b[36mrequired\x1b[0m \x1b[36mint\x1b[0m \x1b[36mint\x1b[0m
[\x1b[36moptional\x1b[0m] "
- f"{zom_metavar} \x1b[36moom\x1b[0m [\x1b[36moom\x1b[0m
\x1b[36m...\x1b[0m] \x1b[36m...\x1b[0m \x1b[36mparser\x1b[0m \x1b[36m...\x1b[0m"
+ "\x1b[38;5;208mUsage:\x1b[0m \x1b[38;5;244mPROG\x1b[0m
[\x1b[36m-h\x1b[0m] "
+ "[\x1b[36m--opt\x1b[0m [\x1b[38;5;36mOPT\x1b[0m] | "
+ "\x1b[36m--opts\x1b[0m \x1b[38;5;36mOPTS\x1b[0m
[\x1b[38;5;36mOPTS\x1b[0m \x1b[38;5;36m...\x1b[0m]]\n "
+ "\x1b[36mrequired\x1b[0m \x1b[36mint\x1b[0m \x1b[36mint\x1b[0m
[\x1b[36moptional\x1b[0m] "
+ "[\x1b[36mzom\x1b[0m \x1b[36m...\x1b[0m] \x1b[36moom\x1b[0m
[\x1b[36moom\x1b[0m \x1b[36m...\x1b[0m] \x1b[36m...\x1b[0m
\x1b[36mparser\x1b[0m \x1b[36m...\x1b[0m"
)
expected_help_output = f"""\
{usage_text}
@@ -396,9 +390,8 @@
assert parser.format_help() == clean_argparse(expected_help_output)
[email protected](sys.version_info < (3, 9), reason="not available in 3.8")
@pytest.mark.usefixtures("force_color")
-def test_boolean_optional_action_spans(): # pragma: >=3.9 cover
+def test_boolean_optional_action_spans():
parser = ArgumentParser("PROG", formatter_class=RichHelpFormatter)
parser.add_argument("--bool", action=argparse.BooleanOptionalAction)
expected_help_output = """\
@@ -418,6 +411,8 @@
groups = [parser._optionals]
formatter = RichHelpFormatter("PROG")
+ if sys.version_info >= (3, 14): # pragma: >=3.14 cover
+ formatter._set_color(False)
with patch.object(RichHelpFormatter, "_rich_usage_spans",
side_effect=ValueError):
formatter.add_usage(usage=None, actions=actions, groups=groups,
prefix=None)
(usage,) = formatter._root_section.rich_items
@@ -722,12 +717,20 @@
)
if sys.version_info < (3, 14): # pragma: <3.14 cover
assert orig_child2.format_usage() == "usage: PROG sp2 [-h]\n"
- else: # pragma: >=3.14 cover
- # Python 3.14 adds ANSI color codes to the default usage message
+ elif sys.version_info[:3] == (3, 14, 0): # pragma: no cover
+ # Subparsers prog broken in Python 3.14.0
+ # TODO: remove when Python 3.14.1 becomes available on GitHub Actions
assert (
orig_child2.format_usage()
== "\x1b[1;34musage:
\x1b[0m\x1b[1;35m\x1b[1;34m\x1b[0m\x1b[1;35mPROG\x1b[0m sp2\x1b[0m
[\x1b[32m-h\x1b[0m]\n"
)
+ else: # pragma: >=3.15 cover
+ # Python 3.14 adds ANSI color codes to the default usage message
+ # TODO: change to 'pragma: >=3.14 cover' when Python 3.14.1 becomes
available on GitHub Actions
+ assert (
+ orig_child2.format_usage()
+ == "\x1b[1;34musage: \x1b[0m\x1b[1;35mPROG sp2\x1b[0m
[\x1b[32m-h\x1b[0m]\n"
+ )
@pytest.mark.parametrize("ct", string.printable)
@@ -737,8 +740,8 @@
action = Action(["-t"], dest="test", help=f"%(prog){ct}")
try:
expected = help_formatter._expand_help(action)
- except ValueError as e:
- with pytest.raises(ValueError) as exc_info:
+ except (ValueError, TypeError) as e:
+ with pytest.raises(type(e)) as exc_info:
help_formatter._rich_expand_help(action)
assert exc_info.value.args == e.args
else:
@@ -752,8 +755,9 @@
if mod_name != "rich" and not mod_name.startswith("rich.")
}
lazy_rich = {k: v for k, v in r.__dict__.items() if k not in r.__all__}
- with patch.dict(sys.modules, sys_modules_no_rich, clear=True), patch.dict(
- r.__dict__, lazy_rich, clear=True
+ with (
+ patch.dict(sys.modules, sys_modules_no_rich, clear=True),
+ patch.dict(r.__dict__, lazy_rich, clear=True),
):
parser = ArgumentParser(formatter_class=RichHelpFormatter)
parser.add_argument("--foo", help="foo help")
@@ -829,8 +833,9 @@
# Legacy windows console on new windows => colors: YES, initialization: YES
init_win_colors = Mock(return_value=True)
parser = ArgumentParser("PROG", formatter_class=RichHelpFormatter)
- with patch("rich.console.detect_legacy_windows", return_value=True), patch(
- "rich_argparse._common._initialize_win_colors", init_win_colors
+ with (
+ patch("rich.console.detect_legacy_windows", return_value=True),
+ patch("rich_argparse._common._initialize_win_colors", init_win_colors),
):
help = parser.format_help()
assert help == clean_argparse(expected_colored_output)
@@ -839,8 +844,9 @@
# Legacy windows console on old windows => colors: NO, initialization: YES
init_win_colors = Mock(return_value=False)
parser = ArgumentParser("PROG", formatter_class=RichHelpFormatter)
- with patch("rich.console.detect_legacy_windows", return_value=True), patch(
- "rich_argparse._common._initialize_win_colors", init_win_colors
+ with (
+ patch("rich.console.detect_legacy_windows", return_value=True),
+ patch("rich_argparse._common._initialize_win_colors", init_win_colors),
):
help = parser.format_help()
assert help == clean_argparse(expected_output)
@@ -854,8 +860,9 @@
init_win_colors = Mock(return_value=True)
no_colors_parser = ArgumentParser("PROG", formatter_class=fmt_no_color)
- with patch("rich.console.detect_legacy_windows", return_value=True), patch(
- "rich_argparse._common._initialize_win_colors", init_win_colors
+ with (
+ patch("rich.console.detect_legacy_windows", return_value=True),
+ patch("rich_argparse._common._initialize_win_colors", init_win_colors),
):
help = no_colors_parser.format_help()
assert help == clean_argparse(expected_output)
@@ -899,11 +906,11 @@
This is a \x1b[1mdescription\x1b[0m
-
\x1b[33m──────────────────────────────────────────────────────────────────────────────────────────────────\x1b[0m
+
\x1b[2m--------------------------------------------------------------------------------------------------\x1b[0m
- \x1b[1m \x1b[0m\x1b[1mfoo\x1b[0m\x1b[1m \x1b[0m \x1b[1m
\x1b[0m\x1b[1mbar\x1b[0m
- ━━━━━━━━━━━
- 1 2
+ \x1b[36m \x1b[0m\x1b[36mfoo\x1b[0m\x1b[1m \x1b[0m\x1b[36m
\x1b[0m\x1b[36mbar\x1b[0m
+ \x1b[36m ────────\x1b[0m
+ \x1b[36m \x1b[0m1 \x1b[36m \x1b[0m2
\x1b[38;5;208mOptional Arguments:\x1b[0m
\x1b[36m-h\x1b[0m, \x1b[36m--help\x1b[0m \x1b[39mshow this help message
and exit\x1b[0m
@@ -1087,10 +1094,6 @@
meg.add_argument("--op7", metavar=("MET1", "MET2", "MET3"), nargs=3)
help_text = parser.format_help()
- op3_metavar = "[\x1b[38;5;36mOP3\x1b[0m \x1b[38;5;36m...\x1b[0m]"
- if sys.version_info < (3, 9): # pragma: <3.9 cover
- op3_metavar = f"[\x1b[38;5;36mOP3\x1b[0m {op3_metavar}]"
-
if sys.version_info >= (3, 13): # pragma: >=3.13 cover
usage_tail = """ |
\x1b[36m--op2\x1b[0m [\x1b[38;5;36mMET1\x1b[0m
[\x1b[38;5;36mMET2\x1b[0m \x1b[38;5;36m...\x1b[0m]] |
@@ -1101,11 +1104,11 @@
\x1b[36m--op7\x1b[0m \x1b[38;5;36mMET1\x1b[0m
\x1b[38;5;36mMET2\x1b[0m \x1b[38;5;36mMET3\x1b[0m]
"""
else: # pragma: <3.13 cover
- usage_tail = f"""
+ usage_tail = """
| \x1b[36m--op2\x1b[0m
[\x1b[38;5;36mMET1\x1b[0m [\x1b[38;5;36mMET2\x1b[0m
\x1b[38;5;36m...\x1b[0m]]
| \x1b[36m--op3\x1b[0m
- {op3_metavar}
+ [\x1b[38;5;36mOP3\x1b[0m \x1b[38;5;36m...\x1b[0m]
| \x1b[36m--op4\x1b[0m
\x1b[38;5;36mMET1\x1b[0m
[\x1b[38;5;36mMET2\x1b[0m \x1b[38;5;36m...\x1b[0m]
@@ -1129,7 +1132,7 @@
\x1b[39mmessage and exit\x1b[0m
\x1b[36m--op1\x1b[0m [\x1b[38;5;36mMET\x1b[0m]
\x1b[36m--op2\x1b[0m [\x1b[38;5;36mMET1\x1b[0m [\x1b[38;5;36mMET2\x1b[0m
\x1b[38;5;36m...\x1b[0m]]
- \x1b[36m--op3\x1b[0m {op3_metavar}
+ \x1b[36m--op3\x1b[0m [\x1b[38;5;36mOP3\x1b[0m \x1b[38;5;36m...\x1b[0m]
\x1b[36m--op4\x1b[0m \x1b[38;5;36mMET1\x1b[0m [\x1b[38;5;36mMET2\x1b[0m
\x1b[38;5;36m...\x1b[0m]
\x1b[36m--op5\x1b[0m \x1b[38;5;36mOP5\x1b[0m [\x1b[38;5;36mOP5\x1b[0m
\x1b[38;5;36m...\x1b[0m]
\x1b[36m--op6\x1b[0m \x1b[38;5;36mOP6\x1b[0m \x1b[38;5;36mOP6\x1b[0m
\x1b[38;5;36mOP6\x1b[0m
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/rich_argparse-1.7.2/tests/test_contrib.py
new/rich_argparse-1.8.0/tests/test_contrib.py
--- old/rich_argparse-1.7.2/tests/test_contrib.py 2020-02-02
01:00:00.000000000 +0100
+++ new/rich_argparse-1.8.0/tests/test_contrib.py 2020-02-02
01:00:00.000000000 +0100
@@ -2,7 +2,7 @@
from argparse import ArgumentParser
-from rich_argparse.contrib import ParagraphRichHelpFormatter
+from rich_argparse.contrib import ExtendedParagraphRichHelpFormatter,
ParagraphRichHelpFormatter
from tests.helpers import clean_argparse
@@ -51,3 +51,44 @@
quick brown fox jumps over the lazy dog.
"""
assert parser.format_help() == clean_argparse(expected_help_output)
+
+
+def test_extended_paragraph_rich_help_formatter():
+ text = "\n\n\r\n\t The quick brown fox jumps over the lazy dog.\n\n\n-
Brown fox\n\n- Lazy dog\n\n\r\n\t "
+ parser = ArgumentParser(
+ prog="PROG",
+ description=text,
+ epilog=text,
+ formatter_class=ExtendedParagraphRichHelpFormatter,
+ )
+ group = parser.add_argument_group("group", description=text)
+ group.add_argument("--long", help=text)
+
+ expected_help_output = """\
+ Usage: PROG [-h] [--long LONG]
+
+ The quick brown fox jumps over the lazy dog.
+
+ - Brown fox
+ - Lazy dog
+
+ Optional Arguments:
+ -h, --help show this help message and exit
+
+ Group:
+ The quick brown fox jumps over the lazy dog.
+
+ - Brown fox
+ - Lazy dog
+
+ --long LONG The quick brown fox jumps over the lazy dog.
+
+ - Brown fox
+ - Lazy dog
+
+ The quick brown fox jumps over the lazy dog.
+
+ - Brown fox
+ - Lazy dog
+ """
+ assert parser.format_help() == clean_argparse(expected_help_output)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/rich_argparse-1.7.2/tests/test_optparse.py
new/rich_argparse-1.8.0/tests/test_optparse.py
--- old/rich_argparse-1.7.2/tests/test_optparse.py 2020-02-02
01:00:00.000000000 +0100
+++ new/rich_argparse-1.8.0/tests/test_optparse.py 2020-02-02
01:00:00.000000000 +0100
@@ -301,8 +301,9 @@
if mod_name != "rich" and not mod_name.startswith("rich.")
}
lazy_rich = {k: v for k, v in r.__dict__.items() if k not in r.__all__}
- with patch.dict(sys.modules, sys_modules_no_rich, clear=True), patch.dict(
- r.__dict__, lazy_rich, clear=True
+ with (
+ patch.dict(sys.modules, sys_modules_no_rich, clear=True),
+ patch.dict(r.__dict__, lazy_rich, clear=True),
):
parser = OptionParser(formatter=IndentedRichHelpFormatter())
parser.add_option("--foo", help="foo help")
@@ -353,8 +354,9 @@
init_win_colors = Mock(return_value=not old_windows)
parser = OptionParser(prog="PROG", formatter=IndentedRichHelpFormatter())
- with patch("rich.console.detect_legacy_windows",
return_value=legacy_console), patch(
- "rich_argparse._common._initialize_win_colors", init_win_colors
+ with (
+ patch("rich.console.detect_legacy_windows",
return_value=legacy_console),
+ patch("rich_argparse._common._initialize_win_colors", init_win_colors),
):
assert parser.format_help() == dedent(expected_output)
if legacy_console: