-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Support attribute docstrings #150
Comments
Sounds good! Though note that from what I know, the only non-rejected pep where attribute docstrings are mentioned is PEP 257. Only acceptable is a literal string right after the attribute, like in the example above. Not from comments on the same or previous line as supported in SimpleParsing. Regarding implementation, this shouldn't be part of jsonargparse. This should be contributed as a new feature to docstring_parser and then update jsonargparse to make use of that new feature. Also ideally the implementation should use ast instead of manually parsing the source like in simple_parsing/docstring.py. I will create a feature request in docstring_parser to hear their thoughts. But from what I have seen they are very open on receiving new contributions. |
Great, that also happens to be my preference 😄.
Awesome, I'll keep an eye out for it! |
- Added way to configure parsing docstrings with a single style.
I have added the support in commit 36a6a3f. See there the changes in the documentation. It is necessary to parse attribute docstrings to figure out if a class has them, since there is no way of knowing this a priori. This adds overhead for all classes, thus attribute docstrings parsing is disabled by default. To enable you need to add: from jsonargparse import set_docstring_parse_options
set_docstring_parse_options(attribute_docstrings=True) Adding this to the
|
🚀 Feature request
Support attribute docstrings like SimpleParsing does here. For example:
train.py
Motivation
The goal is to colocate attributes with their docstrings and benefit from less typing, less scrolling, and shorter git diffs 😄.
The text was updated successfully, but these errors were encountered: