Skip to content

Adding (PRIVATE) to summary line of private docstrings #1466

Closed

Description

@peterjc

The following grep command identifies hundreds of private functions and methods where the one-line docstring summary does not end with (PRIVATE). as per current Biopython style:

$ grep --include '*.py' -rn -A 1 "def _[a-z]" Bio BioSQL | grep '"""' | grep -v "(PRIVATE)" 

(The grep will miss any cases using a multi-line def statement).

Note that given we intend to move from epydoc to sphinx-apidoc for building our HTML API documentation (see #1388 and http://mailman.open-bio.org/pipermail/biopython-dev/2017-November/021884.html for details), there may be a better way to handle in the long term this via Sphinx.

i.e. Assuming we tell Sphinx to include the private functions/methods in the HTML documentation, can it flag these as private in some way (other than us having the text "(PRIVATE)" in the string)?

Activity

  1. added
    good first issue
    on Nov 28, 2017
  2. JaeDukSeo commented on Mar 5, 2018

    @JaeDukSeo

    Is this already closed? I see it merged.

  3. peterjc commented on Mar 5, 2018

    @peterjc
    MemberAuthor

    @JaeDukSeo this issue is still open, lots of these docstrings are still missing the (PRIVATE) suffix.

    A few were fixed in #1462 which was merged.

  4. Amrithasuresh commented on Mar 16, 2018

    @Amrithasuresh
    Contributor

    @peterjc Shall I do the Bio/Phylo/ directory first? Shall I give pull request for individual files?

    I will add (PRIVATE) at the end of the docstrings wherever the grep points out. Do I need to write like this? for eg;

    In line 460 Bio/Phylo/TreeConstruction.py

            """Calculate pairwise distance from two sequences.
            Returns a value between 0 (identical sequences) and 1 (completely
            different, or seq1 is an empty string.) (PRIVATE).
            """
    

    Is that right?

    Thank you.

  5. peterjc commented on Mar 19, 2018

    @peterjc
    MemberAuthor

    @Amrithasuresh one pull request covering Bio/Phylo/ sounds good. Looking at the specific example:

    https://github.com/biopython/biopython/blob/biopython-170/Bio/Phylo/TreeConstruction.py#L458

        def _pairwise(self, seq1, seq2):
            """Calculate pairwise distance from two sequences.
    
            Returns a value between 0 (identical sequences) and 1 (completely
            different, or seq1 is an empty string.)
            """
            score = 0

    Would become:

        def _pairwise(self, seq1, seq2):
            """Calculate pairwise distance from two sequences (PRIVATE).
    
            Returns a value between 0 (identical sequences) and 1 (completely
            different, or seq1 is an empty string.)
            """
            score = 0

    Note we keep that blank line, see PEP257 for background. Thank you!

  6. Amrithasuresh commented on Mar 20, 2018

    @Amrithasuresh
    Contributor

    @peterjc Shall I do Bio/GenBank/ folder as per the suggestions? Thank you.

  7. peterjc commented on Mar 20, 2018

    @peterjc
    MemberAuthor

    Sure - please make a new pull request for the Bio/GenBank/ changes

  8. Amrithasuresh commented on Mar 20, 2018

    @Amrithasuresh
    Contributor

    @peterjc I just pushed in my biopython git repository it is automatically merged with yesterday's pull request. How to fix that?

  9. peterjc commented on Mar 20, 2018

    @peterjc
    MemberAuthor

    You probably need to make a new branch, starting from the official Biopython repository's master branch.

  10. Amrithasuresh commented on Mar 21, 2018

    @Amrithasuresh
    Contributor

    @peterjc Shall I do Bio/SearchIO/ directory? I will create new branch then I will proceed the changes. Is it ok to give single pull request for this directory changes? Thank you.

  11. peterjc commented on Apr 24, 2018

    @peterjc
    MemberAuthor

    @Amrithasuresh You've nearly finished based on the grep command I was using - impressive patience/dedication 👍

  12. svalqui commented on Jul 29, 2018

    @svalqui
    Contributor

    I'll have a look at this.

  13. svalqui commented on Aug 8, 2018

    @svalqui
    Contributor

    Hi @peterjc , I have opened a PR, it address the files found by the grep command, and few more I found, I think that covers the scope of this issue.
    Regards,

  14. added a commit that references this issue on Aug 17, 2018
  15. peterjc commented on Aug 17, 2018

    @peterjc
    MemberAuthor

    Closed via #1749.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationEnhancementStylegood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions