rich-click 1.9.0.dev2__tar.gz → 1.9.0.dev4__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 (44) hide show
  1. {rich_click-1.9.0.dev2/src/rich_click.egg-info → rich_click-1.9.0.dev4}/PKG-INFO +5 -3
  2. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/README.md +2 -2
  3. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/pyproject.toml +2 -0
  4. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/src/rich_click/__init__.py +1 -1
  5. rich_click-1.9.0.dev4/src/rich_click/_click_types_cache.py +8 -0
  6. rich_click-1.9.0.dev4/src/rich_click/_internal_types.py +250 -0
  7. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/src/rich_click/cli.py +89 -134
  8. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/src/rich_click/decorators.py +17 -1
  9. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/src/rich_click/decorators.pyi +23 -221
  10. rich_click-1.9.0.dev4/src/rich_click/patch.py +281 -0
  11. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/src/rich_click/rich_click.py +14 -5
  12. rich_click-1.9.0.dev4/src/rich_click/rich_click_theme.py +1102 -0
  13. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/src/rich_click/rich_command.py +64 -13
  14. rich_click-1.9.0.dev4/src/rich_click/rich_command.pyi +428 -0
  15. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/src/rich_click/rich_help_configuration.py +125 -48
  16. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/src/rich_click/rich_help_rendering.py +156 -69
  17. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/src/rich_click/rich_panel.py +21 -33
  18. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/src/rich_click/utils.py +1 -1
  19. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4/src/rich_click.egg-info}/PKG-INFO +5 -3
  20. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/src/rich_click.egg-info/SOURCES.txt +7 -2
  21. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/src/rich_click.egg-info/requires.txt +2 -0
  22. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/tests/test_config.py +3 -60
  23. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/tests/test_rich_click_cli.py +28 -29
  24. rich_click-1.9.0.dev4/tests/test_themes.py +37 -0
  25. rich_click-1.9.0.dev4/tests/test_types.py +101 -0
  26. rich_click-1.9.0.dev2/src/rich_click/patch.py +0 -72
  27. rich_click-1.9.0.dev2/src/rich_click/rich_theme.py +0 -817
  28. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/LICENSE +0 -0
  29. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/setup.cfg +0 -0
  30. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/src/rich_click/__main__.py +0 -0
  31. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/src/rich_click/_compat_click.py +0 -0
  32. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/src/rich_click/py.typed +0 -0
  33. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/src/rich_click/rich_box.py +0 -0
  34. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/src/rich_click/rich_context.py +0 -0
  35. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/src/rich_click/rich_group.py +0 -0
  36. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/src/rich_click/rich_help_formatter.py +0 -0
  37. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/src/rich_click/rich_parameter.py +0 -0
  38. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/src/rich_click.egg-info/dependency_links.txt +0 -0
  39. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/src/rich_click.egg-info/entry_points.txt +0 -0
  40. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/src/rich_click.egg-info/top_level.txt +0 -0
  41. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/tests/test_deprecations.py +0 -0
  42. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/tests/test_exit_code.py +0 -0
  43. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/tests/test_misc.py +0 -0
  44. {rich_click-1.9.0.dev2 → rich_click-1.9.0.dev4}/tests/test_no_rich_imports.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rich-click
3
- Version: 1.9.0.dev2
3
+ Version: 1.9.0.dev4
4
4
  Summary: Format click help output nicely with rich
5
5
  Author-email: Phil Ewels <phil@ewels.co.uk>
6
6
  Maintainer-email: Phil Ewels <phil@ewels.co.uk>, Daniel Reeves <xdanielreeves@gmail.com>
@@ -57,6 +57,7 @@ Requires-Dist: pytest>=8.3.5; extra == "dev"
57
57
  Requires-Dist: pytest-cov>=5; extra == "dev"
58
58
  Requires-Dist: rich-codex>=1.2.11; extra == "dev"
59
59
  Requires-Dist: ruff>=0.12.4; extra == "dev"
60
+ Requires-Dist: typer>=0.15; extra == "dev"
60
61
  Requires-Dist: types-setuptools>=75.8.0.20250110; extra == "dev"
61
62
  Provides-Extra: docs
62
63
  Requires-Dist: markdown-include>=0.8.1; extra == "docs"
@@ -70,6 +71,7 @@ Requires-Dist: mkdocs-material-extensions>=1.3.1; extra == "docs"
70
71
  Requires-Dist: mkdocs-rss-plugin>=1.15; extra == "docs"
