stepfunction 0.0.3__tar.gz → 0.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {stepfunction-0.0.3/src/StepFunction.egg-info → stepfunction-0.0.4}/PKG-INFO +2 -2
- {stepfunction-0.0.3 → stepfunction-0.0.4}/README.md +1 -1
- {stepfunction-0.0.3 → stepfunction-0.0.4}/pyproject.toml +1 -1
- {stepfunction-0.0.3 → stepfunction-0.0.4/src/StepFunction.egg-info}/PKG-INFO +2 -2
- {stepfunction-0.0.3 → stepfunction-0.0.4}/src/StepFunction.egg-info/SOURCES.txt +4 -0
- {stepfunction-0.0.3 → stepfunction-0.0.4}/src/stepfunction/constants/enums.py +5 -0
- {stepfunction-0.0.3 → stepfunction-0.0.4}/src/stepfunction/core/step_function/step_function.py +8 -1
- stepfunction-0.0.4/src/stepfunction/steps/__init__.py +4 -0
- stepfunction-0.0.4/src/stepfunction/steps/base/__init__.py +3 -0
- stepfunction-0.0.4/src/stepfunction/steps/base/base_step.py +54 -0
- stepfunction-0.0.4/src/stepfunction/steps/wait_step.py +41 -0
- {stepfunction-0.0.3 → stepfunction-0.0.4}/src/stepfunction/types/step_types.py +3 -0
- {stepfunction-0.0.3 → stepfunction-0.0.4}/LICENSE +0 -0
- {stepfunction-0.0.3 → stepfunction-0.0.4}/setup.cfg +0 -0
- {stepfunction-0.0.3 → stepfunction-0.0.4}/src/StepFunction.egg-info/dependency_links.txt +0 -0
- {stepfunction-0.0.3 → stepfunction-0.0.4}/src/StepFunction.egg-info/requires.txt +0 -0
- {stepfunction-0.0.3 → stepfunction-0.0.4}/src/StepFunction.egg-info/top_level.txt +0 -0
- {stepfunction-0.0.3 → stepfunction-0.0.4}/src/stepfunction/constants/__init__.py +0 -0
- {stepfunction-0.0.3 → stepfunction-0.0.4}/src/stepfunction/constants/visualizer.py +0 -0
- {stepfunction-0.0.3 → stepfunction-0.0.4}/src/stepfunction/core/step_function/__init__.py +0 -0
- {stepfunction-0.0.3 → stepfunction-0.0.4}/src/stepfunction/core/visualizer/__init__.py +0 -0
- {stepfunction-0.0.3 → stepfunction-0.0.4}/src/stepfunction/core/visualizer/visualizer.py +0 -0
- {stepfunction-0.0.3 → stepfunction-0.0.4}/src/stepfunction/exceptions/__init__.py +0 -0
- {stepfunction-0.0.3 → stepfunction-0.0.4}/src/stepfunction/exceptions/step_errors.py +0 -0
- {stepfunction-0.0.3 → stepfunction-0.0.4}/src/stepfunction/types/__init__.py +0 -0
- {stepfunction-0.0.3 → stepfunction-0.0.4}/src/stepfunction/types/visualizer_types.py +0 -0
- {stepfunction-0.0.3 → stepfunction-0.0.4}/src/stepfunction/utils/__init__.py +0 -0
- {stepfunction-0.0.3 → stepfunction-0.0.4}/src/stepfunction/utils/constants.py +0 -0
- {stepfunction-0.0.3 → stepfunction-0.0.4}/src/stepfunction/utils/logger.py +0 -0
- {stepfunction-0.0.3 → stepfunction-0.0.4}/src/stepfunction/utils/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: stepfunction
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
4
4
|
Summary: Step Function Workflow Orchestration Library
|
|
5
5
|
Author: Vineeth Penugonda
|
|
6
6
|
License-Expression: MIT
|
|
@@ -22,7 +22,7 @@ Dynamic: license-file
|
|
|
22
22
|
# StepFunction
|
|
23
23
|
|
|
24
24
|

|
|
25
|
-

|
|
26
26
|

|
|
27
27
|
|
|
28
28
|
`StepFunction` is a Python library for orchestrating complex workflows through a step-by-step process. It allows for easy management of sequential and parallel tasks with robust error handling and branching. The library is inspired by AWS Step Functions but implemented as a Python-native solution to orchestrate workflows across any environment.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# StepFunction
|
|
2
2
|
|
|
3
3
|

|
|
4
|
-

|
|
5
5
|

