Repository navigation
Description
Using the tool pydocstyle (installed with pip install pydocstyle), or its flake8 plugin equivalent (installed with pip install flake8-docstring), we can count missing docstrings:
$ pydocstyle Bio/ BioSQL/ --select D1 | grep "^ D" | cut -d "(" -f 1 | sort | uniq -c | sort -n
12 D104: Missing docstring in public package
21 D100: Missing docstring in public module
60 D103: Missing docstring in public function
96 D101: Missing docstring in public class
271 D105: Missing docstring in magic method
607 D102: Missing docstring in public method
or more simply using flake8:
$ flake8 Bio BioSQL --isolated --select D1 --statistics --quiet --quiet
21 D100 Missing docstring in public module
96 D101 Missing docstring in public class
607 D102 Missing docstring in public method
59 D103 Missing docstring in public function
12 D104 Missing docstring in public package
271 D105 Missing docstring in magic method
Ideally all the public facing code in Biopython would have docstrings, so it would be great to (gradually) add these where they are missing.
We can list the missed docstrings per file using a command like this:
$ flake8 Bio BioSQL --isolated --select D1 | cut -d ":" -f 1 | uniq -c
20 Bio/bgzf.py
28 Bio/DocSQL.py
13 Bio/File.py
5 Bio/MarkovModel.py
1 Bio/MaxEntropy.py
1 Bio/NaiveBayes.py
12 Bio/pairwise2.py
7 Bio/ParserSupport.py
14 Bio/Seq.py
17 Bio/SeqFeature.py
6 Bio/SeqRecord.py
3 Bio/Affy/CelFile.py
3 Bio/Align/AlignInfo.py
1 Bio/Align/Applications/_ClustalOmega.py
1 Bio/Align/Applications/_Clustalw.py
1 Bio/Align/Applications/_Dialign.py
1 Bio/Align/Applications/_Mafft.py
1 Bio/Align/Applications/_MSAProbs.py
1 Bio/Align/Applications/_Muscle.py
1 Bio/Align/Applications/_Prank.py
1 Bio/Align/Applications/_Probcons.py
1 Bio/Align/Applications/_TCoffee.py
1 Bio/AlignIO/ClustalIO.py
3 Bio/AlignIO/EmbossIO.py
2 Bio/AlignIO/Interfaces.py
2 Bio/AlignIO/MafIO.py
2 Bio/AlignIO/MauveIO.py
1 Bio/AlignIO/NexusIO.py
3 Bio/AlignIO/PhylipIO.py
1 Bio/AlignIO/StockholmIO.py
9 Bio/Alphabet/__init__.py
6 Bio/Alphabet/Reduced.py
3 Bio/Application/__init__.py
10 Bio/Blast/Applications.py
1 Bio/Blast/NCBIStandalone.py
8 Bio/Blast/ParseBlastTable.py
13 Bio/Blast/Record.py
1 Bio/CAPS/__init__.py
1 Bio/Cluster/__init__.py
2 Bio/codonalign/codonalignment.py
2 Bio/codonalign/codonalphabet.py
5 Bio/codonalign/codonseq.py
1 Bio/Compass/__init__.py
45 Bio/Crystal/__init__.py
14 Bio/Data/CodonTable.py
24 Bio/Emboss/Applications.py
2 Bio/Emboss/Primer3.py
4 Bio/Emboss/PrimerSearch.py
35 Bio/Entrez/Parser.py
3 Bio/ExPASy/cellosaurus.py
3 Bio/ExPASy/Enzyme.py
2 Bio/ExPASy/Prodoc.py
1 Bio/ExPASy/Prosite.py
10 Bio/ExPASy/ScanProsite.py
21 Bio/FSSP/__init__.py
5 Bio/FSSP/fssp_rec.py
3 Bio/FSSP/FSSPTools.py
1 Bio/GA/Evolver.py
1 Bio/GA/Crossover/__init__.py
1 Bio/GA/Crossover/GeneralPoint.py
1 Bio/GA/Mutation/__init__.py
1 Bio/GA/Repair/__init__.py
1 Bio/GA/Selection/__init__.py
1 Bio/GA/Selection/Abstract.py
1 Bio/GenBank/__init__.py
6 Bio/GenBank/Record.py
2 Bio/GenBank/Scanner.py
1 Bio/Geo/__init__.py
3 Bio/Geo/Record.py
3 Bio/Graphics/BasicChromosome.py
1 Bio/Graphics/Comparative.py
3 Bio/Graphics/Distribution.py
1 Bio/Graphics/KGML_vis.py
1 Bio/Graphics/GenomeDiagram/_CircularDrawer.py
4 Bio/Graphics/GenomeDiagram/_CrossLink.py
2 Bio/Graphics/GenomeDiagram/_LinearDrawer.py
1 Bio/HMM/DynamicProgramming.py
2 Bio/HMM/Trainer.py
1 Bio/KDTree/KDTree.py
1 Bio/KEGG/KGML/KGML_parser.py
6 Bio/KEGG/KGML/KGML_pathway.py
1 Bio/KEGG/Map/__init__.py
8 Bio/motifs/__init__.py
2 Bio/motifs/alignace.py
3 Bio/motifs/mast.py
13 Bio/motifs/matrix.py
4 Bio/motifs/meme.py
2 Bio/motifs/thresholds.py
2 Bio/motifs/transfac.py
1 Bio/motifs/applications/_xxmotif.py
4 Bio/motifs/jaspar/__init__.py
1 Bio/NeuralNetwork/__init__.py
1 Bio/NeuralNetwork/Training.py
1 Bio/NeuralNetwork/BackPropagation/__init__.py
4 Bio/NeuralNetwork/BackPropagation/Layer.py
1 Bio/NeuralNetwork/Gene/__init__.py
2 Bio/NeuralNetwork/Gene/Schema.py
20 Bio/Nexus/Nexus.py
2 Bio/Nexus/Nodes.py
5 Bio/Nexus/StandardData.py
3 Bio/Nexus/Trees.py
2 Bio/NMR/xpktools.py
1 Bio/Pathway/Rep/Graph.py
1 Bio/Pathway/Rep/MultiGraph.py
6 Bio/PDB/AbstractPropertyMap.py
9 Bio/PDB/Atom.py
5 Bio/PDB/Chain.py
6 Bio/PDB/Dice.py
4 Bio/PDB/Entity.py
4 Bio/PDB/Model.py
7 Bio/PDB/NACCESS.py
3 Bio/PDB/NeighborSearch.py
3 Bio/PDB/PDBExceptions.py
2 Bio/PDB/PDBIO.py
2 Bio/PDB/Polypeptide.py
2 Bio/PDB/PSEA.py
9 Bio/PDB/Residue.py
2 Bio/PDB/ResidueDepth.py
6 Bio/PDB/Structure.py
3 Bio/PDB/StructureBuilder.py
1 Bio/PDB/Superimposer.py
5 Bio/PDB/Vector.py
1 Bio/PDB/mmCIF/__init__.py
2 Bio/PDB/mmtf/__init__.py
2 Bio/PDB/mmtf/DefaultParser.py
1 Bio/PDB/QCPSuperimposer/__init__.py
12 Bio/phenotype/phen_micro.py
1 Bio/Phylo/_cdao_owl.py
5 Bio/Phylo/BaseTree.py
2 Bio/Phylo/CDAO.py
6 Bio/Phylo/CDAOIO.py
2 Bio/Phylo/Newick.py
3 Bio/Phylo/NewickIO.py
2 Bio/Phylo/NeXML.py
6 Bio/Phylo/NeXMLIO.py
71 Bio/Phylo/PhyloXML.py
25 Bio/Phylo/PhyloXMLIO.py
5 Bio/Phylo/TreeConstruction.py
1 Bio/Phylo/Applications/_Fasttree.py
1 Bio/Phylo/Applications/_Phyml.py
1 Bio/Phylo/Applications/_Raxml.py
1 Bio/Phylo/PAML/__init__.py
4 Bio/Phylo/PAML/_paml.py
1 Bio/Phylo/PAML/_parse_baseml.py
1 Bio/Phylo/PAML/_parse_codeml.py
1 Bio/Phylo/PAML/_parse_yn00.py
1 Bio/Phylo/PAML/baseml.py
2 Bio/Phylo/PAML/chi2.py
1 Bio/Phylo/PAML/codeml.py
2 Bio/Phylo/PAML/yn00.py
4 Bio/PopGen/Async/__init__.py
2 Bio/PopGen/FDist/__init__.py
2 Bio/PopGen/FDist/Controller.py
2 Bio/PopGen/GenePop/__init__.py
13 Bio/PopGen/GenePop/Controller.py
10 Bio/PopGen/GenePop/EasyController.py
1 Bio/PopGen/GenePop/FileParser.py
3 Bio/PopGen/GenePop/LargeFileParser.py
1 Bio/PopGen/GenePop/Utils.py
3 Bio/PopGen/SimCoal/Async.py
2 Bio/PopGen/SimCoal/Cache.py
2 Bio/PopGen/SimCoal/Controller.py
12 Bio/PopGen/SimCoal/Template.py
8 Bio/Restriction/Restriction.py
1 Bio/Restriction/Restriction_Dictionary.py
4 Bio/SCOP/__init__.py
2 Bio/SCOP/Cla.py
2 Bio/SCOP/Des.py
2 Bio/SCOP/Dom.py
2 Bio/SCOP/Hie.py
6 Bio/SCOP/Raf.py
2 Bio/SCOP/Residues.py
2 Bio/SearchIO/_index.py
5 Bio/SearchIO/BlatIO.py
4 Bio/SearchIO/FastaIO.py
9 Bio/SearchIO/_model/hit.py
14 Bio/SearchIO/_model/hsp.py
10 Bio/SearchIO/_model/query.py
4 Bio/SearchIO/BlastIO/blast_tab.py
2 Bio/SearchIO/BlastIO/blast_text.py
5 Bio/SearchIO/BlastIO/blast_xml.py
1 Bio/SearchIO/ExonerateIO/exonerate_cigar.py
1 Bio/SearchIO/ExonerateIO/exonerate_text.py
1 Bio/SearchIO/ExonerateIO/exonerate_vulgar.py
3 Bio/SearchIO/HmmerIO/hmmer2_text.py
1 Bio/SearchIO/HmmerIO/hmmer3_domtab.py
3 Bio/SearchIO/HmmerIO/hmmer3_tab.py
3 Bio/SearchIO/HmmerIO/hmmer3_text.py
17 Bio/SeqIO/_index.py
3 Bio/SeqIO/Interfaces.py
1 Bio/SeqIO/PdbIO.py
1 Bio/SeqIO/PhdIO.py
1 Bio/SeqIO/SffIO.py
1 Bio/SeqIO/UniprotIO.py
12 Bio/Sequencing/Ace.py
1 Bio/Sequencing/Phd.py
5 Bio/Sequencing/Applications/_bwa.py
1 Bio/Sequencing/Applications/_Novoalign.py
15 Bio/Sequencing/Applications/_samtools.py
2 Bio/SeqUtils/CodonUsage.py
3 Bio/SeqUtils/IsoelectricPoint.py
1 Bio/SeqUtils/ProtParam.py
1 Bio/Statistics/__init__.py
11 Bio/SubsMat/__init__.py
4 Bio/SubsMat/FreqTable.py
1 Bio/SVDSuperimposer/__init__.py
4 Bio/SwissProt/__init__.py
2 Bio/SwissProt/KeyWList.py
10 Bio/UniGene/__init__.py
1 Bio/Wise/__init__.py
5 Bio/Wise/dnal.py
12 Bio/Wise/psw.py
5 BioSQL/BioSeq.py
22 BioSQL/BioSeqDatabase.py
10 BioSQL/DBUtils.py
If you would like to work on this, please comment here with the name of the module you want to work on (e.g. Bio.SeqIO or Bio.Wise) to avoid duplication of effort.
Note all the new docstrings should pass the pydocstyle or flake8-docstring checks using Biopython's current configuration.
Right now we're using pydocstyle with .pydocstyle, but plan to move to flake8 using the flake8-docstring plugin configured with .flake8 files, see #1199.
Activity
Gasta88 commentedon May 3, 2017
I would like to help but I'm probably missing some basic information here.
I have both
pydocstyleandflake8on my machines and when I pick some random files from the posted list, I get no warnings in return.By looking at these random files I can see that there is docstring inside.
What else do we need to code?
peterjc commentedon May 3, 2017
First try this - it may just be an out of date flake8?:
This should (via the
--isolatedoption) ignore any local configuration which might be ignoring the D1## codes.There isn't a similar option for
pydocstyleso also try something like this:(Note on my personal machine I am using
pip3 install ...which runs these tools under Python 3, which gives very slightly different output to when run under Python 2)Gasta88 commentedon May 3, 2017
Much better, thanks Peter. I'll start with
Bio.bgzf.peterjc commentedon May 4, 2017
I would suggest one pull request per file or related set of files (e.g. if you updated several entries under
Bio/SeqIO/then one pull request makes sense). This is in part to help with reviewing with a random group of files we may need more than one reviewer if several module owners are involved.Gasta88 commentedon May 4, 2017
I'll start with
Bio.DocSQLAdd missing public docstrings to Bio.bgzf
peterjc commentedon May 4, 2017
If you want to, sure - but
Bio.DocSQLwas deprecated in Biopython 1.69, and unless anyone objects it will be deleted next year. If you think the code is still useful and want to adopt it that would be reason enough to cancel the deprecation :)Gasta88 commentedon May 4, 2017
I have no personal reason to use it, therefore I'll leave it as it is.
I'll concentrate instead on
Bio.Filethen.peterjc commentedon May 4, 2017
@Gasta88 good choice - some of the methods in
Bio.Filewill be familiar fromBio.bgzf👍Update docstrings in File.py
souravsingh commentedon May 8, 2017
@peterjc I will pick Nexus
ctSkennerton commentedon May 12, 2017
@peterjc I'll do the BioSQL module
43 remaining items
peterjc commentedon Jan 23, 2019
Steady progress:
Let's solve D100 next?
See also #1906 which has notes on two of the above.
svalqui commentedon Jan 23, 2019
@peterjc Bio.Phylo docstrings are already on PR #1868, I'll have a look at Bio.motifs.
cheers,
Adding missing public docstrings to Bio.Phylo (#1868)
Add missing module docstring, D100 #1203
Turn comments into module docstrings, D100 #1203
Add missing module docstring, D100 #1203
peterjc commentedon Feb 1, 2019
I think #1868 and #1906 plus the commits I just made will solve all the D100 cases.
Update: Except for the three
Bio.motifsones, but @svalqui said he'd do them.Updated: See #1915 for the motifs docstrings.
Give Restriction_Dictionary.py docstring and standard header
Fix docstring in Bio/PopGen/GenePop/Utils.py
Enforce flake8-docstrings D100 Missing docstring in public module
Enforce flake8-docstrings D100 Missing docstring in public module
peterjc commentedon Mar 15, 2019
New numbers,
I will split this out into sub-issues...
peterjc commentedon Mar 15, 2019
OK, child issues #1960, #1961, #1962 and #1963 filed - closing this one. Thank you all.
peterjc commentedon Jun 6, 2019
Just to note, all the child issues have now been closed - all the public modules, classes, methods, functions in Bio and BioSQL have docstrings (just the magic methods left, and they are a bit repetitive and less important anyway).