PyDocLint

0.8.3 · active · verified Wed Apr 15

PyDocLint is a fast Python docstring linter that verifies whether a function's docstring sections (arguments, returns, yields, and raises) accurately match its signature and implementation. It currently supports NumPy, Google, and Sphinx docstring styles, running significantly faster than older alternatives. The library is actively maintained with frequent releases, and its current version is 0.8.3.

Warnings

Install

Quickstart

To get started, install pydoclint and run it as a command-line tool on your Python files or directories. Configuration can be managed via a `pyproject.toml` file or command-line arguments.

# my_module.py
def my_function(arg1: int, arg2: str) -> None:
    """
    A sample function.

    Parameters
    ----------
    arg1 : int
        The first argument.
    arg2 : str
        The second argument.
    """
    print(f'{arg1}, {arg2}')

# pyproject.toml
[tool.pydoclint]
style = "numpy"
check-arg-order = true

# Terminal
# Run pydoclint on a file or folder
pydoclint my_module.py
# Or with a config file
pydoclint --config=pyproject.toml my_module.py
# Or as a pre-commit hook (add to .pre-commit-config.yaml)
# - repo: https://github.com/jsh9/pydoclint
#   rev: <latest_tag> # e.g., 0.8.3
#   hooks:
#     - id: pydoclint
#       args: ["--config=pyproject.toml"]

view raw JSON →