Releases: pytransitions/transitions
Release 0.9.3
Release 0.9.3 is a minor release and contains mostly bugfixes and some typing improvements.
- Bug #682:
AsyncTimeoutdid not stop execution (thanks @matt3o) - Bug #683: Typing wrongly suggested that
Transitioninstances can be passed toMachine.__init__and/orMachine.add_transition(s)(thanks @antonio-antuan) - Bug #692: When adding an already constructed
NestedState, FunctionWrapper was not properly initialized (thanks @drpjm) - Bug #701:
Machine.dispatchshould not short-circuit when a model returns False (thanks @Joshuaalbert) - Typing should be more precise now
- Made
transitions.core.(Async)TransitionConfigDictaTypedDictwhich can be used to spot parameter errors during static analysis Machine.add_transitionsandMachine.__init__expect aSequenceof configurations for transitions now- Added 'async' callbacks to types in
asyncioextension
- Made
Release 0.9.2
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
HierarchicalMachineis passed toadd_state(thanks @e0lithic) - Bug #647: Let
may_<trigger>check all parallel states in processing order (thanks @spearsear) - Bug:
HSM.is_stateworks with parallel states now - Experimental features:
- Add
model_overrideto Machine constructor to determine the mode of operation. Withmodel_override=Fale(default),transitionswill not override already defined methods on a model just as it did before. For workflows relying on typing,model_override=Truewill 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_modelfeatures a way to convert a machine configuration into aBaseClasswith 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_transitionscan be used as a function decorator and is stackable.eventreturns a placeholder object for attribute assigment.add_transitionsandeventhave the same signature and support transition definition like machine constructors. The functiontransitioncan used for better typing and returns a dictionary that can be passed to the utility functions but also to a machine constructor.add_transitionsandeventrequire a machine decorated withwith_model_definitions. Decorating a machinewith_model_definitionsimpliesmodel_override=True.
- Add
- Feature: Add
may_triggerto 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_pygraphvizis deprecated in favour forgraph_enginewhich may bepygraphviz(default),graphvizormermaid.
Release 0.9.1
Release 0.9.1 is a minor release and contains several bugfixes and some (typing) improvements. This release also introduces on_final callbacks on machines (as well as NestedState) and final flags for states.
- Bug #594: Fix may_ always returning false for internal transitions (thanks @a-schade)
- PR #592: Pass investigated transition to
EventDatacontext in 'may' check (thanks @msclock) - PR #634: Improve the handling of diagrams when working with parallel states, especially when using the show_roi option (thanks @seanxlliu)
- Bug #619/#639:
Exceptionis not broad enough and does not catchasyncio.CancelledErrororKeyboardInterrupt; useBaseExceptioninstead (thanks @e0lithic and @ofacklam) - '_anchor' suffix has been removed for (py)graphviz cluster node anchors
- local testing switched from tox to nox
- PR #633: Remove surrounding whitespace from docstrings (thanks @artofhuman)
- PR #665: Add
on_finaltoMachineandNestedStateconstructor andfinaltoState. Callbacks passed toon_finalwill be executed when a State withfinal=Trueis entered or all children of a parallel state are final. - Bug #626: Process exceptions with
Machine.on_exceptionin may_ as well (thanks @match1) - PR #666: Improved handling of removing transitions for
GraphMachineandHiearachicalMachine(thanks @drpjm) - PR #667: Better handling of unset styling in
GraphMachine - Typing:
- Added
--strictmypy flag fortransitionstype checks (notteststhough) - Made state, event and machine property mandatory in (Nested)EventData
- Transition.dest may be None
- Introduced (Async)CallbackFunc to declutter callback-related signatures
- Add stub file for extension package for explicite reexport (thanks @DrewDevereux)
- Added
Release 0.9.0
Release 0.9.0 is a major release and contains improvements to ease development, adds some new features and removes the legacy hierarchical machine:
- removed legacy implementation of
HierarchicalMachinefrom the package - Bug #551: Fix active state styling in
GraphMachine(thanks @betaboon) - Bug #554: Fix issues related to scopes and queueing in
HierachicalMachine(thanks @jankrejci) - Bug #568: Reflexive transitions (dest: '=') had not been resolved correctly when source was a wildcard (thanks @jnu)
- Bug #568: HSM did not detect reflexive transitions if src was a parent state (thanks @lostcontrol)
- Bug #569: Fix implicit fallback to
graphvizwhenpygraphvizwas not installed (thanks @FridjofAmundsen) - Bug #580: Fix
on_timeoutcallback resolution when timeout had been initialized withtimeout=0(thanks @Rysbai) - Bug #582: Last label in
GraphSupportwas not correctly aligned whenshow_attributes=True(thanks @spagh-eddie) - Feature: Add pyi stub files for better type hinting. Since many functions and constructors allow rather arbitrary arguments time will tell whether typing should be strict (and cause more mypy issues) or more relaxed (and thus less precise).
- Feature: Reviewed and improved method documentation
- Feature #549: Add
maytransition check to transitions (thanks @artofhuman) - Feature #552: Refactored error handling to be able to handle
MachineErrorinon_exceptioncallbacks (thanks @kpihus) - Feature: Add
mypyto test workflow - PR #461: Add
Retrystate to supported state stereotypes (thanks @rgov) - Internal:
Machine._identify_callbackhas been converted to instance method from class method - Internal:
LockedMachine._get_qualified_state_namehas been converted to instance method from static method - Internal: Removed
_superworkaround related to dill (see #236)
Release 0.8.11
Release 0.8.11 is the last 0.8 release and contains fixes for Python 3.10 compatibility issues:
- Bug #559: Rewrote an async test and replaced setDaemon with daemon property assignment for thread handling (thanks @debalance)
Release 0.8.10
Release 0.8.10 is a minor release and contains two bug fixes for the HSM extension and changes how the 'self' literal string is handled.
- Feature #545: The literal 'self' (default model parameter of
Machine) has been replaced by the class variableMachine.self_literal = 'self'.Machinenow performs an identity check (instead of a value check) withmod is self.self_literalto determine whether it should act as a model. While 'self' should still work when passed to themodelparameter, we encourage usingMachine.self_literalfrom now on. This was done to enable easier override ofMachine.__eq__in subclasses (thanks @VKSolovev). - Bug #547: Introduce
HierarchicalMachine.prefix_pathto resolve global state names since the HSM stack is not reliable whenqueued=True(thanks @jankrejci). - Bug #548:
HSMsource states were exited even though they are parents of the destination state (thanks @wes-public-apps).
Release 0.8.9
Release 0.8.9 is a minor release and contains a bugfix for HSM, a feature for GraphSupport and changes internal cache handling:
- Bugfix #544:
NestedEventnow wraps the machine's scope into partials passed toHierarchicalMachine._process. This prevents queued transitions from losing their scope. - Feature #533:
(A)Graph.drawfunction (object returned byGraphMachine.get_graph()) can be passed a file/stream object as first parameter orNone. The later will result indrawreturning a binary string. (thanks @Blindfreddy). - Feature #532: Use id(model) instead of model for machine-bound caches in
LockedMachine,AsyncMachineandGraphMachine. This might influence pickling (thanks @thedrow).
Release 0.8.8
Release 0.8.8 is a minor release and contains a bugfix and several new or improved features:
- Bugfix #526:
AsyncMachinedoes not remove models whenremove_modelsis called (thanks @Plazas87) - Feature #517: Introduce
try/exceptfor finalize callbacks inMachineandHierachicalMachine. Thus, errors occurring in finalize callbacks will be suppressed and only the original error will be raised. - Feature #520: Show references in graphs and markup. Introduce
MarkupMachine.format_referencesto tweak reference formatting (thanks @StephenCarboni) - Feature #485: Introduce
Machine.on_exceptionto handle raised exceptions in callbacks (thanks @thedrow) - Feature #527:
Machine.get_triggersnow supportsStateandEnumas arguments (thanks @luup2k) - Feature #506:
NestedStateandHierachicalMachine.add_statesnow accept (lists of) states and enums asinitialparameter
Release 0.8.7
Release 0.8.7 is a minor release and contains bugfixes and new features:
- State configuration dictionaries passed to
HierarchicalMachinecan also usestatesas a keyword to define substates. Ifchildrenandstatesare present, onlychildrenwill be considered. - Feature #500:
HierarchicalMachinewith custom separator now addsis_statepartials for nested states (e.g.is_C.s3.a()) to models (thanks @alterscape) - Bugfix #512: Use
model_attributeconsistently inAsyncMachine(thanks @thedrow) - Testing now treats most warnings as errors (thanks @thedrow)
- As a consequence,
pygraphviz.Agraphindiagrams_pygraphvizare now copied bytransitionssinceAGraph.copyas of version1.6does not close temporary files appropriately HierarchicalMachinenow checks whetherstate_cls,event_clsandtransition_clshave been subclassed from nested base classes (e.g.NestedState) to prevent hard to debug inheritance errors
Release 0.8.6
Release 0.8.6 is a minor release and contains bugfixes and new features:
HierarchicalMachine.add_stateswill raise aValueErrorwhen anEnumname contains the currently usedNestedState.separator.- Bugfix #486: Reset
NestedState._scopewhen enter/exit callbacks raise an exception (thanks @m986883511) - Bugfix #488: Let
HierarchicalMachine._get_triggerwhich is bound tomodel.triggerraise aMachineErrorfor invalid events andAttributeErrorfor unknown events (thanks @hsharrison) - Introduced
HierarchicalMachine.has_triggerto determine whether an event is valid for an HSM - Feature #490:
AsyncMachinefeatures an event queue dictionary for individual models whenqueued='model'(thanks @jekel) - Feature #490:
Machine.remove_modelwill now also remove model events from the event queue whenqueued=True - Feature #491:
Machine.get_transitionsand its HSM counterpart now acceptEnumandStateforsourceanddest(thanks @thedrow)