solid
A state machine implementation for Python — which isn’t solely designed to parse strings!
why state machines?
They’re cool! Also, easy to reason about — a state machine design enables you to compartmentalize responsibilites in a way that functions simply don’t.
why “solid”?
It’s a convoluted name: it’s a state machine library written in python; snake is another word for python that sounds like state — and Solid Snake is a fairly well known character who kicks serious butt. Thus, “solid”.
hello, world
Let’s define a super-simple state machine with two states: one that prints “Hello” and one that prints “World”:
from solid.machines import BaseMachine
from solid.states import BaseState, is_entry_state
from solid.transition import to
class HelloMachine(BaseMachine):
@is_entry_state
class Hello(BaseState):
def body(self):
print "Hello"
return to(HelloMachine.World)
class World(BaseState):
def body(self):
print "World"
From an intertpreter (or whatever):
>>> h = HelloMachine()
>>> h.start()
Hello
World
>>>
and that’s pretty much all there is to it.
Metadata
Release files for solid 0.2.0
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 | |
|---|---|---|---|---|
| solid-0.2.0.tar.gz | 6.7 kB | Without provenance | Details |
Release files / solid-0.2.0.tar.gz
| Download URL | solid-0.2.0.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
93eaf438c38175f429bdadaf0122fc06fd71e39f76fb96261215c2b824db560e
|
|
BLAKE2b-256 checksum How to use checksums |
34afb9645f5120d93452ad356f23f9d209063c7fcfe780e3cc4c3ac36e707d35
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for solid 0.2.0
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.