Skip to content

Implementation

  • Never include comments in the function body (docstrings are okay).
  • Always avoid implicit boolean coercion e.g. use if len(data) == 0 instead of if not data, and if x is not None instead of if x.
  • Always spell out variable names fully. Avoid abbreviations e.g. use buttonElement instead of btn, categoryElements instead of catEls, subscription instead of sub.
  • Use StrEnum, CustomUuid, and NewType to represent distinct business objects that may have the same primitive type.
  • Use Pydantic BaseModel subclasses to represent domain models.
  • When developing a new user flow, always plan and write appropriate integration and E2E tests.
  • Avoid using defaults, whether in Python code or SQL, unless absolutely necessary.
  • When a repository method executes multiple queries, wrap them in self._executor.transactionally() to make them atomic.