python-pep8
General Python style rules from PEP 8, plus PEP 257 docstring conventions, for AI coding agents.
npx rulepack add python-pep8
What it covers
- Layout — 4-space indent, 79-column limit, two/one blank-line spacing, breaking before binary operators.
- Naming —
snake_casefunctions/variables,CapWordsclasses,UPPER_CASEconstants, underscore conventions. - Imports — one per line, grouped stdlib / third-party / local, no wildcards.
- Whitespace — rules for brackets, commas, operators, and annotated defaults.
- Docstrings & comments — PEP 257 triple-double-quote docstrings, imperative mood, block/inline comment style.
- Comparisons —
is/is notforNone,isinstance, truthiness for empty sequences. - Type hints — brief PEP 484 notes (optional, static-only).
This is general Python style. For the FastAPI framework, see the python-fastapi pack — they complement each other. PEP 8 itself recommends enforcing layout with a formatter (black / ruff).
Source
License
MIT