{"id":18015640,"url":"https://github.com/zigrazor/pystatemachine","last_synced_at":"2026-03-04T11:03:46.923Z","repository":{"id":46533918,"uuid":"350749957","full_name":"ZigRazor/PyStateMachine","owner":"ZigRazor","description":"Python State Machine ","archived":false,"fork":false,"pushed_at":"2022-12-06T07:35:14.000Z","size":62,"stargazers_count":8,"open_issues_count":3,"forks_count":9,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-06T09:43:57.662Z","etag":null,"topics":["deepsource","framework","hacktoberfest","hacktoberfest-accepted","hacktoberfest2022","progess","python","python-3","python-state-machine","python3","star","state-machine","state-machines"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ZigRazor.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-23T14:49:09.000Z","updated_at":"2025-07-28T01:38:05.000Z","dependencies_parsed_at":"2023-01-23T08:30:40.395Z","dependency_job_id":null,"html_url":"https://github.com/ZigRazor/PyStateMachine","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/ZigRazor/PyStateMachine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZigRazor%2FPyStateMachine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZigRazor%2FPyStateMachine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZigRazor%2FPyStateMachine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZigRazor%2FPyStateMachine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZigRazor","download_url":"https://codeload.github.com/ZigRazor/PyStateMachine/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZigRazor%2FPyStateMachine/sbom","scorecard":{"id":157058,"data":{"date":"2025-08-11","repo":{"name":"github.com/ZigRazor/PyStateMachine","commit":"9b0701642fba2578b58fa2ec0643b844f3d33231"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.2,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":4,"reason":"Found 11/23 approved changesets -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: third-party GitHubAction not pinned by hash: .github/workflows/codesee-arch-diagram.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/ZigRazor/PyStateMachine/codesee-arch-diagram.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/greetings.yml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/ZigRazor/PyStateMachine/greetings.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pypi-publish.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/ZigRazor/PyStateMachine/pypi-publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pypi-publish.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/ZigRazor/PyStateMachine/pypi-publish.yml/main?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/pypi-publish.yml:22","Warn: pipCommand not pinned by hash: .github/workflows/pypi-publish.yml:23","Info:   0 out of   3 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   2 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: topLevel permissions set to 'read-all': .github/workflows/codesee-arch-diagram.yml:12","Warn: no topLevel permission defined: .github/workflows/greetings.yml:1","Warn: no topLevel permission defined: .github/workflows/pypi-publish.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: GNU General Public License v3.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 23 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-16T12:07:34.842Z","repository_id":46533918,"created_at":"2025-08-16T12:07:34.842Z","updated_at":"2025-08-16T12:07:34.842Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30078421,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T08:01:56.766Z","status":"ssl_error","status_checked_at":"2026-03-04T08:00:42.919Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deepsource","framework","hacktoberfest","hacktoberfest-accepted","hacktoberfest2022","progess","python","python-3","python-state-machine","python3","star","state-machine","state-machines"],"created_at":"2024-10-30T04:14:36.911Z","updated_at":"2026-03-04T11:03:46.868Z","avatar_url":"https://github.com/ZigRazor.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyStateMachine\n\u003ca href=\"https://www.python.org\" target=\"_blank\"\u003e \u003cimg src=\"https://raw.githubusercontent.com/devicons/devicon/master/icons/python/python-original.svg\" alt=\"python\" width=\"40\" height=\"40\"/\u003e\u003c/a\u003e  Python State Machine \n\n[![CodeFactor](https://www.codefactor.io/repository/github/zigrazor/pystatemachine/badge)](https://www.codefactor.io/repository/github/zigrazor/pystatemachine)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/17ca07f67ba44089bf28af37ba368e1b)](https://www.codacy.com/gh/ZigRazor/PyStateMachine/dashboard?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=ZigRazor/PyStateMachine\u0026amp;utm_campaign=Badge_Grade)\n\n[![DeepSource](https://deepsource.io/gh/ZigRazor/PyStateMachine.svg/?label=active+issues\u0026show_trend=true)](https://deepsource.io/gh/ZigRazor/PyStateMachine/?ref=repository-badge)\n[![DeepSource](https://deepsource.io/gh/ZigRazor/PyStateMachine.svg/?label=resolved+issues\u0026show_trend=true)](https://deepsource.io/gh/ZigRazor/PyStateMachine/?ref=repository-badge)\n\n## Introduction\n**PyStateMachine** is a Framework that support state machines in **Python**\n\n## Requirements\n- Python3\n\n### How to Run\n\nHow do we import the framework?\n\n1. Insure that Python3 is installed:\n   - https://www.python.org/downloads/\n\n2. Install the PyStateMachines framework\n   - pip3 install PyStateMachines\n\n## Example\nAfter framework is installed, import and create a small example.\nCreate xml file from sample with the State machine states.\n\nmyStateMachine.xml\n\n```\n\u003c?xml version=\"1.0\"?\u003e\n\u003cx:States xmlns:x=\"pystatemachine:sm\"\u003e\n    \u003cState\u003e\n        \u003cName\u003eState1\u003c/Name\u003e\n        \u003cEvent\u003e\n            \u003cName\u003eToState2\u003c/Name\u003e\n            \u003cToState\u003eState2\u003c/ToState\u003e\n        \u003c/Event\u003e\n    \u003c/State\u003e\n    \u003cState\u003e\n        \u003cName\u003eState2\u003c/Name\u003e\n        \u003cEvent\u003e\n            \u003cName\u003eToState3\u003c/Name\u003e\n            \u003cToState\u003eState3\u003c/ToState\u003e\n        \u003c/Event\u003e\n    \u003c/State\u003e\n    \u003cState\u003e\n        \u003cName\u003eState3\u003c/Name\u003e\n        \u003cEvent\u003e\n            \u003cName\u003eToState1\u003c/Name\u003e\n            \u003cToState\u003eState1\u003c/ToState\u003e\n        \u003c/Event\u003e\n    \u003c/State\u003e\n    \u003cInitial_State\u003eState1\u003c/Initial_State\u003e\n\u003c/x:States\u003e\n```\n\nCreate Python Script to run state machine\npyStateMachine.py\n```\n# importing necessary packages\nfrom StateMachine import StateMachine\n\n\"\"\"Test StateMachine\"\"\"\nsm = StateMachine(\"myStateMachine.xml\")\nsm.LoadStateMachine()\n\n# print initial state\nprint(sm.get_current_state())  # current_state == State1\n\nsm.InjectEvent(\"ToState2\")\nprint(sm.get_current_state())  # current_state == State2\n\nsm.InjectEvent(\"ToState3\")\nprint(sm.get_current_state())  # current_state == State3\n\nsm.InjectEvent(\"ToState1\")\nprint(sm.get_current_state())  # current_state == State1\n\n```\nrun Python script to execute state machine\n```\npython pyStateMachine.py\n```\npyStateMachineUnitTest.py\n```\n## Test Suite\n#  importing necessary packages\nfrom StateMachine import StateMachine\nimport unittest\n\n\nclass TestBaseStateMachine(unittest.TestCase):\n    \"\"\"Test state machine using various samples\"\"\"\n\n# test all valid state transitions\n    def test1(self):\n        \"\"\"Test Statemachine\"\"\"\n        sm = StateMachine(\"myStateMachine.xml\")\n        sm.LoadStateMachine()\n        self.assertEqual(sm.get_current_state(), \"State1\", \"Should be State1\")\n        # OK Event\n        sm.InjectEvent(\"ToState2\")\n        self.assertEqual(sm.get_current_state(), \"State2\", \"Should be State2\")\n        # OK Event\n        sm.InjectEvent(\"ToState3\")\n        self.assertEqual(sm.get_current_state(), \"State3\", \"Should be State3\")\n        # OK Event\n        sm.InjectEvent(\"ToState1\")\n        self.assertEqual(sm.get_current_state(), \"State1\", \"Should be State1\")\n\n# test invalid State1 transitions\n    def test2(self):\n        \"\"\"Test Statemachine\"\"\"\n        sm = StateMachine(\"myStateMachine.xml\")\n        sm.LoadStateMachine()\n        self.assertEqual(sm.get_current_state(), \"State1\", \"Should be State1\")\n        # Invalid transition\n        sm.InjectEvent(\"ToState3\")\n        self.assertEqual(sm.get_current_state(), \"State1\", \"Should be State1\")\n\n# test invalid State2 transitions\n    def test3(self):\n        \"\"\"Test Statemachine\"\"\"\n        sm = StateMachine(\"myStateMachine.xml\")\n        sm.LoadStateMachine()\n        self.assertEqual(sm.get_current_state(), \"State1\", \"Should be State1\")\n        # OK Event\n        sm.InjectEvent(\"ToState2\")\n        self.assertEqual(sm.get_current_state(), \"State2\", \"Should be State2\")\n        # Invalid transition\n        sm.InjectEvent(\"ToState1\")\n        self.assertEqual(sm.get_current_state(), \"State2\", \"Should be State2\")\n\n# test invalid State3 transitions\n    def test4(self):\n        \"\"\"Test Statemachine\"\"\"\n        sm = StateMachine(\"myStateMachine.xml\")\n        sm.LoadStateMachine()\n        self.assertEqual(sm.get_current_state(), \"State1\", \"Should be State1\")\n        # OK Event\n        sm.InjectEvent(\"ToState2\")\n        self.assertEqual(sm.get_current_state(), \"State2\", \"Should be State2\")\n        # OK Event\n        sm.InjectEvent(\"ToState3\")\n        self.assertEqual(sm.get_current_state(), \"State3\", \"Should be State3\")\n        # Invalid transition\n        sm.InjectEvent(\"ToState2\")\n        self.assertEqual(sm.get_current_state(), \"State3\", \"Should be State3\")\n        \nif __name__ == '__main__':\n    unittest.main()\n```\nrun unit tests\n```\npython pyStateMachineUnitTest.py\n```\n\n\n## How to contribute [![GitHub contributors](https://img.shields.io/github/contributors/ZigRazor/PyStateMachine.svg)](https://GitHub.com/ZigRazor/PyStateMachine/graphs/contributors/)\nRead the [CONTRIBUTING GUIDE](https://github.com/ZigRazor/PyStateMachine/blob/main/CONTRIBUTING.md)\n\n## Hacktoberfest\n\nWe are pleased to inform you that this repository is participating in the **#Hacktoberfest**!\n\nHappy Coding!\n\n## Contact\nE-Mail : zigrazor@gmail.com\n\n[GitHub Profile](https://github.com/ZigRazor) ![Profile views](https://gpvc.arturio.dev/ZigRazor)\n\n![ZigRazor's github stats](https://github-readme-stats.vercel.app/api?username=ZigRazor\u0026show_icons=true\u0026theme=tokyonight)\n\n## Support\nTo support me just add ***Star*** the project  [![GitHub stars](https://img.shields.io/github/stars/ZigRazor/PyStateMachine.svg?style=social\u0026label=Star\u0026maxAge=2592000)](https://GitHub.com/ZigRazor/PyStateMachine/stargazers/) or ***follow me***  [![GitHub followers](https://img.shields.io/github/followers/ZigRazor.svg?style=social\u0026label=Follow\u0026maxAge=2592000)](https://github.com/ZigRazor?tab=followers)\n\nTo get updated ***watch*** the project  [![GitHub watchers](https://img.shields.io/github/watchers/ZigRazor/PyStateMachine.svg?style=social\u0026label=Watch\u0026maxAge=2592000)](https://GitHub.com/ZigRazor/PyStateMachine/watchers/)\n\n## Project Info\n\n[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=ZigRazor\u0026repo=PyStateMachine)](https://github.com/ZigRazor/PyStateMachine)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzigrazor%2Fpystatemachine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzigrazor%2Fpystatemachine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzigrazor%2Fpystatemachine/lists"}