Release 0.9.2 is a minor release and contains a new mermaid diagram backend, a new model decoration mode for easier development with types and some more features and bugfixes.
- Bug #610: Decorate models appropriately when
HierarchicalMachine
is passed toadd_state
(thanks @e0lithic) - Bug #647: Let
may_<trigger>
check all parallel states in processing order (thanks @spearsear) - Bug:
HSM.is_state
works with parallel states now - Experimental features:
- Add
model_override
to Machine constructor to determine the mode of operation. Withmodel_override=Fale
(default),transitions
will not override already defined methods on a model just as it did before. For workflows relying on typing,model_override=True
will override methods already defined on the model and only those (!). This allows to control which convenience methods shall be assigned to the model and keeps the statically 'assumed' model in sync with its runtime counterpart. Since defining each and every method manually is rather tiresome,transitions.experimental.utils.generate_base_model
features a way to convert a machine configuration into aBaseClass
with all convenience functions and callbacks. - Add
transitions.experimental.utils.{add_transitions, event, with_model_definitions, transition}
to define trigger methods in a class model for more convenient type checking.add_transitions
can be used as a function decorator and is stackable.event
returns a placeholder object for attribute assigment.add_transitions
andevent
have the same signature and support transition definition like machine constructors. The functiontransition
can used for better typing and returns a dictionary that can be passed to the utility functions but also to a machine constructor.add_transitions
andevent
require a machine decorated withwith_model_definitions
. Decorating a machinewith_model_definitions
impliesmodel_override=True
.
- Add
- Feature: Add
may_trigger
to models to check whether transitions can be conducted by trigger name. - Feature: Add Mermaid diagram backend that returns a mermaid diagram as a string.
use_pygraphviz
is deprecated in favour forgraph_engine
which may bepygraphviz
(default),graphviz
ormermaid
.