-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Validate the Returns section in the docstrings #23138
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
Comments
would like to try taking this on! few questions:
|
To run the tests you should simply call (in a pandas dev environment, and in the project root): If you want to know the value of variables in the |
thanks for the quick response! so technically, the docstring for pandas.DataFrame.head should fail? here's the
And according to https://pandas.pydata.org/pandas-docs/stable/contributing_docstring.html#section-4-returns-or-yields
So the |
In this case it should fail because there is a single value being returned, and it contains the name The correct cases are:
|
I've added some checks in i've created the following pull request : #23432 (sorry, i'm not very familiar with github, i hope I've done this the right way...) |
* upstream/master: REF/TST: replace capture_stdout with pytest capsys fixture (pandas-dev#24501) BUG: fix .iat assignment creates a new column (pandas-dev#24495) DOC: add checks on the returns section in the docstrings (pandas-dev#23138) (pandas-dev#23432) ENH: Add strings_as_fixed_length parameter for df.to_records() (pandas-dev#18146) (pandas-dev#22229) TST: Skip db tests unless explicitly specified in -m pattern (pandas-dev#24492) Mix EA into DTA/TDA; part of 24024 (pandas-dev#24502) DOC: Fix building of a single API document (pandas-dev#24506)
scripts/validate_docstrings.py
validates that the content of a docstring follows our standards. There are still some of those standards that the script does not validate, and this gives the users the wrong impression that the docstring is all right, when it's not really the case. All the missing validations are listed in #20298.The format of the
Returns
section consists of a first line with just the type, and afterwards indented the description. In the case a tuple is returned, then the format isname : type or types
for each parameter, and indented descriptions after them. The descriptions need to start with a capital letter and finish with a period. See: https://pandas.pydata.org/pandas-docs/stable/contributing_docstring.html#section-4-returns-or-yieldsFor this issue is required:
scripts/validate_docstings.py
to give errors if some of the described formats are not satisfied.scripts/tests/test_validate_docstrings.py
The text was updated successfully, but these errors were encountered: