Docstring coverage - covering python code with documentation

How to verify that the python developers (or yourself) have well documented the code, except to browse through everything by hand or generate documentation in pydoc and compare it with the source? So I did not find any solution until I accidentally came across an old-old script that inspired me to fork and the subsequent simple revision.

As a result, I got a simple and useful (at least for me :)) Docstring coverage tool that allows you to estimate the percentage coverage of the code with documentation for the entire project.



It starts like this:
docstring-coverage [опции] <путь к папке или модулю>


Output Example:
$ docstring-coverage docstring-coverage/

File docstring-coverage/setup.py
 - No module dostring!
 Needed: 1; Exist: 0; Missing: 1; Coverage: 0.0%

File docstring-coverage/docstringcoverage/__init__.py
 - No module dostring!
 Needed: 1; Exist: 0; Missing: 1; Coverage: 0.0%

File docstring-coverage/docstringcoverage/cover.py
 - No docstring for DocStringCoverageVisitor!
 - No docstring for DocStringCoverageVisitor.__init__!
 - No docstring for DocStringCoverageVisitor.visitModule!
 - No docstring for DocStringCoverageVisitor.visitClass!
 - No docstring for DocStringCoverageVisitor.visitFunction!
 - No docstring for DocStringCoverageVisitor.getResult!
 - No docstring for get_docstring_coverage.printDocstring!
 Needed: 11; Exist: 4; Missing: 7; Coverage: 36.4%


Overall statistics for 3 files:
Docstrings needed: 13; Docstrings exist: 4; Docstrings missing: 9
Total docstring coverage: 30.8%;  Grade: not so good

Among the options is -m, which forces the utility to skip the __magic__ python and -v methods, which allows you to adjust the level of "readability" of the output from 0 to 3.
If you wish, you can import it into a working project to use for statistics on coverage:

import docstringcoverage
cover_results = docstringcoverage.get_docstring_coverage(['somefolder/somefile.py'])


Suggested as a list with two elements of type dict:

[
    {'<имя файла>': 
        {
            'missing': ["<имя метода, класса или функции","..."],                                    
            'module_doc': <True or False>,  #есть ли докстринг для модуля
            'missing_count': <missing_count>, #сколько пропущено докстрингов
            'needed_count': <needed_docstrings_count>, #сколько всего должно быть докстрингов
            'coverage': <percent_of_coverage>,      #процент покрытия
            'empty': <True or False> #True, если файл пуст 
                                               #(нет импортов, функций, классов или переменных)
        },
        ...
    },
                  
    #всего по проекту
    {
        'missing_count': <total_missing_count>,
        'needed_count': <total_needed_docstrings_count>,
        'coverage': <total_percent_of_coverage>,                                
    }               


All documentation with examples is on the project page .