Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Merged
merged 4 commits into from
May 8, 2025

Conversation

ArturoAmorQ
Copy link
Member

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?

Copy link

github-actions bot commented May 7, 2025

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 078f41c. Link to the linter CI: here

doc/developers/contributing.rst Show resolved Hide resolved
doc/developers/contributing.rst Outdated Show resolved Hide resolved
doc/developers/contributing.rst Outdated Show resolved Hide resolved
ArturoAmorQ and others added 2 commits May 7, 2025 14:46
Co-authored-by: Stefanie Senger <91849487+StefanieSenger@users.noreply.github.com>
Copy link
Member

@lucyleeow lucyleeow left a 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!

Comment on lines 807 to 808
* The "Notes" section is optional. It is meant to provide information on
specific behavior of the class/classmethod/method.
Copy link
Member

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?

Copy link
Member Author

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.
`

Copy link
Member

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

Copy link
Member

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...?

Copy link
Member Author

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
Copy link
Member

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?

@lucyleeow lucyleeow enabled auto-merge (squash) May 8, 2025 10:01
@lucyleeow lucyleeow merged commit aca49c1 into scikit-learn:main May 8, 2025
34 checks passed
@ArturoAmorQ ArturoAmorQ deleted the contributing_docstrings branch May 8, 2025 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.