Repository navigation
Description
We currently enforce various code style issues using flake8, configured via Bio/.flake8 etc and run automatically on TravisCI via tox. More details here including how to install flake8 and the relevant plugins:
One of the important docstring checks we currently do not enforce is missing docstrings in methods of public classes.
This issue to to add the remaining missing method docstrings, and then finally turn on the D102 checks by removing them from the ignore list here:
Currently there are 117 of these remaining following work on issue #1203 etc:
$ flake8 Bio --isolated --select D102 --statistics --quiet --quiet
117 D102 Missing docstring in public method
$ flake8 Bio --isolated --select D102 | sort
Bio/Align/AlignInfo.py:678:1: D102 Missing docstring in public method
Bio/Align/__init__.py:1335:1: D102 Missing docstring in public method
Bio/Align/__init__.py:1342:1: D102 Missing docstring in public method
Bio/AlignIO/EmbossIO.py:32:1: D102 Missing docstring in public method
Bio/AlignIO/EmbossIO.py:42:1: D102 Missing docstring in public method
...
This is fairly simple to fix, so I've tagged is as a "good first issue" and would particularly like to encourage new contributors to try working on this (although code authors are of course also welcome to fix their own omissions).
If you want to volunteer and work on a section, please comment here first to avoid duplication of effort. e.g. "I'll work on Bio/Wise/"
If you want to work on this and #1960 and/or #1961 together, that's fine too.
Activity
michiboo commentedon Mar 21, 2019
Hi I would like to work on this issue!
MarkusPiotrowski commentedon Mar 21, 2019
@michiboo Please select a module on which you would like to work on and tell us. Maybe as starter one that has not to many missing docstrings? E.g. Bio\Align?
If you are not experienced with doscstrings, I would suggest to read PEP 257 beforehand: https://www.python.org/dev/peps/pep-0257/
michiboo commentedon Mar 21, 2019
Yes I would work on this module Bio\Align for start!
MarkusPiotrowski commentedon Mar 21, 2019
Overview: Missing docstring in public method (D102)
Bio\Align_init_.py2Bio\Align\AlignInfo.py1Bio\AlignIO\EmbossIO.py2Bio\Blast\ParseBlastTable.py1Bio\Blast\NCBIXML.py1Bio\Blast\Record.py1Bio\codonalign\codonalignment.py1Bio\codonalign\codonseq.py3Bio\Crystal_init_.py18Bio\Entrez\Parser.py26Bio\FSSP_init_.py8Bio\Nexus\Nexus.py7Bio\Nexus\Trees.py1Bio\PopGen\GenePop\Controller.py12Bio\PopGen\GenePop\EasyController.py9Bio\PopGen\GenePop\LargeFileParser.py1Bio\SCOP\Raf.py1Bio\SearchIO_legacy\ParserSupport.py5Bio\SeqIO_index.py3Bio\SeqIO\Interfaces.py2Bio\SeqIO\SffIO.py2Bio\Wise\dnal.py1Bio\Wise\psw.py2+/- 1, I counted the output of flake8 manually ;-)
Thank you, we are making progress!
svalqui commentedon Apr 1, 2019
I'll work on Bio.SeqIO.
svalqui commentedon Apr 3, 2019
I'll work on Bio.Crystal.
svalqui commentedon Apr 7, 2019
I'll work on Bio.Wise.
svalqui commentedon Apr 14, 2019
@peterjc , about Bio.SearchIO._legacy.ParserSupport.py, is commented as deprecated, would like the DocStrings updated regardless or would you like _legacy removed?
svalqui commentedon Apr 15, 2019
I'll work on Bio.SCOP.Raf.py
14 remaining items
MarkusPiotrowski commentedon May 21, 2019
If you look in one of the former D102 lists, you will see that the two
Bio.BlastD102 issues are new. We should have a closer look at the PRs, otherwise, this will turn into a Sisyphean taskpeterjc commentedon May 21, 2019
True:
vs:
This was from #1997, support for BLAST XML v2. So yes, I missed this during the review.
On the bright side, we're fixing these much more quickly than new code is being added - but the sooner we can enforce D102 etc automatically, the better.
svalqui commentedon May 22, 2019
With the above the only thing left is Bio.Entrez which is been look after by @Ikercasillas . Moving on.
ay-amityadav commentedon May 22, 2019
Dear all, I have been reading Bio.Entrez and it's taking me time to understand the whole thing. I require some more time so that I can work on the concerned task, until then kindly let be assigned to me. Thanks.
MarkusPiotrowski commentedon May 22, 2019
@Ikercasillas
Maybe @mdehoon can assist/guide you; the original code is from him and he recently updated it.
ay-amityadav commentedon May 22, 2019
Thanks @MarkusPiotrowski
I will surely contact @mdehoon, once I have taken a little more look at it. Also, part of the reason it's taking so much time is also that I am not able to spend enough time on it as I would have liked.
peterjc commentedon May 23, 2019
@Ikercasillas you've been a bit unlucky -
Bio/Entrez/Parser.pywas probably the hardest one to add missing docstrings too. How about you tackle the last few other files (all quite recent additions since as Markus noted, we've not been strictly enforcing this rule on recent pull requests):Or, there are a few non-Entrez examples on #1961 (D101 - missing class docstrings)? Thanks!
mdehoon commentedon May 23, 2019
What is meant by public classes? I thought all classes are public.
peterjc commentedon May 23, 2019
I assume a class with a name starting with an underscore would be considered private - we have more of those than I would have guessed:
Some of those are base classes from which a class for public use inherits, others are implementation details not intended for public use.
MarkusPiotrowski commentedon Jun 5, 2019
@svalqui Great job, and thank's to @peterjc for volunteering to smooth
Entrez.Parser.pyout.arindam31 commentedon Jun 17, 2020
Just sharing my observation. I ran flake8 to catch docstring errors and I did get what I expected.
However, as you see, the public method is still missing the name of the method.
My version details:
3.7.9 (flake8-docstrings: 1.5.0, pydocstyle: 4.0.1, flake8-print: 3.1.4, mccabe: 0.6.1, naming: 0.8.2, pycodestyle: 2.5.0, pyflakes: 2.1.1) CPython 3.6.8 on Linux
When I use pydocstyle, I do get the expected complete result:
peterjc commentedon Jun 17, 2020
@arindam31 How is your query related to Biopython?
Also your flake8 and pydocstyle output quoted both identify a D102 issue on line 206 of file
test/integration/test_configuration.py- they seem to be consistent.If you use flake8, it should ignore violations as per any flake8 configuration, in our case we are currently ignoring D102 for the
Tests/*files: https://github.com/biopython/biopython/blob/master/.flake8If you use pydocstyle directly (instead of via flake8), any flake8 configuration is ignored.
arindam31 commentedon Jun 29, 2020
Hi Peter.
I think I posted the query in the wrong group.
Just to share, I have kept pydocstyle since it shows the method name. I run my "make doccheck" using the same.
And I agree that both flake8 and pydocstyle output identify a D102 issue, but like I said, the method name is missing in former.
Perhaps, it is intended.
Thanks for your reply.
peterjc commentedon Jun 29, 2020
Ah, I see what you mean now. I would assume this is deliberate on the part of flake8 - their validation issues only report file and line/column number.