AGENTS.md — Python (PEP 8)
- Indent with 4 spaces, never tabs. No trailing whitespace.
- Keep lines to 79 chars (72 for comments/docstrings); up to 99 only by team agreement.
- Two blank lines between top-level defs/classes; one between methods.
snake_casefor functions/variables/methods/modules;CapWordsfor classes (exceptions end inError);UPPER_CASEfor constants._leading_underscore= non-public. Never usel,O, orIas names. First args areself/cls.- One import per line; group stdlib / third-party / local with a blank line between; no wildcard imports.
- No spaces inside
()[]{}or before,;:; single spaces around binary operators; no spaces around=in kwargs unless the param is annotated. - Break long lines before the operator.
- Docstrings (
"""...""") on every public module/class/function/method; imperative mood, period; closing"""on its own line for multi-line. - Compare to
Nonewithis/is not; useisinstance(...); rely on truthiness (if not seq:). - No bare
except:; catch specific exceptions, keeptryblocks small. - Use
def, not a lambda bound to a name. - Type hints (
x: int -> str) are optional and static-only; useOptional[T]/T | None. - Run
ruff/blackto enforce layout — PEP 8 values readability and module-level consistency over rigid rule-following.