-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
DOC Improve Contributer guide for writting docstrings #31330
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
DOC Improve Contributer guide for writting docstrings #31330
Conversation
Co-authored-by: Stefanie Senger <91849487+StefanieSenger@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, this is a nice amendment!
doc/developers/contributing.rst
Outdated
* The "Notes" section is optional. It is meant to provide information on | ||
specific behavior of the class/classmethod/method. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For my education; are "Notes" sections limited to "class/classmethod/method" ? e.g., could they be added to a attributes section or functions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For info, adding a "Notes" section using markdown inside an attribute
Notes
-----
would raise an ERROR: Error in "rubric" directive: no content permitted.
during build, but not during numpydoc validation.
`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, it makes sense its limited to the above list
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Who raises the error? autodoc, sphinx...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, I think it's sphinx right after reading the sources. Here is the traceback from my local experiment:
writing output...
building [html]: targets for 45 source files that are out of date
updating environment: 0 added, 49 changed, 0 removed
reading sources... [100%] modules/generated/sklearn.model_selection.TunedThresholdClassifierCV
/home/arturo/scikit-learn/sklearn/model_selection/_classification_threshold.py:docstring of sklearn.model_selection._classification_threshold.TunedThresholdClassifierCV:126: ERROR: Error in "rubric" directive:
no content permitted.
.. rubric:: Notes
Only defined if the underlying estimator exposes such an attribute when
fit. [docutils]
looking for now-outdated files... none found
* The "Notes" section is optional. It is meant to provide information on | ||
specific behavior of the class/classmethod/method. | ||
|
||
* Add one or two **snippets** of code in "Example" section to show how it can |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should add that the code should be runable as is - i.e. should include all required imports?
Reference Issues/PRs
What does this implement/fix? Explain your changes.
During the Unaite x :probabl. sprint I realized this piece of documentation can be improved to avoid common mistakes.
Any other comments?