Skip to content

Python Coding Standards Overview

Purpose

Define consistent Python standards that emphasize readability, maintainability, and long-term survivability across repositories.

Core Principles

  • PEP compliance is the default and highest priority.
  • Readability overrides cleverness or brevity.
  • Exceptions must be explicit, documented, and justified.

Tooling Expectations

  • Default linting: ruff.
  • Default type checking: mypy in strict mode and ty with default settings.
  • Mypy remains authoritative until ty cutover is explicitly approved.
  • If a repository uses different tools, document the reason and equivalents.
  • Invoke Python as python3 and use a project-specific environment for all Python commands. See docs/development/environment-and-tooling.md.

CI Gates

See Source Control Guidelines for the hard-gates-only standard: every CI check is a hard gate, and the only sanctioned non-blocking category is the advisory-on-unsupported-versions carve-out (see the Runtime Version Support Policy).

Required checks for Python repositories are maintained in the standard-actions CI gates documentation.

Document Map