An extremely fast Python docstring cross-reference checker, written in Rust.
uvx drefs .src/models.py:12:5: DREF001 Unresolved docstring reference `pkg.mdoels.User`. Did you mean `pkg.models.User`?
src/views.py:30:5: DREF001 Unresolved docstring reference `Nonexistent`. No import or definition found in this file
Found 2 errors.
Validating cross-references in tinygrad (697 Python files). ~460x faster than mkdocs build --strict.
drefs auto-detects the syntax you use:
- MkDocs:
[text][pkg.mod.Class],[pkg.mod.Class][] - Sphinx:
:class:`pkg.mod.Class`,:func:`pkg.mod.func` - Rust-style:
[Symbol],[`Symbol`],[pkg.mod.Class]
[User] resolves via the current file's imports. [pkg.models.User] resolves directly. Escape with \[not a ref\].
drefs understands __init__.py re-exports, inheritance chains, and self.x attributes.
Optional. Add to pyproject.toml:
[tool.drefs]
src = ["src"] # auto-detected if omitted
style = "auto" # "mkdocs" | "sphinx" | "auto"
inventories = [ # validate against external symbols
"https://docs.python.org/3/objects.inv",
]- Ctrl+Click on each segment of a dotted path
- Syntax highlighting on cross-references
- Red squiggles on broken references
Install from editors/jetbrains/build/distributions/drefs-pycharm-*.zip via Settings > Plugins > Install from Disk.
See CONTRIBUTING.md.
MIT