|
|
6
6
|
|
|
7
7
|
`StepFunction` is a Python library for orchestrating complex workflows through a step-by-step process. It allows for easy management of sequential and parallel tasks with robust error handling and branching. The library is inspired by AWS Step Functions but implemented as a Python-native solution to orchestrate workflows across any environment.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: stepfunction
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
4
4
|
Summary: Step Function Workflow Orchestration Library
|
|
5
5
|
Author: Vineeth Penugonda
|
|
6
6
|
License-Expression: MIT
|
|
@@ -22,7 +22,7 @@ Dynamic: license-file
|
|
|
22
22
|
# StepFunction
|
|
23
23
|
|
|
24
24
|

|
|
25
|
-

|
|
26
26
|

|
|
27
27
|
|
|
28
28
|
`StepFunction` is a Python library for orchestrating complex workflows through a step-by-step process. It allows for easy management of sequential and parallel tasks with robust error handling and branching. The library is inspired by AWS Step Functions but implemented as a Python-native solution to orchestrate workflows across any environment.
|
|
@@ -20,6 +20,10 @@ src/stepfunction/core/visualizer/__init__.py
|
|
|
20
20
|
src/stepfunction/core/visualizer/visualizer.py
|
|
21
21
|
src/stepfunction/exceptions/__init__.py
|
|
22
22
|
src/stepfunction/exceptions/step_errors.py
|
|
23
|
+
src/stepfunction/steps/__init__.py
|
|
24
|
+
src/stepfunction/steps/wait_step.py
|
|
25
|
+
src/stepfunction/steps/base/__init__.py
|
|
26
|
+
src/stepfunction/steps/base/base_step.py
|
|
23
27
|
src/stepfunction/types/__init__.py
|
|
24
28
|
src/stepfunction/types/step_types.py
|
|
25
29
|
src/stepfunction/types/visualizer_types.py
|
{stepfunction-0.0.3 → stepfunction-0.0.4}/src/stepfunction/core/step_function/step_function.py
RENAMED
|
@@ -13,6 +13,7 @@ from stepfunction.exceptions.step_errors import (
|
|
|
13
13
|
ParallelStepExecutionError,
|
|
14
14
|
StepExecutionError,
|
|
15
15
|
)
|
|
16
|
+
from stepfunction.steps.base import BaseStep
|
|
16
17
|
from stepfunction.types.step_types import StepParams
|
|
17
18
|
from stepfunction.utils.logger import setup_logger
|
|
18
19
|
|
|
@@ -127,7 +128,7 @@ class StepFunction:
|
|
|
127
128
|
def add_step(
|
|
128
129
|
self,
|
|
129
130
|
name: str,
|
|
130
|
-
func: Union[Callable[[Any], Any], Dict[str, Callable[[Any], Any]]],
|
|
131
|
+
func: Union[Callable[[Any], Any], Dict[str, Callable[[Any], Any]], BaseStep],
|
|
131
132
|
next_step: Optional[str] = None,
|
|
132
133
|
on_failure: Optional[str] = None,
|
|
133
134
|
branch: Optional[Dict[Any, str]] = None,
|
|
@@ -139,6 +140,11 @@ class StepFunction:
|
|
|
139
140
|
if name in self.__steps:
|
|
140
141
|
raise ValueError(f"Step '{name}' already exists in steps")
|
|
141
142
|
|
|
143
|
+
step_type = None
|
|
144
|
+
if isinstance(func, BaseStep):
|
|
145
|
+
step_type = func.step_type
|
|
146
|
+
func = func.build()
|
|
147
|
+
|
|
142
148
|
self.__steps[name] = {
|
|
143
149
|
"func": func,
|
|
144
150
|
"next_step": next_step,
|
|
@@ -146,6 +152,7 @@ class StepFunction:
|
|
|
146
152
|
"branch": branch,
|
|
147
153
|
"parallel": parallel,
|
|
148
154
|
"stop_on_failure": stop_on_failure,
|
|
155
|
+
"step_type": step_type,
|
|
149
156
|
}
|
|
150
157
|
|
|
151
158
|
def add_sub_step_function(
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"""Base class for building custom step types.
|
|
2
|
+
|
|
3
|
+
Author: Vineeth Penugonda
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from abc import ABC, abstractmethod
|
|
7
|
+
from typing import Any, Callable
|
|
8
|
+
|
|
9
|
+
from stepfunction.constants.enums import StepType
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class BaseStep(ABC):
|
|
13
|
+
"""Abstract base class for building reusable, configurable step types.
|
|
14
|
+
|
|
15
|
+
Extend this class to create custom step types that encapsulate their own
|
|
16
|
+
logic and configuration. Pass an instance directly to ``StepFunction.add_step()``
|
|
17
|
+
— the framework will call ``build()`` automatically.
|
|
18
|
+
|
|
19
|
+
Class Attributes:
|
|
20
|
+
step_type (StepType): Marks the origin of the step.
|
|
21
|
+
- ``StepType.EXTERNAL`` (default) — user-defined step.
|
|
22
|
+
- ``StepType.INBUILT`` — provided by the stepfunction library.
|
|
23
|
+
Override this in your subclass only if you are building library steps.
|
|
24
|
+
|
|
25
|
+
Methods:
|
|
26
|
+
build(): Return the callable that the StepFunction will execute.
|
|
27
|
+
|
|
28
|
+
Example:
|
|
29
|
+
class MultiplyStep(BaseStep):
|
|
30
|
+
def __init__(self, factor: float):
|
|
31
|
+
self.factor = factor
|
|
32
|
+
|
|
33
|
+
def build(self) -> Callable:
|
|
34
|
+
async def run(input_value: Any) -> Any:
|
|
35
|
+
return input_value * self.factor
|
|
36
|
+
return run
|
|
37
|
+
|
|
38
|
+
sf.add_step("double", MultiplyStep(factor=2), next_step="next")
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
step_type: StepType = StepType.EXTERNAL
|
|
42
|
+
|
|
43
|
+
@abstractmethod
|
|
44
|
+
def build(self) -> Callable[[Any], Any]:
|
|
45
|
+
"""Return the callable that this step will execute.
|
|
46
|
+
|
|
47
|
+
The returned callable must accept a single positional argument
|
|
48
|
+
(the input value passed from the previous step) and return a value
|
|
49
|
+
that will be forwarded to the next step. It may be either a regular
|
|
50
|
+
function or a coroutine function.
|
|
51
|
+
|
|
52
|
+
Returns:
|
|
53
|
+
Callable[[Any], Any]: The step function to execute.
|
|
54
|
+
"""
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""WaitStep — a built-in step that pauses execution for a fixed interval.
|
|
2
|
+
|
|
3
|
+
Author: Vineeth Penugonda
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import asyncio
|
|
7
|
+
from typing import Any, Callable
|
|
8
|
+
|
|
9
|
+
from stepfunction.constants.enums import StepType
|
|
10
|
+
from stepfunction.steps.base import BaseStep
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class WaitStep(BaseStep):
|
|
14
|
+
"""A step that pauses workflow execution for a fixed duration.
|
|
15
|
+
|
|
16
|
+
The input value is passed through unchanged so the next step receives
|
|
17
|
+
exactly what the previous step produced.
|
|
18
|
+
|
|
19
|
+
Args:
|
|
20
|
+
duration (float): Number of seconds to wait before proceeding.
|
|
21
|
+
|
|
22
|
+
Example:
|
|
23
|
+
sf.add_step("pause", WaitStep(duration=5), next_step="next_step")
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
step_type: StepType = StepType.INBUILT
|
|
27
|
+
|
|
28
|
+
def __init__(self, duration: float):
|
|
29
|
+
if duration < 0:
|
|
30
|
+
raise ValueError("duration must be a non-negative number")
|
|
31
|
+
self.duration = duration
|
|
32
|
+
|
|
33
|
+
def build(self) -> Callable[[Any], Any]:
|
|
34
|
+
"""Return an async function that sleeps for ``duration`` seconds."""
|
|
35
|
+
duration = self.duration
|
|
36
|
+
|
|
37
|
+
async def wait(input_value: Any) -> Any:
|
|
38
|
+
await asyncio.sleep(duration)
|
|
39
|
+
return input_value
|
|
40
|
+
|
|
41
|
+
return wait
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
from typing import Any, Callable, Dict, Optional, TypedDict, Union
|
|
2
2
|
|
|
3
|
+
from stepfunction.constants.enums import StepType
|
|
4
|
+
|
|
3
5
|
|
|
4
6
|
class StepParams(TypedDict, total=False):
|
|
5
7
|
func: Callable[[Any], Any]
|
|
@@ -9,3 +11,4 @@ class StepParams(TypedDict, total=False):
|
|
|
9
11
|
parallel: bool
|
|
10
12
|
stop_on_failure: bool
|
|
11
13
|
is_sub_step_function: bool
|
|
14
|
+
step_type: Optional[StepType]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|