LinuxCommandLibrary

pydocstyle

Check Python docstring conventions

TLDR

Check docstrings

$ pydocstyle [module.py]
copy
Check directory
$ pydocstyle [src/]
copy
Select conventions
$ pydocstyle --convention [google] [module.py]
copy
Ignore specific errors
$ pydocstyle --ignore [D100,D101] [module.py]
copy
Select specific errors
$ pydocstyle --select [D200,D201] [module.py]
copy
Show source
$ pydocstyle --source [module.py]
copy
Count errors only
$ pydocstyle --count [module.py]
copy

SYNOPSIS

pydocstyle [--convention name] [--ignore codes] [--select codes] [options] files

DESCRIPTION

pydocstyle checks Python docstring conventions. It enforces consistent documentation style.
Conventions define expected format. PEP 257, NumPy, and Google styles are supported.
Error codes identify specific issues. D100 series for modules, D200 for formatting, etc.
Source display shows problematic code. Helps identify and fix issues quickly.
Configuration files set project defaults. pyproject.toml and setup.cfg supported.

PARAMETERS

--convention NAME

Convention (pep257, numpy, google).
--ignore CODES
Errors to ignore.
--select CODES
Errors to check.
--source
Show source code.
--explain
Explain errors.
--count
Count only.
--match PATTERN
File pattern.
--config FILE
Config file.

CONFIGURATION

pyproject.toml

Project configuration with a `[tool.pydocstyle]` section for convention, match patterns, and ignore/select rules.
setup.cfg
Alternative project configuration with a `[pydocstyle]` section supporting the same options.
.pydocstyle
Standalone configuration file for pydocstyle settings.

CONVENTIONS

pep257 - PEP 257 conventions
numpy - NumPy docstring style
google - Google Python style

CAVEATS

Style preferences vary. May need tuning for project needs. Not all edge cases covered.

HISTORY

pydocstyle started as pep257 before expanding to support multiple conventions. It helps Python projects maintain consistent documentation.

SEE ALSO

pylint(1), flake8(1), mypy(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community