GH-57015: Add argparse FlexiHelpFormatter - #22129
davesteele wants to merge 19 commits into
Conversation
d82ce68 to
da19cdd
Compare
Unfortunately, argparse's proposed FlexiHelpFormatter does not yet exist, see python/cpython#22129.
96c0799 to
008764b
Compare
Rebase to force CI retest. The "addres sanitizer" test is failing with a timeout, on test_multiprocessing_fork.WithProcessesTestQueue(). It is not likely that this branch contributed to that failure. https://github.com/python/cpython/pull/22129/checks?check_run_id=3033564406
a3ac677 to
a21117a
Compare
savannahostrowski
left a comment
There was a problem hiding this comment.
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!
|
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 |
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.
|
I have made the requested changes; please review again. |
|
Thanks for making the requested changes! @savannahostrowski: please review the changes made to this pull request. |
|
This PR is stale because it has been open for 30 days with no activity. |
|
I've "resolved" issues I believe to be addressed in an effort to facilitate progress. |
|
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 Meanwhile, |

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:
Tests and documentation are included.
https://pypi.org/project/argparse-formatter/
https://bugs.python.org/issue12806