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

Update docstrings to Numpy style #316

Closed
wants to merge 2 commits into from

Conversation

y4shb
Copy link
Contributor

@y4shb y4shb commented Jul 4, 2020

Description

Converts module docstrings to numpy style.

Motivation and Context

Issue #278

Types of Changes

  • Documentation update
  • Bug fix
  • New feature
  • Breaking change1

1The change breaks (or has the potential to break) existing functionality.

Checklist:

If necessary:

  • I have updated the API documentation as part of the package doc-strings.
  • I have created a separate pull request to update the framework documentation on signac-docs and linked it here.
  • I have updated the changelog.

@y4shb y4shb requested review from a team as code owners July 4, 2020 14:06
@y4shb y4shb requested review from tcmoore3 and lyrivera and removed request for a team July 4, 2020 14:06
@@ -36,7 +37,15 @@ def __call__(self, func):
class staticlabel(label):
"""A label decorator for staticmethods.

Parameters
----------
label :
Copy link
Member

Choose a reason for hiding this comment

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

This needs to be filled in.

@@ -46,12 +55,28 @@ def __call__(self, func):
class classlabel(label):
"""A label decorator for classmethods.

Parameters
----------
label :
Copy link
Member

Choose a reason for hiding this comment

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

This needs to be filled in.


Notes
-----

Copy link
Member

Choose a reason for hiding this comment

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

I don't think there should be a blank line here.


Parameters
----------
func :
Copy link
Member

Choose a reason for hiding this comment

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

Type is callable I believe

@@ -11,16 +11,17 @@

class label(object):
"""Decorate a :class:`~.FlowProject` class function as a label function.

Copy link
Member

Choose a reason for hiding this comment

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

@CryoZEUS Can remove these extra spaces on otherwise blank lines? I recommend configuring your editor to trim trailing whitespace when you save a file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, will do that

@@ -12,6 +12,7 @@ python-tag = py3

[pydocstyle]
match = template_filters.py
match = flow/labels.py
Copy link
Member

Choose a reason for hiding this comment

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

Please verify whether this overrides the previous "match" or if it checks both files. I'm not sure what behavior to expect from specifying it twice. In signac we used a complicated regular expression to match all desired filenames, examples below.

Initially we started with a list of allowed (files):
https://github.com/glotzerlab/signac/blob/e8209473103f562fe89c54bea1f5d1ba82b9632a/setup.cfg#L17-L19

Then later, once most of the code was compliant, we transitioned to a list of disallowed / skipped files:
https://github.com/glotzerlab/signac/blob/5186bb27621a1707b9d7493e14e551fe6426737d/setup.cfg#L17-L25

Comment on lines 15 to 23
For example:


.. code-block:: python


class MyProject(FlowProject):


@label()
def foo(self, job):
return True
Copy link
Member

Choose a reason for hiding this comment

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

This should be replaced by an Examples block with a doctest-style code snippet. Look at the "Examples" here: https://numpydoc.readthedocs.io/en/latest/format.html

Something like:

Examples
--------
>>> from flow import FlowProject, label
>>> class MyProject(FlowProject):
...     @label
...     def foo(self, job):
...         return True

Copy link

@lyrivera lyrivera left a comment

Choose a reason for hiding this comment

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

Left one more comment in addition to the previous reviews. Also, the numpy docstring guide suggests that the length of docstring lines should be kept to 75 characters to facilitate reading the docstrings in text terminals. Not sure if flake8 can somehow moderate this.


Notes
-----

Copy link

Choose a reason for hiding this comment

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

Remove this extra line

@vyasr
Copy link
Contributor

vyasr commented Jul 8, 2020

Left one more comment in addition to the previous reviews. Also, the numpy docstring guide suggests that the length of docstring lines should be kept to 75 characters to facilitate reading the docstrings in text terminals. Not sure if flake8 can somehow moderate this.

It is possible to specify a maximum line length for pydocstyle distinct from the one we use for code. However, I'm not sure if there's much benefit to that; the reasoning in the numpy docstring guide matches the typical reasoning for keeping line lengths to a specific number, and aside from the practical annoyances with having two different line lengths I don't think it actually improves readability. I'll leave it to the reviewers to make a final call, though.

@b-butler b-butler added blocked Dependent on something else documentation Writing or editing documentation good first issue Good for newcomers labels Aug 17, 2020
@b-butler
Copy link
Member

We should hold up on this PR until after GSoC, and then someone will need to take over pushing this PR to completion.

@atravitz atravitz removed the blocked Dependent on something else label Sep 23, 2020
@atravitz
Copy link
Collaborator

this is no longer blocked if someone wants to pick this up

@bdice bdice mentioned this pull request Dec 9, 2020
9 tasks
@bdice
Copy link
Member

bdice commented Dec 10, 2020

Replaced by #392.

@bdice bdice closed this Dec 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Writing or editing documentation good first issue Good for newcomers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants