Skip to content
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

Unify parameters formatting in docstrings #3268

Merged
merged 19 commits into from
Jan 22, 2021

Conversation

NicolasHug
Copy link
Member

@NicolasHug NicolasHug commented Jan 20, 2021

Partially resolves #3003

This PR removes the remaining usage of

Parameters
----------

and related syntax in the docstings.

Also introduce a basic CI check to make sure these aren't introduced anymore.

Copy link
Contributor

@datumbox datumbox left a comment

Choose a reason for hiding this comment

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

@NicolasHug Thanks for fixing the situation in our docstrings. It certainly looks better now. :)

I left one comment with the points we discussed for visibility. Let me know your thoughts based on your findings.

@@ -0,0 +1,8 @@
#!/bin/bash

match=`git grep -A 1 Parameters | grep "\-\-\-"`
Copy link
Contributor

@datumbox datumbox Jan 21, 2021

Choose a reason for hiding this comment

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

The proposed grep will do the trick if Parameters is used instead of Args: but it won't capture the other issues listed on the ticket #3003.

As discussed offline, it would be great to see if any of the popular python doc lints (darglint, pydocstyle or something else) can help us verify the format of pydocs for future PRs. As you pointed out, lints can enforce very strict rules that are not helpful to our community so perhaps it's worth using only the minimum checks related to missing/incorrect arguments on existing pydocs.

Let me know if you find any package that checks the above boxes or you think of an alternative approach.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, I removed the CI check and I'll investigate how we can enforce 1) consistency between a function's signature and its documented parameters, and 2) the dostring style (google style vs numpy vs ...)

We can probably merge this PR as-is however, since it's a net improvement on its own

@NicolasHug NicolasHug changed the title Unify parameters formatting in docstrings + new CI check Unify parameters formatting in docstrings Jan 22, 2021
Copy link
Contributor

@datumbox datumbox left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@datumbox datumbox merged commit 89bc307 into pytorch:master Jan 22, 2021
facebook-github-bot pushed a commit that referenced this pull request Feb 1, 2021
Reviewed By: datumbox

Differential Revision: D26156384

fbshipit-source-id: ca2dc3333e7c8a84c5661456b41213997d7812a4
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.

Standardize Python Documentation styles
3 participants