71
72
  Requires-Dist: mkdocstrings[python]>=0.26.1; extra == "docs"
72
73
  Requires-Dist: rich-codex>=1.2.11; extra == "docs"
74
+ Requires-Dist: typer>=0.15; extra == "docs"
73
75
  Dynamic: license-file
74
76
 
75
77
  <p align="center">
@@ -109,12 +111,12 @@ Click, formatted with Rich, with minimal customization required.
109
111
  - 🌈 Rich command-line formatting of click help and error messages
110
112
  - 😌 Same API as Click: usage is simply `import rich_click as click`
111
113
  - 🎨 Over 100 themes that can be set by developers and end-users (`export RICH_CLICK_THEME=...`)
112
- - 💻 CLI tool to run on _other people's_ tools (prefix the command with `rich-click`)
114
+ - 💻 CLI tool to run on _other people's_ Click and Typer CLIs (prefix the command with `rich-click`)
113
115
  - 📦 Export help text as HTML or SVG
114
116
  - 🎁 Group commands and options into named panels
115
117
  - ❌ Well formatted error messages
116
118
  - 💫 Extensive customization
117
- - 🤖 IDE autocomplete of Click decorators for smooth developer experience.
119
+ - 🤖 IDE autocomplete of Click decorators for smooth developer experience
118
120
 
119
121
  ## Installation
120
122
 
@@ -35,12 +35,12 @@ Click, formatted with Rich, with minimal customization required.
35
35
  - 🌈 Rich command-line formatting of click help and error messages
36
36
  - 😌 Same API as Click: usage is simply `import rich_click as click`
37
37
  - 🎨 Over 100 themes that can be set by developers and end-users (`export RICH_CLICK_THEME=...`)
38
- - 💻 CLI tool to run on _other people's_ tools (prefix the command with `rich-click`)
38
+ - 💻 CLI tool to run on _other people's_ Click and Typer CLIs (prefix the command with `rich-click`)
39
39
  - 📦 Export help text as HTML or SVG
40
40
  - 🎁 Group commands and options into named panels
41
41
  - ❌ Well formatted error messages
42
42
  - 💫 Extensive customization
43
- - 🤖 IDE autocomplete of Click decorators for smooth developer experience.
43
+ - 🤖 IDE autocomplete of Click decorators for smooth developer experience
44
44
 
45
45
  ## Installation
46
46
 
@@ -46,6 +46,7 @@ optional-dependencies.dev = [
46
46
  "pytest-cov>=5",
47
47
  "rich-codex>=1.2.11",
48
48
  "ruff>=0.12.4",
49
+ "typer>=0.15",
49
50
  "types-setuptools>=75.8.0.20250110",
50
51
  ]
