Skip to content

[WIP] DOC check warning raised by sphinx #20414

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

Closed
wants to merge 2 commits into from

Conversation

glemaitre
Copy link
Member

@glemaitre glemaitre commented Jun 28, 2021

Weird stuff with black as well.: Trailing spaces :)

@@ -1021,6 +1021,7 @@ def predict_log_proba(self, X):
)
@property
def n_features_(self):
"""int: The number of features seen during `fit`."""
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thomasjpfan napoleon mentions that you can do the following for a property. Numpydoc raises an error because the summary does not start with a capital letter (since this is the type). However, it also mentioned that this is probably a property. So I assume this is kind of valid.

Do you have any thoughts on that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following will work:

"""int : The number of features seen during `fit`.
"""

But black will reformat it on a single line ;P

Copy link
Member

@ogrisel ogrisel Jun 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with black: for oneliner docstrings, PEP257 says we should put the quotes on the same line.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be possible to ignore GL02 by adding the following in conf.py:

numpydoc_validation_checks = {"all", "GL02"}

https://numpydoc.readthedocs.io/en/latest/validation.html#docstring-validation-during-sphinx-build

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically, we want to ignore GL02 only in properties.

@glemaitre glemaitre marked this pull request as draft June 28, 2021 09:10
@ogrisel
Copy link
Member

ogrisel commented Jun 28, 2021

@glemaitre it seems that the new sphinx warnings will be fixed by #20410, right? I do not understand this PR.

@ogrisel
Copy link
Member

ogrisel commented Jun 29, 2021

I am not sure what this PR is supposed to gix @glemaitre. In the failing CI I only see:

    sklearn/tree/_classes.py:docstring of sklearn.tree._classes.DecisionTreeClassifier:154: WARNING: Unknown target name: "n_features".
    sklearn/tree/_classes.py:docstring of sklearn.tree.DecisionTreeClassifier.n_features_:2: WARNING: Unknown target name: "n_features".
    sklearn/tree/_classes.py:docstring of sklearn.tree.DecisionTreeClassifier.n_features_:2: WARNING: Unknown target name: "n_features_in".
    sklearn/tree/_classes.py:docstring of sklearn.tree._classes.DecisionTreeRegressor:144: WARNING: Unknown target name: "n_features".
    sklearn/tree/_classes.py:docstring of sklearn.tree.DecisionTreeRegressor.n_features_:2: WARNING: Unknown target name: "n_features".
    sklearn/tree/_classes.py:docstring of sklearn.tree.DecisionTreeRegressor.n_features_:2: WARNING: Unknown target name: "n_features_in".
    sklearn/tree/_classes.py:docstring of sklearn.tree._classes.ExtraTreeClassifier:155: WARNING: Unknown target name: "n_features".
    sklearn/tree/_classes.py:docstring of sklearn.tree.ExtraTreeClassifier.n_features_:2: WARNING: Unknown target name: "n_features".
    sklearn/tree/_classes.py:docstring of sklearn.tree.ExtraTreeClassifier.n_features_:2: WARNING: Unknown target name: "n_features_in".
    sklearn/tree/_classes.py:docstring of sklearn.tree._classes.ExtraTreeRegressor:138: WARNING: Unknown target name: "n_features".
    sklearn/tree/_classes.py:docstring of sklearn.tree.ExtraTreeRegressor.n_features_:2: WARNING: Unknown target name: "n_features".
    sklearn/tree/_classes.py:docstring of sklearn.tree.ExtraTreeRegressor.n_features_:2: WARNING: Unknown target name: "n_features_in". 

which are unrelated and are now fixed in main.

Could you please update the description to describe the problem with the error message you observe?

@glemaitre glemaitre closed this Jul 7, 2021
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.

2 participants