Originally asked here but I've narrowed down the problem further.
Python's transitions library's Machine doesn't appear to work with Pydantic BaseModel classes. Even if I allow for arbitrarily adding attributes in the Config
subclass, the code gets stuck at the add_model(self)
step.
Example:
class TestModel(BaseModel):
id: Optional[int]
_fsm: "Machine" = PrivateAttr()
def __init__(self, **kwargs):
super().__init__(**kwargs)
self._fsm = fsm.get_fsm(default_status)
self._fsm.add_model(self) # gets stuck here
class Config:
extra = Extra.allow