stairstep
StairStep is a Pythonic API for designing AWS Step Functions using Amazon's State Language
Instead of hand crafting JSON, StairStep allows you define step functions using Python code which allows you to easily import information from outside sources and dynamically create step functions on the fly.
Development Progress / Coverage
| Lanuage Feature | Type | Progress |
|---|---|---|
| State | Pass | ✅ |
| State | Task | ✅ |
| State | Succeed | ✅ |
| State | Fail | ✅ |
| State | Choice | ✅ |
| Field | Common Validations | ✅ |
| State | Wait | Next 🛣 |
| State | Parallel | Next 🛣 |
Examples
Hello World
Using the example from the Amazon's State Language page
{
"Comment": "A simple minimal example of the States language",
"StartAt": "Hello World",
"States": {
"Hello World": {
"Type": "Task",
"Resource": "arn:aws:lambda:us-east-1:123456789012:function:HelloWorld",
"End": true
}
}
}
We can easily craft that in StairStep as follows
# Create a parent StairStep object
ss = StairStep(comment="A simple minimal example of the States language", startAt="Hello World")
# Create the HelloWorld step
StateTask(name="Hello World", resource="arn:aws:lambda:us-east-1:123456789012:function:HelloWorld", end=True)
# Add the step into the StairStep object
ss.addState(hello)
# Create the Amazon State Language Export
ss.json()
{
"Comment":"A simple minimal example of the States language",
"StartAt":"Hello World",
"States":{
"Hello World":{
"Type":"Task",
"Resource":"arn:aws:lambda:us-east-1:123456789012:function:HelloWorld",
"End":true
}
}
}
Complex Choice State
ss = StairStep(
comment = "Example Choice State",
startAt = "ChoiceStateX"
)
# Create a ChoiceRule, which is composed of choice expression(s)
# This checks to see if the variable $.type is not "Private"
typeNotPrivate = ChoiceRule(operator="Not", snext="Public", conditions=
ChoiceExpression(operator="StringEquals", variable="$.type", value="Private")
)
# This checks to see if the value of $.value is >=20 or <30
valueInTwenties = ChoiceRule(operator="And", snext="ValueInTwenties", conditions=
[
ChoiceExpression(operator="NumericGreaterThanEquals", variable="$.value", value=20),
ChoiceExpression(operator="NumericLessThan", variable="$.value", value=30)
]
)
state = StateChoice(name="ChoiceStateX", choices=[typeNotPrivate,valueInTwenties],default="DefaultState")
default = StatePass(name="DefaultState", end=True)
in_twenties = StatePass(name="ValueInTwenties", end=True)
public = StatePass(name="Public", end=True)
ss.addState(state)
ss.addState(in_twenties)
ss.addState(public)
ss.addState(default)
ss.json()
{
"Comment": "Example Choice State",
"StartAt": "ChoiceStateX",
"States": {
"ChoiceStateX": {
"Type": "Choice",
"Default": "DefaultState",
"Choices": [{
"Next": "Public",
"Not": {
"Variable": "$.type",
"StringEquals": "Private"
}
}, {
"Next": "ValueInTwenties",
"And": [{
"Variable": "$.value",
"NumericGreaterThanEquals": 20
}, {
"Variable": "$.value",
"NumericLessThan": 30
}]
}]
},
"ValueInTwenties": {
"Type": "Pass",
"End": true
},
"Public": {
"Type": "Pass",
"End": true
},
"DefaultState": {
"Type": "Pass",
"End": true
}
}
}
Metadata
Release files for stairstep 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 | Actions |
|---|---|---|---|---|
| stairstep-0.1.tar.gz | 8.5 kB | Without provenance | Details for stairstep-0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| stairstep-0.1-py3-none-any.whl | Python 3 | none | any | Details for stairstep-0.1-py3-none-any.whl |
Total release size: 18.9 kB
Release files / stairstep-0.1.tar.gz
| Download URL | stairstep-0.1.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
76657982fe09b9521e95860b6debfa67472eaf002c97210f32d4bffcca0aceba
|
|
BLAKE2b-256 checksum How to use checksums |
51dff6790b7ebfa53f63e464297234ee9be9e75204f8a6be3749a8b42af3c934
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.4
|
Release files / stairstep-0.1-py3-none-any.whl
| Download URL | stairstep-0.1-py3-none-any.whl |
|---|---|
| Size | 10.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
509171dd1e3d81ed054915964b240e05e7b3a165aa8f5416f7c82c1a5f1e5830
|
|
BLAKE2b-256 checksum How to use checksums |
b9e9f63f22d8abcf20200c5b88f32ae0f9485302c802ab709fa947e87cc0d23c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.4
|
Security for stairstep 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.