description: Python style per PEP 8 (+ PEP 257 docstrings) globs: ["**/*.py"] alwaysApply: true
- 4-space indent, no tabs. Lines ≤ 79 chars (72 for comments/docstrings).
- Two blank lines around top-level defs/classes; one between methods.
snake_casefunctions/variables;CapWordsclasses;UPPER_CASEconstants. Exceptions end inError._leading_underscorefor non-public. First argsself/cls. Never name thingsl,O,I.- One import per line, grouped stdlib / third-party / local with blank lines; no wildcard imports.
- No spaces inside brackets or before
,;:; single spaces around binary operators; break long lines before the operator. - Docstrings (
"""...""") on public modules/classes/functions/methods; imperative mood, end with a period. - Compare to
Nonewithis/is not; useisinstance(...); prefer truthiness (if not seq:). - No bare
except:; usedefover a named lambda. - Type hints optional, static-only:
def f(x: int) -> str:,Optional[T]/T | None. - Let
ruff/blackenforce layout; value module-level consistency over rigid compliance.