Registry / aws / stepfunctions

stepfunctions

JSON →
library2.3.0pypypiunverified

The AWS Step Functions Data Science SDK is an open-source Python library that allows data scientists to easily create, visualize, and execute machine learning (ML) workflows using Amazon SageMaker and AWS Step Functions. It enables the orchestration of AWS infrastructure at scale directly from Python code or Jupyter notebooks, abstracting away the need to provision and integrate AWS services separately. The library is currently at version 2.3.0 and maintains an active development and release cadence, with several updates per year.

pip install stepfunctions
INSTALL
IMPORT
SIG · STEPFUNCTIONS
S
stepfunctions
awspythonv2.3.0
Install
30ms avg
Import
Disk
425MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.3.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.940 runs
installs and imports cleanly · install 0.0s · import 0.000s · 414.5MB
glibc
py 3.103.940 runs
timeout
425MB installed
● package 425MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Workflow
from stepfunctions.workflow import Workflow
steps
from stepfunctions import steps
ExecutionInput
from stepfunctions.inputs import ExecutionInput
TrainingStep
from stepfunctions.steps.sagemaker import TrainingStep
from stepfunctions.steps import TrainingStep
SageMaker-specific steps are located in the `stepfunctions.steps.sagemaker` submodule.

This quickstart demonstrates how to define a simple Pass state, chain it into a workflow, create the workflow on AWS Step Functions, and then execute it with sample input. It includes placeholders for AWS IAM roles and credentials, which must be configured in your environment or AWS CLI for actual deployment and execution.

import os from stepfunctions.workflow import Workflow from stepfunctions.steps import Pass, Chain # Dummy AWS credentials for local testing/placeholder - replace with actual credentials/roles in production # Ensure your environment has AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN (optional) and AWS_REGION set # or your ~/.aws/credentials and ~/.aws/config are configured. # For actual deployment, you'd typically use an IAM role. # Define a simple Pass state pass_step = Pass( state_id='MyPassState', parameters={ 'input_data.$': '$' } ) # Create a workflow workflow = Workflow( name='MySimpleWorkflow', definition=pass_step, role=os.environ.get('STEPFUNCTIONS_EXECUTION_ROLE_ARN', 'arn:aws:iam::123456789012:role/FakeStepFunctionsExecutionRole') # Replace with your IAM Role ARN ) try: # Create the workflow on AWS Step Functions workflow.create() print(f"Workflow '{workflow.name}' created successfully.") # Execute the workflow with sample input execution = workflow.execute(inputs={'message': 'Hello from Step Functions SDK!'}) print(f"Workflow execution started with ARN: {execution.execution_arn}") # Wait for execution to complete and print output execution.wait_for_completion() print(f"Execution finished. Output: {execution.get_output()}") # Clean up (optional, for real workflows, you might not delete immediately) # workflow.delete() # print(f"Workflow '{workflow.name}' deleted.") except Exception as e: print(f"An error occurred: {e}") print("Please ensure your AWS credentials are configured and the IAM role ARN is valid and has necessary permissions.") print("You can define the IAM role ARN as an environment variable STEPFUNCTIONS_EXECUTION_ROLE_ARN.")
Debug
Known issues
breakingVersion 2.0.0 dropped support for Python 2. Projects must use Python 3 or newer.
fix
Upgrade your Python environment to version 3.x.
affects: >=2.0.0
breakingWith version 2.0.0, if your project uses the Amazon SageMaker Python SDK, it must be upgraded to version 2.x or later.
fix
Upgrade `sagemaker` to version 2.x (`pip install sagemaker --upgrade`). Consult the SageMaker Python SDK v2 migration guide for detailed breaking changes.
affects: >=2.0.0
breakingFor `TrainingStep` and `TuningStep`, `sagemaker.session.s3_input` has been renamed to `sagemaker.inputs.TrainingInput` in SageMaker SDK v2.
fix
Update import statements and usage of `sagemaker.session.s3_input` to `sagemaker.inputs.TrainingInput` when passing data to `TrainingStep` or `TuningStep`.
affects: >=2.0.0
gotchaPrior to v2.3.0, placeholder hyperparameters passed to `TrainingStep` could be overwritten or not correctly applied if also specified in the estimator definition.
fix
Upgrade to version 2.3.0 or later to ensure proper handling of placeholder hyperparameters in `TrainingStep`. Review how hyperparameters are defined and passed to avoid conflicts.
affects: <2.3.0
gotchaIAM permissions are a frequent source of errors. Step Functions requires an execution role with permissions to invoke target services (e.g., SageMaker, Lambda, Glue) and manage workflow executions. Ensure granular permissions are granted.
fix
Carefully review the IAM role associated with your Step Functions workflow. Grant only the necessary permissions (Least Privilege Principle) for each service API call within your state machine steps. Common errors include missing `sagemaker:CreateTrainingJob`, `lambda:InvokeFunction`, etc. For `DynamoDb` errors, ensure the service prefix is in PascalCase (e.g., `DynamoDb.ResourceInUseException`) for catch definitions.
affects: All
gotchaThe `States.ALL` error catcher in Step Functions does not catch all errors; specifically, `States.DataLimitExceeded` is a terminal error that cannot be caught.
fix
Be aware that `States.ALL` will handle most but not all exceptions. Plan for `States.DataLimitExceeded` to cause a workflow failure, and design workflows to prevent it where possible (e.g., by managing payload sizes).
affects: All
Upgrade
Version history
2.3.0latest on PyPI · released Jan 24, 2022
Audit
Dependencies
sagemakeroptionalRequired for SageMaker-specific steps (e.g., TrainingStep, ProcessingStep). Can be installed as an extra to avoid heavy dependencies if not used.
Agent activity
25 hits · last 30 days
node
22
OpenAI (training)
1
Resources
stepfunctions — pip install stepfunctions · libregistry