GH-57015: Add argparse FlexiHelpFormatter by davesteele · Pull Request #22129 · python/cpython · GitHub
Skip to content

GH-57015: Add argparse FlexiHelpFormatter - #22129

Closed
davesteele wants to merge 19 commits into
python:mainfrom
davesteele:bpo12806-flexihelpformatter
Closed

davesteele wants to merge 19 commits into
python:mainfrom
davesteele:bpo12806-flexihelpformatter

Conversation

@davesteele

@davesteele davesteele commented Sep 7, 2020

Copy link
Copy Markdown
Contributor

This adds the FlexiHelpFormatter class to argparse.

It supports wrapping text, while preserving paragraphs. Bullet lists are supported.

There are a number of differences, relative to the latest patch in the issue report:

  • single line feeds in a paragraph are allowed
  • the code is refactored to avoid duplication
  • test failure fixes (mostly whitespace)

Tests and documentation are included.

https://pypi.org/project/argparse-formatter/

https://bugs.python.org/issue12806

@davesteele davesteele changed the title bpo12806: Add argparse FlexiHelpFormatter bpo-12806: Add argparse FlexiHelpFormatter Sep 7, 2020
@davesteele
davesteele force-pushed the bpo12806-flexihelpformatter branch 2 times, most recently from d82ce68 to da19cdd Compare April 9, 2021 17:04
benjaminhwilliams added a commit to dials/dials_scratch that referenced this pull request Jun 23, 2021
Unfortunately, argparse's proposed FlexiHelpFormatter does not yet
exist, see python/cpython#22129.
@davesteele
davesteele force-pushed the bpo12806-flexihelpformatter branch from 96c0799 to 008764b Compare July 25, 2021 15:29
@ghost

ghost commented Feb 27, 2024

Copy link
Copy Markdown

@python-cla-bot

python-cla-bot Bot commented Apr 18, 2025

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

davesteele and others added 6 commits April 27, 2025 13:47
@davesteele
davesteele force-pushed the bpo12806-flexihelpformatter branch from a3ac677 to a21117a Compare April 27, 2025 17:49

@savannahostrowski savannahostrowski left a comment

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.

Hey there - I just saw this has been opened for awhile but I think this is a great formatter addition. I have a couple of comment but I've played around with this quite a bit and it looks pretty solid!

Comment thread Doc/library/argparse.rst Outdated
Comment thread Doc/library/argparse.rst Outdated
Comment thread Lib/argparse.py Outdated
Comment thread Doc/library/argparse.rst Outdated
Comment thread Doc/library/argparse.rst Outdated
Comment thread Doc/library/argparse.rst Outdated
Comment thread Doc/library/argparse.rst Outdated
@bedevere-app

bedevere-app Bot commented Dec 14, 2025

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@savannahostrowski savannahostrowski changed the title bpo-12806: Add argparse FlexiHelpFormatter GH-57015: Add argparse FlexiHelpFormatter Dec 14, 2025
davesteele and others added 10 commits December 14, 2025 21:01
Co-authored-by: Savannah Ostrowski <savannah@python.org>
Co-authored-by: Savannah Ostrowski <savannah@python.org>
Co-authored-by: Savannah Ostrowski <savannah@python.org>
Co-authored-by: Savannah Ostrowski <savannah@python.org>
Co-authored-by: Savannah Ostrowski <savannah@python.org>
It led to headaches in unittest.
@davesteele

Copy link
Copy Markdown
Contributor Author

I have made the requested changes; please review again.

@bedevere-app

bedevere-app Bot commented Dec 19, 2025

Copy link
Copy Markdown

Thanks for making the requested changes!

@savannahostrowski: please review the changes made to this pull request.

@github-actions

github-actions Bot commented Apr 8, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 8, 2026
@davesteele

Copy link
Copy Markdown
Contributor Author

I've "resolved" issues I believe to be addressed in an effort to facilitate progress.

@savannahostrowski

Copy link
Copy Markdown
Member

Thanks for the patience on this, and for picking it back up earlier this year.

After spending more time thinking about this, I don't think a fifth formatter class is the right addition. The direction I'd like to keep argparse in is "good enough for basic CLIs". There are a lot of richer CLI libraries on PyPI now, and growing argparse's surface area makes it harder to maintain and harder to evolve.

There's also a specific concern I have that this PR surfaces which is around composability. The existing four formatters don't compose, so a user who wants paragraphs and defaults still ends up needing to write a multi-inheritance subclass. Adding ParagraphHelpFormatter extends that pattern without solving the problem the user actually has, and once it's in the stdlib, it's part of the API forever, which constrains any future redesign aimed at fixing composability.

Meanwhile, argparse-formatter, which you maintain, already serves the users who need this today, and can iterate in ways the stdlib can't. Given that, I'm going to decline this and close the PR.

@davesteele

Copy link
Copy Markdown
Contributor Author

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

Labels

awaiting change review stale Stale PR or inactive for long period of time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants