docstr-coverage is a Python utility that scans source files to ensure proper documentation. It identifies missing docstrings, provides a detailed report, and calculates an overall docstring coverage percentage. The current version is 2.3.2, and it follows an infrequent but active release cadence, typically releasing minor versions a few times a year.
pip install docstr-coverageVerified import paths — ran on the pinned version, not inferred.
The primary usage of docstr-coverage is via the command line, but it also exposes a programmatic API. This example demonstrates how to use `get_docstr_coverage` to analyze a Python file and print the results. For CLI usage, simply run `docstr-coverage your_project/`.
Update all configuration options in your project's configuration files (e.g., `pyproject.toml`) to use `snake_case`. For example, `failUnder` becomes `fail_under`.
In CI/CD scripts, be aware of the exit codes. Configure your CI system to expect specific exit codes or wrap the command with `|| true` if you only want to log warnings without failing the build based on docstring coverage.
Carefully review the documentation for `--skip` (for individual docstring types) and `--exclude` (for file paths). Use glob patterns for `--exclude` paths, and test your configuration thoroughly to ensure the correct files and docstring types are being evaluated.