Skip to content

Formatting Rules

The formatting rules shape the surrounding scaffolding around statements (blank-line counts between definitions, collection layout against a line budget, trailing-comma discipline, singleton-group strip). Each rule resolves a layout question that sits adjacent to alignment and ordering, with the rewrites typically narrower than the alignment rules and more pervasive than the ordering rules. The

rule reads against the code-line-length budget, with its max-atomics-per-line knob carrying the per-line cap for atomic-literal collections.

blank-lines

Formatting

Prose normalizes blank-line counts to canonical values between thematically adjacent statements.

call-layout

Formatting

Prose explodes a keyword-expressible call carrying more than the inline-argument cap to one keyword argument per line.

collection-layout

Formatting

Prose splits list, tuple, dict, and set literals into one-entry-per-line layout once they overflow their width, or a dict crosses an entry-count cap.

import-layout

Formatting

Prose splits an over-budget from ... import ... into a run of repeated-prefix statements packed to the import budget.

signature-layout

Formatting

Prose normalizes function signatures to one line or one parameter per line, gated by line length and inline-parameter count.

strip-align-padding

Formatting

Prose strips padding from alignment groups that resolve to a single member.

strip-trailing-commas

Formatting

Prose removes trailing commas from inside single-line collections.

unused-future-annotations

Formatting

Prose removes from __future__ import annotations lines that no longer carry their weight on the target Python version.

For the per-rule knobs, see the Configuration reference. For the pipeline order these rules fire in (formatting rules run early so the layout surface is settled by the time alignment rules measure widths), see the Pipeline Order reference.