v.2.0.0 #366
Closed
fgmacedo
started this conversation in
Show and tell
v.2.0.0
#366
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
StateMachine 2.0.0
March 5, 2023
Welcome to StateMachine 2.0.0!
This version is the first to take advantage of the Python3 improvements and is a huge internal refactoring removing the deprecated features on 1.*. We hope that you enjoy it.
These release notes cover the what's new in 2.0, as well as some backward incompatible changes you'll
want to be aware of when upgrading from StateMachine
1.*.Python compatibility in 2.0
StateMachine 2.0 supports Python 3.7, 3.8, 3.9, 3.10, and 3.11.
What's new in 2.0
Run to completion (RTC) by default
There are now two distinct methods for processing events in the library. The new default is to run in
RTC model to be compliant with the specs, where the event is put on a queue before processing.
You can also configure your state machine to run back in Non-RTC model, where the event will
be run immediately and nested events will be chained.
This means that the state machine now completes all the actions associated with an event before moving on to the next event.
Even if you trigger an event inside an action.
See processing model for more details.
State names are now optional
State names are now by default derived from the class variable that they are assigned to.
You can keep declaring explicit names, but we encourage you to only assign a name
when it is different than the one derived from its id.
Added support for internal transitions
An internal transition is like a self transition, but in contrast, no entry or exit actions
are ever executed as a result of an internal transition.
See internal transition for more details.
Added option to ignore unknown events
You can now instantiate a StateMachine with
allow_event_without_transition=True,so the state machine will allow triggering events that may not lead to a state transition,
including tolerance to unknown event triggers.
The default value is
False, that keeps the backward compatible behavior of when anevent does not result in a transition, an exception
TransitionNotAllowedwill be raised.Added support for translations (i18n)
Now the library messages can be translated into any language.
See Add a translation on how to contribute with translations.
Minor features in 2.0
evaluation of truthy and falsy values.
Transitionguards using decorators is now possible.
StateMachineto add behavior on your own base class. AbstractStateMachinecannot be instantiated.Bugfixes in 2.0
on methods with default parameters.
events was calling actions of all events.
Backward incompatible changes in 2.0
1.6for auto-discovering and registeringStateMachineclassesto be used on django integration.
Statemachine class changes in 2.0
The new processing model (RTC) by default
While we've figured out a way to keep near complete backwards compatible changes to the new
Run to completion (RTC) by default feature (all built-in examples run without change),
if you encounter problems when upgrading to this version, you can still switch back to the old
Non-RTC model. Be aware that we may remove the Non-RTC model in the future.
StateMachine.runremoved in favor ofStateMachine.sendShould become:
StateMachine.allowed_transitionsremoved in favor ofStateMachine.allowed_eventsShould become:
Statemachine.is_<state>removed in favor ofStateMachine.<state>.is_activeShould become:
State class changes in 2.0
State.identificationremoved in favor ofState.idShould become:
This discussion was created from the release v.2.0.0.
Beta Was this translation helpful? Give feedback.
All reactions