Skip to content

Better docstrings, better AI.

PyPI version Python versions CI Coverage License docs vetted

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

pip install docvet && docvet check --all

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.

    Learn more

  • Enrichment


    Detects missing Raises, Yields, Attributes, and Examples sections via AST analysis. 21 rules.

    Learn more

  • Freshness


    Flags code changes without docstring updates using git diff and git blame. 5 rules, two modes.

    Learn more

  • Coverage


    Finds missing __init__.py files that hide packages from documentation generators.

    Learn more

  • Griffe


    Captures griffe parser warnings that break mkdocs rendering. 3 rules.

    Learn more

Installation

pip install docvet

Includes presence, enrichment, freshness, and coverage checks.

pip install docvet[griffe]

Adds the optional griffe rendering compatibility check for mkdocs projects.

Usage

Run docvet against your entire codebase:

docvet check --all

Or check only files with unstaged changes (the default):

docvet check

Or check only staged files, ideal for pre-commit hooks:

docvet check --staged

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:

Vetted 12 files [enrichment, freshness, coverage] — no findings. (0.1s)

What's Next