Presence Check¶
The presence check implements Layer 1 (Presence) of docvet's quality model. It detects public symbols — modules, classes, functions, and methods — that lack a docstring, and reports per-file coverage statistics. 1 rule. This is docvet's built-in replacement for interrogate, with zero extra dependencies.
Rules¶
| Rule ID | Category | Description |
|---|---|---|
missing-docstring |
required | Public symbol has no docstring |
The check parses each file with the standard library ast module, extracts all documentable symbols (modules, classes, functions, methods), applies filtering rules (init, magic, private), and reports one finding per undocumented symbol. Coverage statistics are aggregated across all files.
When this matters
Docstrings are the primary signal AI coding agents use to understand your code. Missing docstrings mean agents operate on guesswork — and research shows absent documentation degrades LLM task success significantly.
Example Output¶
Default (with findings):
Verbose (with coverage detail):
Quiet (findings only, no summary):
Relationship to ruff D100–D107¶
ruff's pydocstyle rules (D100–D107) also detect missing docstrings. The key differences:
| Aspect | ruff D100–D107 | docvet presence |
|---|---|---|
| Coverage metrics | No | Yes — per-file and aggregate percentage |
| Threshold enforcement | No | Yes — min-coverage with CI exit code |
| Pipeline integration | Separate tool | Unified with enrichment, freshness, griffe, coverage |
| Filtering | Per-rule enable/disable | ignore-init, ignore-magic, ignore-private |
You can use both tools together: ruff for style enforcement (D rules), docvet for coverage tracking and threshold enforcement.
Configuration¶
These keys go under [tool.docvet.presence]:
| Key | Type | Default | Description |
|---|---|---|---|
enabled |
bool |
true |
Enable or disable the presence check |
min-coverage |
float |
0.0 |
Minimum coverage percentage (0.0–100.0). When set above 0, the summary includes a pass/fail indicator. |
ignore-init |
bool |
true |
Skip __init__ methods |
ignore-magic |
bool |
true |
Skip dunder methods (__repr__, __str__, etc.) |
ignore-private |
bool |
true |
Skip single-underscore-prefixed symbols (_helper) |
Example¶
Usage¶
Run the presence check on your entire codebase:
Check only files with unstaged changes (default):
Check only staged files:
Check specific files:
Add --verbose for coverage detail and timing, or -q to suppress the summary line:
Or run presence as part of all checks:
Migrating from interrogate¶
docvet's presence check is a zero-dependency replacement for interrogate. Follow these four steps to migrate:
Step 1: Remove interrogate¶
Remove interrogate from your development dependencies and CI configuration:
Remove any [tool.interrogate] section from your pyproject.toml.
Step 2: Add docvet presence configuration¶
Add the equivalent settings to [tool.docvet.presence] in your pyproject.toml:
[tool.docvet.presence]
min-coverage = 95.0 # was: --fail-under 95
ignore-init = true # was: --ignore-init-method (default matches)
ignore-magic = true # was: --ignore-magic (default matches)
ignore-private = true # was: --ignore-private (default matches)
Step 3: Map your interrogate options¶
| interrogate option | docvet equivalent | Notes |
|---|---|---|
--fail-under N |
min-coverage = N |
Percentage threshold |
--ignore-init-method |
ignore-init = true |
Default in docvet |
--ignore-magic |
ignore-magic = true |
Default in docvet |
--ignore-private |
ignore-private = true |
Default in docvet |
--ignore-module |
No equivalent | Modules are always checked |
-e / --exclude |
[tool.docvet] exclude = [...] |
Top-level exclude, shared across all checks |
Step 4: Update CI¶
Replace your interrogate CI step with docvet:
# Before (interrogate)
- run: interrogate -v --fail-under 95
# After (docvet)
- run: docvet presence --all
If you use fail-on to enforce presence in CI alongside other checks:
Zero new dependencies
Unlike interrogate, docvet's presence check uses only the standard library ast module. If you already have docvet installed for enrichment or freshness checking, the presence check adds zero overhead.