alex-rudakov / sphinx-argparse

Sphinx extension that automatically document argparse commands and options
MIT License
49 stars 40 forks source link

Required named arguments shown as optional #58

Closed lordmauve closed 7 years ago

lordmauve commented 7 years ago

Version: sphinx-argparse==0.1.17

In the generated output I see required named arguments, eg

parser.add_argument('--foo', required=True)

being grouped under the heading "optional arguments". This is likely to be very confusing for my application's users. The usage text is correct (ie. omits square brackets).

lordmauve commented 7 years ago

Screenshot demonstrating this issue:

sphinx-argparse-issue58

As you can see in the usage, --packdir is a required argument.

dpryan79 commented 7 years ago

Could you install the develop branch and check if this is fixed there?

lordmauve commented 7 years ago

I believe this is related to Python issue #9694.

lordmauve commented 7 years ago

@dpryan79 I can't easily install from Github at work.

Besides I believe this code in the develop branch is the culprit: https://github.com/ribozz/sphinx-argparse/blob/develop/sphinxarg/parser.py#L159

lordmauve commented 7 years ago

I suggest calling the default argument groups "Named Arguments" and "Positional Arguments" - at least, that's how I'm going to work around this for the time being.

dpryan79 commented 7 years ago

Seems like a reasonable path forward, that's what I'll implement then for the next release.

dpryan79 commented 7 years ago

This has now been changed for the 0.2.0 release, due out Friday.