Better docstrings, better AI.¶
docvet vets your Python docstrings for presence, completeness, accuracy, and rendering compatibility — the layers beyond style that tools like ruff don't cover.
Quick Start¶
The Quality Model¶
Most tools stop at style. docvet covers everything else:
| 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 | Stale docstrings after code changes | 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. 1 rule. Built-in replacement for interrogate.
-
Enrichment
Detects missing Raises, Yields, Attributes, and Examples sections via AST analysis. 10 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.