@@ -17,6 +17,8 @@ defaults. Review this guide to understand what changed and adopt the new APIs at
17175 . Replace ` sm.add_observer(...) ` with ` sm.add_listener(...) ` .
18186 . Update code that catches ` TransitionNotAllowed ` and accesses ` .state ` → use ` .configuration ` .
19197 . Review ` on ` callbacks that query ` is_active ` or ` current_state ` during transitions.
20+ 8 . If using ` States.from_enum ` , note that ` use_enum_instance ` now defaults to ` True ` .
21+ 9 . If using ` get_machine_cls() ` with short names, switch to fully-qualified names.
2022
2123---
2224
@@ -174,6 +176,51 @@ sm.add_listener(my_listener)
174176```
175177
176178
179+ ## ` States.from_enum ` default changed to ` use_enum_instance=True `
180+
181+ In 2.x, ` States.from_enum ` defaulted to ` use_enum_instance=False ` , meaning state values were the
182+ raw enum values (e.g., integers). In 3.0, the default is ` True ` , so state values are the enum
183+ instances themselves.
184+
185+ ** Before (2.x):**
186+
187+ ``` python
188+ states = States.from_enum(MyEnum, initial = MyEnum.start)
189+ # states.start.value == 1 (raw value)
190+ ```
191+
192+ ** After (3.0):**
193+
194+ ``` python
195+ states = States.from_enum(MyEnum, initial = MyEnum.start)
196+ # states.start.value == MyEnum.start (enum instance)
197+ ```
198+
199+ If your code relies on raw enum values, pass ` use_enum_instance=False ` explicitly.
200+
201+
202+ ## Short registry names removed
203+
204+ In 2.x, state machine classes were registered both by their fully-qualified name and their short
205+ class name. The short-name lookup was deprecated since v0.8 and has been removed in 3.0.
206+
207+ ** Before (2.x):**
208+
209+ ``` python
210+ from statemachine.registry import get_machine_cls
211+
212+ cls = get_machine_cls(" MyMachine" ) # short name — worked with warning
213+ ```
214+
215+ ** After (3.0):**
216+
217+ ``` python
218+ from statemachine.registry import get_machine_cls
219+
220+ cls = get_machine_cls(" myapp.machines.MyMachine" ) # fully-qualified name
221+ ```
222+
223+
177224## Update ` TransitionNotAllowed ` exception handling
178225
179226The ` TransitionNotAllowed ` exception now stores a ` configuration ` attribute (a set of states)
0 commit comments