# python-pep8 General Python style rules from PEP 8, plus PEP 257 docstring conventions, for AI coding agents. ```bash 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_case` functions/variables, `CapWords` classes, `UPPER_CASE` constants, 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 not` for `None`, `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 - [PEP 8 — Style Guide for Python Code](https://peps.python.org/pep-0008/) - [PEP 257 — Docstring Conventions](https://peps.python.org/pep-0257/) - [PEP 484 — Type Hints](https://peps.python.org/pep-0484/) ## License MIT