python-code-stylelisted
Install: claude install-skill contrastiskey/eetc-claude-code
# Python Code Style
Sources. Earlier ones win a disagreement:
1. [PEP 8](https://peps.python.org/pep-0008/) and
[PEP 257](https://peps.python.org/pep-0257/): Python's own style and
docstring conventions.
2. [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html).
3. [Typing best practices](https://typing.python.org/en/latest/reference/best_practices.html)
from the Python typing team.
Framework rules live in `eetc:fastapi-patterns` / `eetc:django-patterns`.
Project-specific commands live in the repo's CLAUDE.md.
## Tooling
- The repo's linter (ruff, pylint, flake8) and type checker (mypy, pyright,
pyrefly) pass. Never loosen their config to get a change through.
- A suppression is line-level, names the rule, and says why when the rule
name doesn't:
`x = lookup() # type: ignore[no-untyped-call] # vendored, no stubs`.
- The formatter (ruff format, black, pyink) owns line length, quotes,
wrapping and trailing commas. Run it on the files you touch and don't
hand-format against it. With no formatter: 4-space indents, 80 columns,
one quote character per file, and no backslash line continuations (wrap
inside parentheses instead).
- Check `requires-python` in `pyproject.toml` before using newer syntax:
| Feature | Python |
|---------|--------|
| `list[int]`, `dict[str, int]` in annotations | 3.9 |
| `X \| None`, `match` | 3.10 |
| `typing.Self`, `except*` | 3.11 |
| `typing.override`, `type Alias = ...`, `def f[T](...)`