pytransitions / transitions

A lightweight, object-oriented finite state machine implementation in Python with many extensions
MIT License
5.77k stars 529 forks source link

Add SCXML support #446

Open faisal00813 opened 4 years ago

faisal00813 commented 4 years ago

Finally, SCXML is now complete for adoption. Adding support for SCXMl will allow standardisation.

faisal00813 commented 4 years ago

Some inspiration, https://github.com/davidkpiano/xstate

aleneum commented 4 years ago

Hi @faisal00813,

Adding support for SCXML will allow standardisation.

If you are looking for a python engine capable of working with SCXML, you could have a look at PySCXML. It's not maintained anylonger but maybe it is sufficient for your purposes.

About the 'standardisation': With my current knowledge I would say that it is not possible for transitions to be SCXML-compatible:

Some inspiration, https://github.com/davidkpiano/xstate

It's a great state chart library for sure. But I could not find documentation about how SCXML can be imported or exported. Can you provide a link or Codepen/JSFiddle?

So, long story short: transitions and SCXML are designed significantly different. Is it possible to create an export/import system for a simple state machine without most transition callbacks, configuration capabilities and a very limited set of 'Executable content'? Probably. Will transitions support a majority of SCXML features? Probably not. Can transitions export/import xstate SCXML exports? I don't know (yet) :).

aleneum commented 4 years ago

That being said, I do think it is possible to build an SCXML engine based on transitions and add all the web technology the w3c likes to see in an SCXML implementation. This could be part of the pytransitions organisation but would be an individual module/package.