51
52
  optional-dependencies.docs = [
@@ -60,6 +61,7 @@ optional-dependencies.docs = [
60
61
  "mkdocs-rss-plugin>=1.15",
61
62
  "mkdocstrings[python]>=0.26.1",
62
63
  "rich-codex>=1.2.11",
64
+ "typer>=0.15",
63
65
  ]
64
66
  urls.Documentation = "https://github.com/ewels/rich-click"
65
67
  urls.Homepage = "https://github.com/ewels/rich-click"
@@ -8,7 +8,7 @@ customization required.
8
8
  from __future__ import annotations
9
9
 
10
10
 
11
- __version__ = "1.9.0.dev2"
11
+ __version__ = "1.9.0.dev4"
12
12
 
13
13
  # Import the entire click API here.
14
14
  # We need to manually import these instead of `from click import *` to force
@@ -0,0 +1,8 @@
1
+ # This file exists to keep around original copies of all the Click types.
2
+ # This is needed for rich_help_rendering, which is lazy-loaded after `rich-click` patching occurs.
3
+ # However, this file needs to be instantiated _before_ patching occurs.
4
+ from click import Argument as Argument
5
+ from click import Command as Command
6
+ from click import CommandCollection as CommandCollection
7
+ from click import Group as Group
8
+ from click import Option as Option
@@ -0,0 +1,250 @@
1
+ """
2
+ Contains types for .pyi files.
3
+ Import from this at your own risk.
4
+ """
5
+
6
+ from __future__ import annotations
7
+
8
+ from typing import (
9
+ TYPE_CHECKING,
10
+ Any,
11
+ Callable,
12
+ Dict,
13
+ Iterable,
14
+ List,
15
+ Literal,
16
+ Mapping,
17
+ MutableMapping,
18
+ Optional,
19
+ Tuple,
20
+ TypedDict,
21
+ Union,
22
+ )
23
+
24
+ from rich_click.utils import CommandGroupDict, OptionGroupDict
25
+
26
+
27
+ if TYPE_CHECKING:
28
+ import sys
29
+
30
+ from rich.align import AlignMethod
31
+ from rich.box import Box
32
+ from rich.console import Console, JustifyMethod
33
+ from rich.padding import PaddingDimensions
34
+ from rich.style import StyleType
35
+ from rich.text import Text, TextType
36
+
37
+ from rich_click.rich_help_configuration import (
38
+ CommandColumnType,
39
+ CommandHelpSectionType,
40
+ OptionColumnType,
41
+ OptionHelpSectionType,
42
+ RichHelpConfiguration,
43
+ )
44
+
45
+ if sys.version_info < (3, 11):
46
+ from typing_extensions import NotRequired
47
+ else:
48
+ from typing import NotRequired
49
+
50
+
51
+ class RichContextSettingsDict(TypedDict):
52
+ obj: NotRequired["Any | None"]
53
+ auto_envvar_prefix: NotRequired[Optional[str]]
54
+ default_map: NotRequired[MutableMapping[str, Any] | None]
55
+ terminal_width: NotRequired[Optional[int]]
56
+ max_content_width: NotRequired[Optional[int]]
57
+ resilient_parsing: NotRequired[bool]
58
+ allow_extra_args: NotRequired[Optional[bool]]
59
+ allow_interspersed_args: NotRequired[Optional[bool]]
60
+ ignore_unknown_options: NotRequired[Optional[bool]]
61
+ help_option_names: NotRequired[Optional[List[str]]]
62
+ token_normalize_func: NotRequired[Callable[[str], str] | None]
63
+ color: NotRequired[Optional[bool]]
64
+ show_default: NotRequired[Optional[bool]]
65
+ rich_console: NotRequired[Optional["Console"]]
66
+ rich_help_config: NotRequired[Optional[Union[Mapping[str, Any], RichHelpConfiguration]]]
67
+ export_console_as: NotRequired[Optional[Literal["html", "svg", "text"]]]
68
+ errors_in_output_format: NotRequired[Optional[bool]]
69
+ help_to_stderr: NotRequired[Optional[bool]]
70
+
71
+
72
+ class TableKwargs(TypedDict):
73
+ title: NotRequired[Optional["TextType"]]
74
+ caption: NotRequired[Optional["TextType"]]
75
+ width: NotRequired[Optional[int]]
76
+ min_width: NotRequired[Optional[int]]
77
+ box: NotRequired[Optional[Union[str, "Box"]]]
78
+ safe_box: NotRequired[Optional[bool]]
79
+ padding: NotRequired["PaddingDimensions"]
80
+ collapse_padding: NotRequired[bool]
81
+ pad_edge: NotRequired[bool]
82
+ expand: NotRequired[bool]
83
+ show_header: NotRequired[bool]
84
+ show_footer: NotRequired[bool]
85
+ show_edge: NotRequired[bool]
86
+ show_lines: NotRequired[bool]
87
+ leading: NotRequired[int]
88
+ style: NotRequired["StyleType"]
89
+ row_styles: NotRequired[Optional[Iterable["StyleType"]]]
90
+ header_style: NotRequired[Optional["StyleType"]]
91
+ footer_style: NotRequired[Optional["StyleType"]]
92
+ border_style: NotRequired[Optional["StyleType"]]
93
+ title_style: NotRequired[Optional["StyleType"]]
94
+ caption_style: NotRequired[Optional["StyleType"]]
95
+ title_justify: NotRequired["JustifyMethod"]
96
+ caption_justify: NotRequired["JustifyMethod"]
97
+ highlight: NotRequired[bool]
98
+
99
+
100
+ class PanelKwargs(TypedDict):
101
+ box: NotRequired[Union[str, "Box"]]
102
+ title: NotRequired[Optional["TextType"]]
103
+ title_align: NotRequired["AlignMethod"]
104
+ subtitle: NotRequired[Optional["TextType"]]
105
+ subtitle_align: NotRequired["AlignMethod"]
106
+ safe_box: NotRequired[Optional[bool]]
107
+ expand: NotRequired[bool]
108
+ style: NotRequired["StyleType"]
109
+ border_style: NotRequired["StyleType"]
110
+ width: NotRequired[Optional[int]]
111
+ height: NotRequired[Optional[int]]
112
+ padding: NotRequired["PaddingDimensions"]
113
+ highlight: NotRequired[bool]
114
+
115
+
116
+ class RichHelpConfigurationDict(TypedDict):
117
+ """Typed dict for rich_config() kwargs."""
118
+
119
+ theme: NotRequired[Optional[str]]
120
+ enable_theme_env_var: NotRequired[bool]
121
+ style_option: NotRequired["StyleType"]
122
+ style_option_negative: NotRequired[Optional["StyleType"]]
123
+ style_argument: NotRequired["StyleType"]
124
+ style_command: NotRequired["StyleType"]
125
+ style_command_aliases: NotRequired["StyleType"]
126
+ style_switch: NotRequired["StyleType"]
127
+ style_switch_negative: NotRequired[Optional["StyleType"]]
128
+ style_metavar: NotRequired["StyleType"]
129
+ style_metavar_append: NotRequired["StyleType"]
130
+ style_metavar_separator: NotRequired["StyleType"]
131
+ style_range_append: NotRequired["StyleType"]
132
+ style_header_text: NotRequired["StyleType"]
133
+ style_epilog_text: NotRequired["StyleType"]
134
+ style_footer_text: NotRequired["StyleType"]
135
+ style_usage: NotRequired["StyleType"]
136
+ style_usage_command: NotRequired["StyleType"]
137
+ style_usage_separator: NotRequired["StyleType"]
138
+ style_deprecated: NotRequired["StyleType"]
139
+ style_helptext_first_line: NotRequired["StyleType"]
140
+ style_helptext: NotRequired["StyleType"]
141
+ style_option_help: NotRequired["StyleType"]
142
+ style_command_help: NotRequired["StyleType"]
143
+ style_option_default: NotRequired["StyleType"]
144
+ style_option_envvar: NotRequired["StyleType"]
145
+ style_required_short: NotRequired["StyleType"]
146
+ style_required_long: NotRequired["StyleType"]
147
+ style_options_panel_border: NotRequired["StyleType"]
148
+ style_options_panel_box: NotRequired[Optional[Union[str, "Box"]]]
149
+ style_options_panel_help_style: NotRequired["StyleType"]
150
+ style_options_panel_title_style: NotRequired["StyleType"]
151
+ style_options_panel_padding: NotRequired["PaddingDimensions"]
152
+ style_options_panel_style: NotRequired["StyleType"]
153
+ align_options_panel: NotRequired["AlignMethod"]
154
+ style_options_table_show_lines: NotRequired[bool]
155
+ style_options_table_leading: NotRequired[int]
156
+ style_options_table_pad_edge: NotRequired[bool]
157
+ style_options_table_padding: NotRequired["PaddingDimensions"]
158
+ style_options_table_expand: NotRequired[bool]
159
+ style_options_table_box: NotRequired[Optional[Union[str, "Box"]]]
160
+ style_options_table_row_styles: NotRequired[Optional[List["StyleType"]]]
161
+ style_options_table_border_style: NotRequired[Optional["StyleType"]]
162
+ style_commands_panel_border: NotRequired["StyleType"]
163
+ panel_inline_help_in_title: NotRequired[bool]
164
+ panel_inline_help_delimiter: NotRequired[str]
165
+ style_commands_panel_box: NotRequired[Optional[Union[str, "Box"]]]
166
+ style_commands_panel_help_style: NotRequired["StyleType"]
167
+ style_commands_panel_title_style: NotRequired["StyleType"]
168
+ style_commands_panel_padding: NotRequired["PaddingDimensions"]
169
+ style_commands_panel_style: NotRequired["StyleType"]
170
+ align_commands_panel: NotRequired[AlignMethod]
171
+ style_commands_table_show_lines: NotRequired[bool]
172
+ style_commands_table_leading: NotRequired[int]
173
+ style_commands_table_pad_edge: NotRequired[bool]
174
+ style_commands_table_padding: NotRequired["PaddingDimensions"]
175
+ style_commands_table_expand: NotRequired[bool]
176
+ style_commands_table_box: NotRequired[Optional[Union[str, "Box"]]]
177
+ style_commands_table_row_styles: NotRequired[Optional[List["StyleType"]]]
178
+ style_commands_table_border_style: NotRequired[Optional["StyleType"]]
179
+ style_commands_table_column_width_ratio: NotRequired[Optional[Union[Tuple[None, None], Tuple[int, int]]]]
180
+ style_errors_panel_border: NotRequired["StyleType"]
181
+ style_errors_panel_box: NotRequired[Optional[Union[str, "Box"]]]
182
+ align_errors_panel: NotRequired[AlignMethod]
183
+ style_errors_suggestion: NotRequired["StyleType"]
184
+ style_errors_suggestion_command: NotRequired["StyleType"]
185
+ style_aborted: NotRequired["StyleType"]
186
+ style_padding_usage: NotRequired["StyleType"]
187
+ style_padding_helptext: NotRequired["StyleType"]
188
+ style_padding_epilog: NotRequired["StyleType"]
189
+
190
+ panel_title_padding: NotRequired[int]
191
+ width: NotRequired[Optional[int]]
192
+ max_width: NotRequired[Optional[int]]
193
+ color_system: NotRequired[Optional[Literal["auto", "standard", "256", "truecolor", "windows"]]]
194
+ force_terminal: NotRequired[Optional[bool]]
195
+ options_table_column_types: NotRequired[List["OptionColumnType"]]
196
+ commands_table_column_types: NotRequired[List["CommandColumnType"]]
197
+ options_table_help_sections: NotRequired[List["OptionHelpSectionType"]]
198
+ commands_table_help_sections: NotRequired[List["CommandHelpSectionType"]]
199
+
200
+ header_text: NotRequired[Optional[Union[str, "Text"]]]
201
+ footer_text: NotRequired[Optional[Union[str, "Text"]]]
202
+ panel_title_string: NotRequired[str]
203
+ deprecated_string: NotRequired[str]
204
+ deprecated_with_reason_string: NotRequired[str]
205
+ default_string: NotRequired[str]
206
+ envvar_string: NotRequired[str]
207
+ required_short_string: NotRequired[str]
208
+ required_long_string: NotRequired[str]
209
+ range_string: NotRequired[str]
210
+ append_metavars_help_string: NotRequired[str]
211
+ append_range_help_string: NotRequired[str]
212
+ arguments_panel_title: NotRequired[str]
213
+ options_panel_title: NotRequired[str]
214
+ commands_panel_title: NotRequired[str]
215
+ errors_panel_title: NotRequired[str]
216
+ delimiter_comma: NotRequired[str]
217
+ delimiter_slash: NotRequired[str]
218
+ errors_suggestion: NotRequired[Optional[Union[str, Text]]]
219
+ errors_epilogue: NotRequired[Optional[Union[str, Text]]]
220
+ aborted_text: NotRequired[str]
221
+ padding_header_text: NotRequired["PaddingDimensions"]
222
+ padding_helptext: NotRequired["PaddingDimensions"]
223
+ padding_helptext_deprecated: NotRequired["PaddingDimensions"]
224
+ padding_helptext_first_line: NotRequired["PaddingDimensions"]
225
+ padding_usage: NotRequired["PaddingDimensions"]
226
+ padding_epilog: NotRequired["PaddingDimensions"]
227
+ padding_footer_text: NotRequired["PaddingDimensions"]
228
+ padding_errors_panel: NotRequired["PaddingDimensions"]
229
+ padding_errors_suggestion: NotRequired["PaddingDimensions"]
230
+ padding_errors_epilogue: NotRequired["PaddingDimensions"]
231
+
232
+ # Behaviours
233
+ show_arguments: NotRequired[Optional[bool]]
234
+ show_metavars_column: NotRequired[Optional[bool]]
235
+ commands_before_options: NotRequired[bool]
236
+ append_metavars_help: NotRequired[Optional[bool]]
237
+ group_arguments_options: NotRequired[bool]
238
+ option_envvar_first: NotRequired[Optional[bool]]
239
+ text_markup: NotRequired[Literal["ansi", "rich", "markdown", None]]
240
+ text_kwargs: NotRequired[Optional[Dict[str, Any]]]
241
+ text_emojis: NotRequired[bool]
242
+ text_paragraph_linebreaks: NotRequired[Optional[Literal["\n", "\n\n"]]]
243
+ use_markdown: NotRequired[Optional[bool]]
244
+ use_markdown_emoji: NotRequired[Optional[bool]]
245
+ use_rich_markup: NotRequired[Optional[bool]]
246
+ command_groups: NotRequired[Dict[str, List[CommandGroupDict]]]
247
+ option_groups: NotRequired[Dict[str, List[OptionGroupDict]]]
248
+ use_click_short_help: NotRequired[bool]
249
+ highlighter_patterns: NotRequired[List[str]]
250
+ legacy_windows: NotRequired[Optional[bool]]