Better docstrings, better AI.¶
docvet combines presence metrics, structural completeness checks, history-based staleness signals, and rendering compatibility diagnostics, with CLI, editor, and agent interfaces. These checks overlap with tools such as Ruff and pydoclint; see the capability comparison.
Quick Start¶
The Quality Model¶
The model separates quality concerns. Structural checks and history heuristics help reviewers; they do not prove semantic correctness:
| Layer | Check | What It Catches | Tool |
|---|---|---|---|
| 1 | Presence | Missing docstrings | docvet presence |
| 2 | Style | Formatting, conventions | ruff D rules |
| 3 | Completeness | Missing sections (Raises, Yields, Attributes) | docvet enrichment |
| 4 | Accuracy | Potential staleness from git history | docvet freshness |
| 5 | Rendering | Broken mkdocs output | docvet griffe |
| 6 | Visibility | Packages hidden from doc generators | docvet coverage |
Checks¶
-
Presence
Detects public symbols without docstrings and reports coverage metrics. 2 rules. Includes coverage thresholds.
-
Enrichment
Detects missing Raises, Yields, Attributes, and Examples sections via AST analysis. 21 rules.
-
Freshness
Flags code changes without docstring updates using git diff and git blame. 5 rules, two modes.
-
Coverage
Finds missing
__init__.pyfiles that hide packages from documentation generators. -
Griffe
Captures griffe parser warnings that break mkdocs rendering. 3 rules.
Installation¶
Usage¶
Run docvet against your entire codebase:
Or check only files with unstaged changes (the default):
Or check only staged files, ideal for pre-commit hooks:
Here's what the output looks like when findings exist:
src/myapp/utils.py:42: missing-raises Function 'parse_config' raises ValueError but Raises section is missing [required]
src/myapp/utils.py:87: stale-signature Function 'validate_input' signature changed without docstring update [required]
src/myapp/models.py:15: missing-attributes Class 'User' has 3 undocumented attributes [required]
Vetted 12 files [enrichment, freshness, coverage] — 3 findings (3 required, 0 recommended). (0.2s)
Each finding shows the file, line number, rule name, a human-readable message, and severity. The summary line confirms what was checked and how long it took. When all docstrings are clean, you see:
What's Next¶
- Set up CI Integration with GitHub Actions or pre-commit hooks.
- See the CLI Reference for full command and option documentation.
- Browse Configuration for all
pyproject.tomloptions.