For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /packs/languages/python/paradigm.md.
Quick start

Paradigm

Keep domain behavior independent of resource state and application inheritance.

Functions and capabilities

Why

A pure operation can be tested from values alone. A mutable service object couples it to lifecycle and hidden state.

Rules

  • MUST use named functions for reusable behavior. [review]
  • MUST isolate I/O, logging, clocks, randomness, and environment access in adapters. [review]
  • MUST inject capabilities explicitly rather than retrieve global framework state. [review]
  • MUST prefer composition over application inheritance and mutable service classes. [review]
  • MUST avoid class-based application behavior when a function and explicit capability suffice. [review]
  • MAY declare frozen data records, enums, TypedDicts, and Protocols to express types rather than service behavior. [review]
  • MUST confine required third-party class instances to their resource-owning adapter. [review]
  • MUST bound concurrent external work and preserve async cancellation semantics. [review]

[review]

Pure tests and real adapter tests verify observable boundaries. Typechecks and review establish capability contracts and state ownership.

Enforcement

Pure tests and real adapter tests verify observable boundaries. Typechecks and review establish capability contracts and state ownership.