XState for Python
XState for Python - work in progress!
How to use
from xstate.machine import Machine
lights = Machine(
{
"id": "lights",
"initial": "green",
"states": {
"green": {"on": {"TIMER": "yellow"},},
"yellow": {"on": {"TIMER": "red"}},
"red": {"on": {"TIMER": "green"}},
},
}
)
state = lights.initial_state # state.value is green
state = lights.transition(state, "TIMER") # state.value is yellow
state = lights.transition(state, "TIMER") # state.value is red
state = lights.transition(state, "TIMER") # state.value is green again
More advanced examples in the "examples" folder
Testing
- Run
python3.7 -m venv .venvto create a virtual environment - Run
source .venv/bin/activateto go into that virtual environment - Run
pip install -r requirements_dev.txtto install all of the dependencies inrequirements.txt(which includespytest) - Run
npm i @scion-scxml/test-frameworkto download scxml files - Run
pytestto run the tests! 👩🔬
SCXML
SCXML tests are ran from the SCION Test Framework module.
Related Projects
Metadata
Release files for xstate 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| xstate-0.0.1.tar.gz | 9.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| xstate-0.0.1-py2-none-any.whl | Python 2 | none | any | Details |
Total release size: 21.5 kB
Release files / xstate-0.0.1.tar.gz
| Download URL | xstate-0.0.1.tar.gz |
|---|---|
| Size | 9.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e17a78934a8c9ea0c823891d0194f58a59cfd273f8ced0293f45c89f214a8494
|
|
BLAKE2b-256 checksum How to use checksums |
830c36a48f52f7344677fd176f65a5599e39eec0ea50163c5376327ff889bf32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.9.0
|
Release files / xstate-0.0.1-py2-none-any.whl
| Download URL | xstate-0.0.1-py2-none-any.whl |
|---|---|
| Size | 12.4 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
568f3d38634f03966a0121c0c98ed79d38ffd2e10b4f9c7be91e3cd369fcc500
|
|
BLAKE2b-256 checksum How to use checksums |
cd7ff2b32f2aec21c1f317ca53ffe657ff2ddb33ab3f02fd02ebb5087e3815ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.9.0
|
Security for xstate 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.