Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

XState for Python

License

NotificationsYou must be signed in to change notification settings

statelyai/xstate-python

XState for Python - work in progress!

How to use

fromxstateimportMachinelights=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 greenstate=lights.transition(state,"TIMER")# state.value is yellowstate=lights.transition(state,"TIMER")# state.value is redstate=lights.transition(state,"TIMER")# state.value is green again

More advanced examples inthe "examples" folder

Developing

You can set up your development environment in two different ways.

UsingRemote Containers (recommended if you use VS Code)

Prerequisites

Steps

  1. Open the folder in a container. This will setup your environment with python (including python and pylance extensions), dependencies and download scxml tests.
  2. Runpoetry run pytest --cov to run the tests! 👩‍🔬 (or run theRun tests task via VS Code or using VS Code Test explorer where you can debug as well)

Or installing the environment on your local drive

Prerequisites

  • poetry for package and dependency management

Steps

  1. Runpoetry install to create a virtual environment
  2. Make sure test files are present and up to date by runninggit submodule update --init
  3. Runpoetry run pytest --cov to run the tests! 👩‍🔬 (or run theRun tests task via VS Code or using VS Code Test explorer where you can debug as well)

SCXML

SCXML tests are ran fromthe SCION Test Framework module.

Related Projects

About

XState for Python

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors8


[8]ページ先頭

©2009-2025 Movatter.jp