Skip to content

GH-142928: Add deprecation warning for removal of color on HelpFormatter - #142946

Closed
savannahostrowski wants to merge 4 commits into
python:mainfrom
savannahostrowski:deprecation-warning-color
Closed

GH-142928: Add deprecation warning for removal of color on HelpFormatter#142946
savannahostrowski wants to merge 4 commits into
python:mainfrom
savannahostrowski:deprecation-warning-color

Conversation

@savannahostrowski

@savannahostrowskisavannahostrowski commented Dec 18, 2025

Copy link
Copy Markdown
Member

Never documented and buggy but alas, still used, so we need a deprecation warning. More context here: #142274 (comment)

@hroncok

Copy link
Copy Markdown
Contributor

Thanks. Should this still attempt to call self._set_color(color) in this case? Or else if it cannot, say "deprecated and does nothing" in the warning/docs?

Comment threadDoc/whatsnew/3.15.rst

* :mod:`argparse`:

* The *color* parameter of :class:`~argparse.HelpFormatter` is deprecated.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's undocumented, fix the Sphinx warning:

Suggested change
* The *color* parameter of :class:`~argparse.HelpFormatter` is deprecated.
* The *color* parameter of :class:`!HelpFormatter` is deprecated.

@@ -0,0 +1 @@
Deprecate :class:`~argparse.HelpFormatter`'s *color* parameter. Users should use the *color* parameter on :class:`~argparse.ArgumentParser` instead.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Deprecate :class:`~argparse.HelpFormatter`'s *color* parameter. Users should use the *color* parameter on :class:`~argparse.ArgumentParser` instead.
Deprecate :class:`!HelpFormatter`'s *color* parameter. Use the *color* parameter on :class:`~argparse.ArgumentParser` instead.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@savannahostrowski@hroncok@hugovk