alphabetize-siblings
OrderingSorts sibling entries whose order carries no meaning, covering import names, dict keys, class-body members, keyword arguments, and docstring entries.
The ordering rules reorder sibling AST nodes by a fixed key while keeping each node's attached comments with it and the gaps between sections as written. The shared machinery lives in the Orderer primitive, and each rule supplies the classifier closure that names the sort key. A pin keeps specific items (a class docstring, a module-level import above a divider comment) in the slot the author wrote while the rest of the siblings reorder.
Sorts sibling entries whose order carries no meaning, covering import names, dict keys, class-body members, keyword arguments, and docstring entries.
Moves module-level constants into a leading band below the imports and a trailing band below the definitions, and sorts each band.
Moves each import in a run into its section, __future__ first, then bare, then external from, then local-package.
The Orderer primitive page covers how a comment attaches to a node and the gap_override machinery. The # prose: keep directive (documented in Suppression Directives) keeps a dict literal out of alphabetize-siblings when the entry order carries meaning no rule can read from the source, and the rule's sort-dict-keys facet turns the reorder off across a whole project.