Skip to content

missing-private-module-documentation (PDF603)

Added in 1.0.0 Never fix Requires explicit

Part of the PDF rule category.

View source · View documentation source · Search issues

Fix is not available.

Rule must by default be explicitly selected, unless it is removed from require-explicit.

What it does

Checks for private modules that are missing a module docstring.

A module is private when its module path contains an underscore-prefixed component. Package initializers are handled by the package rules instead.

Why is this useful?

Private modules can still benefit from local documentation when a project chooses to require it.

Ruff compatibility

None.

Examples

A private module without a module docstring is reported:

VALUE = 1
PDF603: Line 1: Private module is missing docstring

A public module inside a private package path is also private:

VALUE = 1
PDF603: Line 1: Private module is missing docstring

A documented private module is accepted:

"""Private session helpers."""

VALUE = 1

Public modules are handled by PDF602 instead:

VALUE = 1

Options

None.