Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter Documentation via Docstring #92

Open
srkunze opened this issue Oct 8, 2015 · 6 comments
Open

Parameter Documentation via Docstring #92

srkunze opened this issue Oct 8, 2015 · 6 comments

Comments

@srkunze
Copy link

srkunze commented Oct 8, 2015

Would you find it reasonable to include something like https://www.chromium.org/chromium-os/python-style-guidelines#TOC-Describing-arguments-in-docstrings into argh?

def cmd(param):
    """
    Executes the cmd.

    param: very important parameter
    """

Internally, we still need to use Python 2, so I would love to have this kind of help-text generation in order to reduce usage of the @arg decorator. Btw. it's a great package.

@srkunze srkunze changed the title Parameter Documentation viaDocstring Parameter Documentation via Docstring Oct 8, 2015
@ewerybody
Copy link

I just thought about that!! :D
Shit is there are different formats within the docstring. for instance

  • Sphinx (:tag name:)
  • EpyDoc (@tag name:)

But yeah! Doesn't seem impossible to do :]

@joshlk
Copy link

joshlk commented Aug 10, 2016

This would be a really nice feature. Otherwise your just repeating yourself in the docstring

@joshlk
Copy link

joshlk commented Aug 11, 2016

I've made a pull request #109 which adds a decorator which parses the Sphinx docstring to add type and description information.

It hasn't got tests yet but wanted it out there to see if there is an appetite to merge in.

Any comments? It would be great if someone added to it so it could also parse Google and Numpy style docstrings.

@neithere
Copy link
Owner

Thanks guys, I've commented in PR #109 for now.

@evanunderscore
Copy link

Hi guys,

I tackled a similar problem with defopt. I thought I had done my homework before writing yet another argument parser, but apparently I missed argh at the time. In retrospect I think it would have been better as an addition to argh instead of a standalone library.

If you would like to take inspiration from it or want me to help out in some way, I'd be happy to. Ideally it would be great if argh ended up with a superset of defopt's functionality and then I wouldn't need to maintain a separate project.

Note that defopt handles Google/Numpy formats using sphinxcontrib-napoleon, and also a limited set of typing annotations as described in #107.

@neithere
Copy link
Owner

neithere commented Feb 7, 2023

It seems that this should be configurable, perhaps an extension. I'll try to gather all plugin-ish issues under the appropriate label and see if it makes sense to add such mechanism to Argh.

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

No branches or pull requests

5 participants