PY-MODE1001 · model_foundation
Recommend a Python foundation for one class.
This is a contextual rule for python. Read its implementation.
Definition
Section titled “Definition”Compare one concrete Python class and its exact source with the house model policy. This pass
receives only dataclasses, direct Pydantic foundation bypasses, and state-bearing plain classes
without ordinary behavior. Declarative state uses use_frozen_model unless supplied source
establishes mutation after construction. Arbitrary external field types use the corresponding
flex category only when supplied annotations establish them. A dataclass is an exception only
when supplied interoperability or measured performance evidence requires it. Otherwise
recommend the matching approved model. Every use_ category asks for the class to move onto
that foundation, so use_plain_class names a class that has to come off a model, while a class
already sitting on the right foundation is appropriate whether that foundation is an approved
model or a plain class. Missing requirements are uncertain.
Evidence
Section titled “Evidence”The finding retains the model confidence, class name, and source path.
Exceptions
Section titled “Exceptions”Framework-owned base classes and external interoperability contracts may constrain the available foundation and should be described in the supplied requirements.
Examples
Section titled “Examples”An immutable validated settings dataclass selects use_frozen_model. A mutable record holding
a Torch tensor selects use_flex_model only when both facts are supplied. A connection pool
with lifecycle behavior is appropriate as a plain class.
References
Section titled “References”- Cites “patos documentation”, base model contracts
- Cites “Pydantic documentation”, model concepts