- Support
rich.text.Text()
objects forheader_text
,footer_text
,errors_suggestion
, anderrors_epilogue
.
- Support
{cmd}
as an option/command group key whenpython -m {cmd}
is the command_path. - Fix yet another deprecation warning issue. (Sorry, sorry.)
- Fix another deprecation warning issue.
- Fixed bad deprecation warning with
highlighter
- Fixed incompatibility with Click 9.
- Add
--rich-config
and--output
options to therich-click
CLI. - Lazy load Rich to reduce overhead when not rendering help text. [#154]
- Some internal refactors. These refactors are aimed at making the abstractions more maintainable over time, more consistent, and more adept for advanced used cases.
rich_click.py
is exclusively the global config; all formatting has been moved torich_help_rendering.py
.RichCommand
now makes use of methods in the super class:format_usage
,format_help_text
,format_options
, andformat_epilog
.- Global
formatter
object has been removed from the code. highlighter
is now constructed by theRichHelpFormatter
rather than being inside the config object.
- Added
RichHelpConfiguration.load_from_globals()
classmethod, which pulls all configuration fromrich_click.py
. - Fix bug with regex highlighter for options and switches.
RichHelpConfiguration()
is now asserted to be JSON serializable, as an option for porting configurations. That said, serialization is not a fully supported feature of the high-level API, so serialize the config at your own risk.- Related:
highlighter
is now deprecated inRichHelpConfiguration
; please usehighlighter_patterns
instead.
- Related:
- Moved exclusively to
pyproject.toml
and removedsetup.py
/setup.cfg
; thank you @Stealthii! - Moved to
text_markup: Literal["markdown", "rich", "ansi", None]
instead of booleans.- The default is now
ansi
instead ofNone
to help support usage ofclick.style()
.None
is still supported.
- The default is now
- Fixed issue where error messages would not print to
stderr
by default. - New configuration options: [#178]
STYLE_OPTIONS_PANEL_BOX
STYLE_COMMANDS_PANEL_BOX
STYLE_ERRORS_PANEL_BOX
- Many quality of life improvements for command and option groups:
- Support both
command_path
andcommand.name
. - Added wildcard (
*
) option for command groups and option groups, with thanks to @ITProKyle! - Resolve duplicates.
- Better typing for option groups and command groups with
TypedDict
[#156] - Added
panel_styles
support to groups. [#178] - Allow
table_styles
andpanel_styles
to be defined for the positional arguments group.
- Support both
- Fixed
legacy_windows
default. [#167]
- Fix false deprecation warning. [#151]
- Add support for rich formatting in epilog text [#146]
- Fix bug with
rich-click
CLI not working with Python 3.12. [#141] - Fix compatibility issue with
dbt-core
CLI. [#140]
Warning
Click 7.x support is deprecated and will be removed in a future version. Please update to a newer version of click.
This release comes after merging a huge pull-request from @BrutalSimplicity - see #92
- Extends Click's
HelpFormatter
class - Creates a
HelpConfiguration
class that doubles the current module-level settings - Added a decorator that allows the
HelpConfiguration
to be passed into Click via the supportedcontext_settings
argument provided by theCommand
andGroup
classes. - The Rich Console object can also be configured per command and is distinct from the Console instance used internally by the formatter. The
RichHelpFormatter
creates a console based on theRichHelpConfiguration
as the tight coupling between the Formatter and Click's internals make it difficult to allow the Console to be configured externally (i.e. one example is that Click expects help formatting to be buffered). - Created a
RichContext
class to allow creation of the custom formatter. - The Rich Command, Group, and Context now expose the
Console
andRichHelpConfiguration
properties. - Added contributor VSCode settings
This PR closes a number of issues:
- #25: Add tests!
- #90:
click.ClickException
should output tostderr
- #88: Rich Click breaks contract of Click's
format_help
and its callers - #18: Options inherited from context settings aren't applied
In addition, we merged another large pull-request that adds full static type-checking support (see issue #85), and fixes many bugs - see PR #126.
In addition:
- Add new style option
STYLE_COMMAND
[#102] - Add new style option
WIDTH
(in addition toMAX_WIDTH
), thanks to @ealap [#110] - Add new style option
STYLE_ERRORS_SUGGESTION_COMMAND
[#136] - Updated styling for
Usage:
line to avoid off-target effects [#108] - Click 7.x support has been deprecated. [#117]
- Fixed error where
ctx.exit(exit_code)
would not show nonzero exit codes.[#114] - Support
click.MultiCommand
. [#38]:
- Don't show metavars for feature switch options [#100] (@likewei92)
⚠️ Removed support for Typer⚠️ - Please use the native Typer functionality instead.
- Added self-updating automated readme screengrabs using rich-codex
- Fix
AssertionError
when using click command call [#94]
⚠️ Important notice!⚠️ As of Typer v0.6.0, Typer now supports rich help text natively. Support for Typer in rich-click is now depreciated and will be removed in a future release.
- Pin Typer version to
<0.6
- Improve support for arguments [#82]
- Fixes error with Typer arguments [#59]
- Adds new style option
STYLE_ARGUMENT
- Don't show env vars if
None
[#84] - Specify
__all__
for type checkers [#83]
- Updated pip release build CI [#78]
- Added missed occurence of return values when
standalone_mode
set [#79]
- Add new
FORCE_TERMINAL
config flag to force colours even when help output is piped- Can also be enabled by setting environment variables
GITHUB_ACTIONS
,FORCE_COLOR
orPY_COLORS
- Can also be enabled by setting environment variables
- Add new
OPTION_ENVVAR_FIRST
config flag to print environment variables before option help texts instead of after (nice for alignment if all options have an env var). - Refactor config flag
MAX_WIDTH
to set the consolewidth
and not individual panels- Can now also be set with environment variable
TERMINAL_WIDTH
- Can now also be set with environment variable
- Fix package syntax in
setup.py
forpy.typed
[#75] - Fix printing of return values when
standalone_mode
set [#76]
- Added support for styling the tables that options and commands are displayed in [#69]
- Fixed
AttributeError
fromenvvar
code in some Typer usage [#70]
- Fix missed indentation issue in subcommand help text with
inspect.cleandoc
[#67] - Add support for showing Click / Typer
envvar
environment variables [#36]
- Bumped minimum version of
rich
from10
to10.7.0
(whenGroup
was introduced) - Refactored CLI's patching functionality to support
from rich_click.cli import patch
[#53] - Make
_make_rich_rext
remove text indentations usinginspect.cleandoc
[#55] - Import
rich_click
into main namespace for Pylance [#64] - Add support of new click
hidden
command parameter [#62] - Don't show Typer positional arguments unless
SHOW_ARGUMENTS
is specified [#59] - Fix
\f
escape marker for new versions of Click, including in markdown [#60] - New config option
STYLE_COMMANDS_TABLE_COLUMN_WIDTH_RATIO
to fix column widths across groups [#119]
- Added initial support for Typer [#26]
- Mark PEP 561 Compatibility [#41]
- Distribution now available via MacPorts [#42]
- Add typing information [#39]
- Refactor
RichCommand
andRichGroup
out ofrich_click
[#38] - Change metavar overflow to
fold
, so that large numbers of choices flow onto new lines instead of being truncated with an ellipsis [#33] - Make metavar separators dim (
[]
,<>
) (customise withSTYLE_METAVAR_SEPARATOR
) - Add pre-commit config and a lot more linters (iSort, mypy, Flake8) [#40]
- Monkey-patch
RichCommand
andRichGroup
in CLI code for betterrich-click
compatibility with more tools [#43] - Parse emoji shortcodes
:partying_face:
[#51] - Pushed minimum version of Python up to 3.7, in line with Click v8.1
- Fixed bug where
--no-myflag
wasn't showing in the help [#45]
- Support the command
short_help
argument [#28] - Added
USE_CLICK_SHORT_HELP
global to enable default click shortening of help messages [#28] - Avoid
AttributeError
exceptions when using custom exception classes based on click that don't havectx
[#27] - Fix bug in inverted secondary options [#31]
- Refactor printing options to handle arbitrary numbers of flags [#32]
- New CLI functionality to richifiy via prefix any other tool using click, by @pawamoy [#13]
- Distribution now available via conda-forge
Hotfix patch release to remove an accidental from turtle import st
that crept in due to a pesky VSCode plugin.
Many thanks to @ashb for spotting.
- Added support for
HEADER_TEXT
andFOOTER_TEXT
to go before and after help output - Catch Abort exceptions from
cmd+c
and print nicely usingABORTED_TEXT
- Handle missing
click.types._NumberRangeBase
in click 7x [#16] - Fix compatibility issue for rich 10.6 (
group
vsrender_group
import) [#16] - Require at least click v7.0 (released 2018) [#16]
- Require at least rich v10 (released March 2021) [#16]
- Unwrap single newlines in option and group-command help texts [#23]
- Add click
\b
escape marker functionality into help text rendering [#24] - Fix syntax in example in README file by @fridex [#15]
- Major change: New usage, so that we can avoid having to do monkey patching [#10.]
- Now use with
import rich_click as click
- Now use with
- Add ability to create groups of options with separate panels
- Show positional arguments in their own panel by default
- Add config
GROUP_ARGUMENTS_OPTIONS
option to group with options - Improve handing of metavars, give option to show appended instead of in column
- Add
COLOR_SYSTEM
option to add ability to disable colours - Add options to customise error message help texts
- Add support for printing errors nicely
- A lot of additional testing and tweaking
- Add ability to create groups of commands with separate panels
- Add support for rich console markup or Markdown in help texts
- Set default for
MAX_WIDTH
toNone
instead of100
- Switch boolean option
SKIP_ARGUMENTS
toSHOW_ARGUMENTS
- Improve regular expression for flags like
-bg
- Use click's string for default value, instead of the value directly
- Show some previously missed metavar types (eg. choice and range options)
- Stripped required-asterisk column from options table if none are required
- Made most styling decisions configurable
- Added support for more click parameters
- Showing default values, showing if required, showing if deprecated, epilog
- Option now hidden if set in click
- Seems to work fine on Python 3.6, so dropped the requirement down to this instead of Python 3.7
- Fix a bug in
setup.cfg
that broke installation
Initial development version of rich-click
, mostly as a proof of concept.
Supports basic generic functionality for printing help from click commands and groups.
Code was initially written by @willmcgugan for rich-cli
and then further developed by @ewels.