Skip to content

Docs Rules

The docs rules rewrite the PEP 257 docstrings the Docstring walker finds, reshaping the body, the quote placement, or both. Description prose between the opening """ and the first section heading wraps to docstring-line-length (default 76), whereas every Title-case-headed section after it wraps to code-line-length (default 88), and both take one budget when docstring-structured-policy = "docstring-line-length".

expand-docstrings

Docs

Expands a single-line triple-quoted docstring so its opener, its body, and its closer each sit on a line of their own.

frame-docstrings

Docs

Rewrites a docstring's quotes to the triple-double-quote form and puts a multi-line docstring's opener and closer on their own lines.

wrap-docstrings

Docs

Wraps a docstring's description prose to docstring-line-length and its Title-case-headed sections to the budget docstring-structured-policy selects.

The Configuration reference covers the two docstring budgets and the docstring-structured-policy key. The Docstring primitive page covers the walker that finds every docstring in source order.