dotflow 0.10.0.dev2__tar.gz → 0.11.1.dev1__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.
Files changed (51) hide show
  1. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/PKG-INFO +134 -39
  2. dotflow-0.11.1.dev1/README.md +252 -0
  3. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/__init__.py +1 -1
  4. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/core/execution.py +8 -5
  5. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/utils/tools.py +1 -1
  6. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/pyproject.toml +2 -2
  7. dotflow-0.10.0.dev2/README.md +0 -157
  8. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/LICENSE +0 -0
  9. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/abc/__init__.py +0 -0
  10. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/abc/file.py +0 -0
  11. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/abc/http.py +0 -0
  12. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/abc/storage.py +0 -0
  13. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/abc/tcp.py +0 -0
  14. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/cli/__init__.py +0 -0
  15. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/cli/command.py +0 -0
  16. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/cli/commands/__init__.py +0 -0
  17. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/cli/commands/init.py +0 -0
  18. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/cli/commands/log.py +0 -0
  19. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/cli/commands/start.py +0 -0
  20. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/cli/setup.py +0 -0
  21. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/cli/validators/__init__.py +0 -0
  22. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/cli/validators/start.py +0 -0
  23. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/core/__init__.py +0 -0
  24. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/core/action.py +0 -0
  25. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/core/config.py +0 -0
  26. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/core/context.py +0 -0
  27. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/core/decorators/__init__.py +0 -0
  28. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/core/decorators/time.py +0 -0
  29. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/core/dotflow.py +0 -0
  30. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/core/exception.py +0 -0
  31. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/core/module.py +0 -0
  32. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/core/serializers/__init__.py +0 -0
  33. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/core/serializers/task.py +0 -0
  34. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/core/serializers/transport.py +0 -0
  35. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/core/serializers/workflow.py +0 -0
  36. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/core/task.py +0 -0
  37. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/core/types/__init__.py +0 -0
  38. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/core/types/execution.py +0 -0
  39. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/core/types/status.py +0 -0
  40. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/core/types/worflow.py +0 -0
  41. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/core/workflow.py +0 -0
  42. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/logging.py +0 -0
  43. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/main.py +0 -0
  44. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/providers/__init__.py +0 -0
  45. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/providers/storage_default.py +0 -0
  46. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/providers/storage_file.py +0 -0
  47. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/settings.py +0 -0
  48. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/storage.py +0 -0
  49. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/utils/__init__.py +0 -0
  50. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/utils/basic_functions.py +0 -0
  51. {dotflow-0.10.0.dev2 → dotflow-0.11.1.dev1}/dotflow/utils/error_handler.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: dotflow
3
- Version: 0.10.0.dev2
3
+ Version: 0.11.1.dev1
4
4
  Summary: 🎲 Dotflow turns an idea into flow!
5
5
  License: MIT License
6
6
 
@@ -45,7 +45,17 @@ Project-URL: Issues, https://github.com/dotflow-io/dotflow/issues
45
45
  Project-URL: Repository, https://github.com/dotflow-io/dotflow
46
46
  Description-Content-Type: text/markdown
47
47
 
48
- # Welcome to dotflow
48
+ <div align="center">
49
+ <a aria-label="Serverless.com" href="https://dotflow.io">Website</a>
50
+ &nbsp;•&nbsp;
51
+ <a aria-label="Dotglow Documentation" href="https://dotflow-io.github.io/dotflow/">Documentation</a>
52
+ &nbsp;•&nbsp;
53
+ <a aria-label="Pypi" href="https://pypi.org/project/dotflow/">Pypi</a>
54
+ </div>
55
+
56
+ <br/>
57
+
58
+ <div align="center">
49
59
 
50
60
  ![](https://raw.githubusercontent.com/FernandoCelmer/dotflow/master/docs/assets/dotflow.gif)
51
61
 
@@ -55,10 +65,43 @@ Description-Content-Type: text/markdown
55
65
  ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/dotflow?style=flat-square)
56
66
  ![PyPI - Downloads](https://img.shields.io/pypi/dm/dotflow?style=flat-square)
57
67
 
58
- This is a very simple library that is still in the early stages of development. The main goal of this tool is to create a simple and secure workflow for executing any type of task. The library's API design was made to make it easy to add tasks and control their execution. To keep it simple, just instantiate the `DotFlow` class, use the `add` method, and the `start` method to begin execution.
68
+ </div>
69
+
70
+ # Welcome to dotflow
71
+
72
+ With Dotflow, you get a powerful and easy-to-use library designed to create execution pipelines without complication. Add tasks intuitively and control the entire process with just a few commands.
73
+
74
+ Our goal is to make task management faster and more secure, without overwhelming you with complexity. Simply instantiate the DotFlow class, add your tasks with the `add` method, and start execution with the `start` method.
59
75
 
60
76
  Start with the basics [here](https://dotflow-io.github.io/dotflow/nav/getting-started/).
61
77
 
78
+ ## Table of Contents
79
+
80
+ <details>
81
+ <summary>Click to expand</summary>
82
+
83
+ - [Getting Help](#getting-help)
84
+ - [Getting Started](#getting-started)
85
+ - [Install](#install)
86
+ - [A Simple Example](#a-simple-example)
87
+ - [First Steps](#first-steps)
88
+ - [Import](#import)
89
+ - [Callback function](#callback-function)
90
+ - [Task function](#task-function)
91
+ - [DotFlow Class](#dotflow-class)
92
+ - [Add Task](#add-task)
93
+ - [Start](#start)
94
+ - [CLI](#cli)
95
+ - [Simple Start](#simple-start)
96
+ - [With Initial Context](#with-initial-context)
97
+ - [With Callback](#with-callback)
98
+ - [With Mode](#with-mode)
99
+ - [More Examples](#more-examples)
100
+ - [Commit Style](#commit-style)
101
+ - [License](#license)
102
+
103
+ </details>
104
+
62
105
  ## Getting Help
63
106
 
64
107
  We use GitHub issues for tracking bugs and feature requests and have limited bandwidth to address them. If you need anything, I ask you to please follow our templates for opening issues or discussions.
@@ -96,18 +139,25 @@ from dotflow import DotFlow, action
96
139
  def my_callback(*args, **kwargs):
97
140
  print(args, kwargs)
98
141
 
142
+ @action
143
+ def my_task_x():
144
+ print("task")
145
+
99
146
  @action(retry=5)
100
- def my_task():
147
+ def my_task_y():
101
148
  print("task")
102
149
 
103
150
  workflow = DotFlow()
104
- workflow.task.add(step=my_task, callback=my_callback)
151
+
152
+ workflow.task.add(step=my_task_x, callback=my_callback)
153
+ workflow.task.add(step=my_task_y, callback=my_callback)
154
+
105
155
  workflow.start()
106
156
  ```
107
157
 
108
158
  ## First Steps
109
159
 
110
- #### 1 - Import
160
+ #### Import
111
161
 
112
162
  Start with the basics, which is importing the necessary classes and methods. ([DotFlow](https://dotflow-io.github.io/dotflow/nav/reference/dotflow/), [action](https://dotflow-io.github.io/dotflow/nav/reference/action/))
113
163
 
@@ -115,7 +165,7 @@ Start with the basics, which is importing the necessary classes and methods. ([D
115
165
  from dotflow import DotFlow, action
116
166
  ```
117
167
 
118
- #### 2 - Callback function
168
+ #### Callback function
119
169
 
120
170
  Create a `my_callback` function to receive execution information of a task. `It is not necessary` to include this function, as you will still have a report at the end of the execution in the instantiated object of the `DotFlow` class. This `my_callback` function is only needed if you need to do something after the execution of the task, for example: sending a message to someone, making a phone call, or sending a letter. [More details](https://dotflow-io.github.io/dotflow/nav/reference/utils/#dotflow.utils.basic_functions.basic_callback)
121
171
 
@@ -124,17 +174,17 @@ def my_callback(*args, **kwargs):
124
174
  print(args, kwargs)
125
175
  ```
126
176
 
127
- #### 3 - Task function
177
+ #### Task function
128
178
 
129
179
  Now, create the function responsible for executing your task. It's very simple; just use the [action](https://dotflow-io.github.io/dotflow/nav/reference/action/) decorator above the function, and that's it—you've created a task. If necessary, you can also add the parameter called `retry` to set the maximum number of execution attempts if the function fails. [More details](https://dotflow-io.github.io/dotflow/nav/reference/utils/#dotflow.utils.basic_functions.basic_function)
130
180
 
131
181
  ```python
132
182
  @action(retry=5)
133
- def my_task():
183
+ def my_task_x():
134
184
  print("task")
135
185
  ```
136
186
 
137
- #### 4 - DotFlow Class
187
+ #### DotFlow Class
138
188
 
139
189
  Instantiate the DotFlow class in a `workflow` variable to be used in the following steps. [More details](https://dotflow-io.github.io/dotflow/nav/reference/dotflow/).
140
190
 
@@ -142,15 +192,30 @@ Instantiate the DotFlow class in a `workflow` variable to be used in the followi
142
192
  workflow = DotFlow()
143
193
  ```
144
194
 
145
- #### 5 - Add Task
195
+ #### Add Task
196
+
197
+ Now, simply add the `my_task_x` and `my_callback` functions you created earlier to the workflow using the code below. This process is necessary to define which tasks will be executed and the order in which they will run. The execution order follows the sequence in which they were added to the workflow. [More details](https://dotflow-io.github.io/dotflow/nav/reference/task-builder/#dotflow.core.task.TaskBuilder.add)
198
+
199
+ - Adding one step at a time:
200
+
201
+ ```python
202
+ workflow.task.add(step=my_task_x, callback=my_callback)
203
+ workflow.task.add(step=my_task_y, callback=my_callback)
204
+ ```
205
+
206
+ - Adding multiple steps at the same time:
207
+
208
+ ```python
209
+ workflow.task.add(step=[my_task_x, my_task_y], callback=my_callback)
210
+ ```
146
211
 
147
- Now, simply add the `my_task` and `my_callback` functions you created earlier to the workflow using the code below. This process is necessary to define which tasks will be executed and the order in which they will run. The execution order follows the sequence in which they were added to the workflow. [More details](https://dotflow-io.github.io/dotflow/nav/reference/task-builder/#dotflow.core.task.TaskBuilder.add)
212
+ - Adding a step with the module path:
148
213
 
149
214
  ```python
150
- workflow.task.add(step=my_task, callback=my_callback)
215
+ workflow.task.add(step="module.task.my_task_x", callback=my_callback)
151
216
  ```
152
217
 
153
- #### 6 - Start
218
+ #### Start
154
219
 
155
220
  Finally, just execute the workflow with the following code snippet. [More details](https://dotflow-io.github.io/dotflow/nav/reference/workflow/#dotflow.core.workflow.Workflow)
156
221
 
@@ -158,33 +223,63 @@ Finally, just execute the workflow with the following code snippet. [More detail
158
223
  workflow.start()
159
224
  ```
160
225
 
226
+ ## CLI
227
+
228
+ #### Simple Start
229
+
230
+ ```bash
231
+ dotflow start --step examples.cli_with_mode.simple_step
232
+ ```
233
+
234
+ #### With Initial Context
235
+
236
+ ```bash
237
+ dotflow start --step examples.cli_with_initial_context.simple_step --initial-context abc
238
+ ```
239
+
240
+ #### With Callback
241
+
242
+ ```bash
243
+ dotflow start --step examples.cli_with_callback.simple_step --callback examples.cli_with_callback.callback
244
+ ```
245
+
246
+ #### With Mode
247
+
248
+ ```bash
249
+ dotflow start --step examples.cli_with_mode.simple_step --mode sequential
250
+ ```
251
+
252
+ ```bash
253
+ dotflow start --step examples.cli_with_mode.simple_step --mode background
254
+ ```
255
+
161
256
  ## More Examples
162
257
 
163
- | | Example |
164
- |--| ---------------------------------------------------------------------------------------------------------------------------------------- |
165
- |01| [cli_with_callback](https://github.com/dotflow-io/dotflow/blob/master/examples/cli_with_callback.py) |
166
- |02| [cli_with_initial_context](https://github.com/dotflow-io/dotflow/blob/master/examples/cli_with_initial_context.py) |
167
- |03| [cli_with_mode](https://github.com/dotflow-io/dotflow/blob/master/examples/cli_with_mode.py) |
168
- |04| [cli_with_output_context](https://github.com/dotflow-io/dotflow/blob/master/examples/cli_with_output_context.py) |
169
- |05| [cli_with_path](https://github.com/dotflow-io/dotflow/blob/master/examples/cli_with_path.py) |
170
- |06| [simple_cli](https://github.com/dotflow-io/dotflow/blob/master/examples/simple_cli.py) |
171
- |07| [simple_class_workflow](https://github.com/dotflow-io/dotflow/blob/master/examples/simple_class_workflow.py) |
172
- |08| [simple_function_workflow_with_error](https://github.com/dotflow-io/dotflow/blob/master/examples/simple_function_workflow_with_error.py) |
173
- |09| [simple_function_workflow](https://github.com/dotflow-io/dotflow/blob/master/examples/simple_function_workflow.py) |
174
- |10| [step_class_result_context](https://github.com/dotflow-io/dotflow/blob/master/examples/step_class_result_context.py) |
175
- |11| [step_class_result_storage](https://github.com/dotflow-io/dotflow/blob/master/examples/step_class_result_storage.py) |
176
- |12| [step_class_result_task](https://github.com/dotflow-io/dotflow/blob/master/examples/step_class_result_task.py) |
177
- |13| [step_function_result_context](https://github.com/dotflow-io/dotflow/blob/master/examples/step_function_result_context.py) |
178
- |14| [step_function_result_storage](https://github.com/dotflow-io/dotflow/blob/master/examples/step_function_result_storage.py) |
179
- |15| [step_function_result_task](https://github.com/dotflow-io/dotflow/blob/master/examples/step_function_result_task.py) |
180
- |16| [step_with_initial_context](https://github.com/dotflow-io/dotflow/blob/master/examples/step_with_initial_context.py) |
181
- |17| [step_with_many_contexts](https://github.com/dotflow-io/dotflow/blob/master/examples/step_with_many_contexts.py) |
182
- |18| [step_with_previous_context](https://github.com/dotflow-io/dotflow/blob/master/examples/step_with_previous_context.py) |
183
- |19| [workflow_keep_going_true](https://github.com/dotflow-io/dotflow/blob/master/examples/workflow_keep_going_true.py) |
184
- |20| [workflow_step_callback](https://github.com/dotflow-io/dotflow/blob/master/examples/workflow_step_callback.py) |
185
- |21| [workflow_with_callback_failure](https://github.com/dotflow-io/dotflow/blob/master/examples/workflow_with_callback_failure.py) |
186
- |22| [workflow_with_callback_success](https://github.com/dotflow-io/dotflow/blob/master/examples/workflow_with_callback_success.py) |
187
- |23| [workflow_with_retry](https://github.com/dotflow-io/dotflow/blob/master/examples/workflow_with_retry.py) |
258
+ | | Example |
259
+ |--| -------------------------------------------------------------------------------------------------------------------------------- |
260
+ |01| [cli_with_callback](https://github.com/dotflow-io/examples/blob/master/cli_with_callback.py) |
261
+ |02| [cli_with_initial_context](https://github.com/dotflow-io/examples/blob/master/cli_with_initial_context.py) |
262
+ |03| [cli_with_mode](https://github.com/dotflow-io/examples/blob/master/cli_with_mode.py) |
263
+ |04| [cli_with_output_context](https://github.com/dotflow-io/examples/blob/master/cli_with_output_context.py) |
264
+ |05| [cli_with_path](https://github.com/dotflow-io/examples/blob/master/cli_with_path.py) |
265
+ |06| [simple_cli](https://github.com/dotflow-io/examples/blob/master/simple_cli.py) |
266
+ |07| [simple_class_workflow](https://github.com/dotflow-io/examples/blob/master/simple_class_workflow.py) |
267
+ |08| [simple_function_workflow_with_error](https://github.com/dotflow-io/examples/blob/master/simple_function_workflow_with_error.py) |
268
+ |09| [simple_function_workflow](https://github.com/dotflow-io/examples/blob/master/simple_function_workflow.py) |
269
+ |10| [step_class_result_context](https://github.com/dotflow-io/examples/blob/master/step_class_result_context.py) |
270
+ |11| [step_class_result_storage](https://github.com/dotflow-io/examples/blob/master/step_class_result_storage.py) |
271
+ |12| [step_class_result_task](https://github.com/dotflow-io/examples/blob/master/step_class_result_task.py) |
272
+ |13| [step_function_result_context](https://github.com/dotflow-io/examples/blob/master/step_function_result_context.py) |
273
+ |14| [step_function_result_storage](https://github.com/dotflow-io/examples/blob/master/step_function_result_storage.py) |
274
+ |15| [step_function_result_task](https://github.com/dotflow-io/examples/blob/master/step_function_result_task.py) |
275
+ |16| [step_with_initial_context](https://github.com/dotflow-io/examples/blob/master/step_with_initial_context.py) |
276
+ |17| [step_with_many_contexts](https://github.com/dotflow-io/examples/blob/master/step_with_many_contexts.py) |
277
+ |18| [step_with_previous_context](https://github.com/dotflow-io/examples/blob/master/step_with_previous_context.py) |
278
+ |19| [workflow_keep_going_true](https://github.com/dotflow-io/examples/blob/master/workflow_keep_going_true.py) |
279
+ |20| [workflow_step_callback](https://github.com/dotflow-io/examples/blob/master/workflow_step_callback.py) |
280
+ |21| [workflow_with_callback_failure](https://github.com/dotflow-io/examples/blob/master/workflow_with_callback_failure.py) |
281
+ |22| [workflow_with_callback_success](https://github.com/dotflow-io/examples/blob/master/workflow_with_callback_success.py) |
282
+ |23| [workflow_with_retry](https://github.com/dotflow-io/examples/blob/master/workflow_with_retry.py) |
188
283
 
189
284
  ## Commit Style
190
285
 
@@ -0,0 +1,252 @@
1
+ <div align="center">
2
+ <a aria-label="Serverless.com" href="https://dotflow.io">Website</a>
3
+ &nbsp;•&nbsp;
4
+ <a aria-label="Dotglow Documentation" href="https://dotflow-io.github.io/dotflow/">Documentation</a>
5
+ &nbsp;•&nbsp;
6
+ <a aria-label="Pypi" href="https://pypi.org/project/dotflow/">Pypi</a>
7
+ </div>
8
+
9
+ <br/>
10
+
11
+ <div align="center">
12
+
13
+ ![](https://raw.githubusercontent.com/FernandoCelmer/dotflow/master/docs/assets/dotflow.gif)
14
+
15
+ ![GitHub Org's stars](https://img.shields.io/github/stars/dotflow-io?label=Dotflow&style=flat-square)
16
+ ![GitHub last commit](https://img.shields.io/github/last-commit/dotflow-io/dotflow?style=flat-square)
17
+ ![PyPI](https://img.shields.io/pypi/v/dotflow?style=flat-square)
18
+ ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/dotflow?style=flat-square)
19
+ ![PyPI - Downloads](https://img.shields.io/pypi/dm/dotflow?style=flat-square)
20
+
21
+ </div>
22
+
23
+ # Welcome to dotflow
24
+
25
+ With Dotflow, you get a powerful and easy-to-use library designed to create execution pipelines without complication. Add tasks intuitively and control the entire process with just a few commands.
26
+
27
+ Our goal is to make task management faster and more secure, without overwhelming you with complexity. Simply instantiate the DotFlow class, add your tasks with the `add` method, and start execution with the `start` method.
28
+
29
+ Start with the basics [here](https://dotflow-io.github.io/dotflow/nav/getting-started/).
30
+
31
+ ## Table of Contents
32
+
33
+ <details>
34
+ <summary>Click to expand</summary>
35
+
36
+ - [Getting Help](#getting-help)
37
+ - [Getting Started](#getting-started)
38
+ - [Install](#install)
39
+ - [A Simple Example](#a-simple-example)
40
+ - [First Steps](#first-steps)
41
+ - [Import](#import)
42
+ - [Callback function](#callback-function)
43
+ - [Task function](#task-function)
44
+ - [DotFlow Class](#dotflow-class)
45
+ - [Add Task](#add-task)
46
+ - [Start](#start)
47
+ - [CLI](#cli)
48
+ - [Simple Start](#simple-start)
49
+ - [With Initial Context](#with-initial-context)
50
+ - [With Callback](#with-callback)
51
+ - [With Mode](#with-mode)
52
+ - [More Examples](#more-examples)
53
+ - [Commit Style](#commit-style)
54
+ - [License](#license)
55
+
56
+ </details>
57
+
58
+ ## Getting Help
59
+
60
+ We use GitHub issues for tracking bugs and feature requests and have limited bandwidth to address them. If you need anything, I ask you to please follow our templates for opening issues or discussions.
61
+
62
+ - 🐛 [Bug Report](https://github.com/dotflow-io/dotflow/issues/new/choose)
63
+ - 📕 [Documentation Issue](https://github.com/dotflow-io/dotflow/issues/new/choose)
64
+ - 🚀 [Feature Request](https://github.com/dotflow-io/dotflow/issues/new/choose)
65
+ - 💬 [General Question](https://github.com/dotflow-io/dotflow/issues/new/choose)
66
+
67
+ ## Getting Started
68
+
69
+ ### Install
70
+
71
+ To install `Dotflow`, run the following command from the command line:
72
+
73
+ **With Pip**
74
+
75
+ ```bash
76
+ pip install dotflow
77
+ ```
78
+
79
+ **With Poetry**
80
+
81
+ ```bash
82
+ poetry add dotflow
83
+ ```
84
+
85
+ ## A Simple Example
86
+
87
+ The simplest file could look like this:
88
+
89
+ ```python
90
+ from dotflow import DotFlow, action
91
+
92
+ def my_callback(*args, **kwargs):
93
+ print(args, kwargs)
94
+
95
+ @action
96
+ def my_task_x():
97
+ print("task")
98
+
99
+ @action(retry=5)
100
+ def my_task_y():
101
+ print("task")
102
+
103
+ workflow = DotFlow()
104
+
105
+ workflow.task.add(step=my_task_x, callback=my_callback)
106
+ workflow.task.add(step=my_task_y, callback=my_callback)
107
+
108
+ workflow.start()
109
+ ```
110
+
111
+ ## First Steps
112
+
113
+ #### Import
114
+
115
+ Start with the basics, which is importing the necessary classes and methods. ([DotFlow](https://dotflow-io.github.io/dotflow/nav/reference/dotflow/), [action](https://dotflow-io.github.io/dotflow/nav/reference/action/))
116
+
117
+ ```python
118
+ from dotflow import DotFlow, action
119
+ ```
120
+
121
+ #### Callback function
122
+
123
+ Create a `my_callback` function to receive execution information of a task. `It is not necessary` to include this function, as you will still have a report at the end of the execution in the instantiated object of the `DotFlow` class. This `my_callback` function is only needed if you need to do something after the execution of the task, for example: sending a message to someone, making a phone call, or sending a letter. [More details](https://dotflow-io.github.io/dotflow/nav/reference/utils/#dotflow.utils.basic_functions.basic_callback)
124
+
125
+ ```python
126
+ def my_callback(*args, **kwargs):
127
+ print(args, kwargs)
128
+ ```
129
+
130
+ #### Task function
131
+
132
+ Now, create the function responsible for executing your task. It's very simple; just use the [action](https://dotflow-io.github.io/dotflow/nav/reference/action/) decorator above the function, and that's it—you've created a task. If necessary, you can also add the parameter called `retry` to set the maximum number of execution attempts if the function fails. [More details](https://dotflow-io.github.io/dotflow/nav/reference/utils/#dotflow.utils.basic_functions.basic_function)
133
+
134
+ ```python
135
+ @action(retry=5)
136
+ def my_task_x():
137
+ print("task")
138
+ ```
139
+
140
+ #### DotFlow Class
141
+
142
+ Instantiate the DotFlow class in a `workflow` variable to be used in the following steps. [More details](https://dotflow-io.github.io/dotflow/nav/reference/dotflow/).
143
+
144
+ ```python
145
+ workflow = DotFlow()
146
+ ```
147
+
148
+ #### Add Task
149
+
150
+ Now, simply add the `my_task_x` and `my_callback` functions you created earlier to the workflow using the code below. This process is necessary to define which tasks will be executed and the order in which they will run. The execution order follows the sequence in which they were added to the workflow. [More details](https://dotflow-io.github.io/dotflow/nav/reference/task-builder/#dotflow.core.task.TaskBuilder.add)
151
+
152
+ - Adding one step at a time:
153
+
154
+ ```python
155
+ workflow.task.add(step=my_task_x, callback=my_callback)
156
+ workflow.task.add(step=my_task_y, callback=my_callback)
157
+ ```
158
+
159
+ - Adding multiple steps at the same time:
160
+
161
+ ```python
162
+ workflow.task.add(step=[my_task_x, my_task_y], callback=my_callback)
163
+ ```
164
+
165
+ - Adding a step with the module path:
166
+
167
+ ```python
168
+ workflow.task.add(step="module.task.my_task_x", callback=my_callback)
169
+ ```
170
+
171
+ #### Start
172
+
173
+ Finally, just execute the workflow with the following code snippet. [More details](https://dotflow-io.github.io/dotflow/nav/reference/workflow/#dotflow.core.workflow.Workflow)
174
+
175
+ ```python
176
+ workflow.start()
177
+ ```
178
+
179
+ ## CLI
180
+
181
+ #### Simple Start
182
+
183
+ ```bash
184
+ dotflow start --step examples.cli_with_mode.simple_step
185
+ ```
186
+
187
+ #### With Initial Context
188
+
189
+ ```bash
190
+ dotflow start --step examples.cli_with_initial_context.simple_step --initial-context abc
191
+ ```
192
+
193
+ #### With Callback
194
+
195
+ ```bash
196
+ dotflow start --step examples.cli_with_callback.simple_step --callback examples.cli_with_callback.callback
197
+ ```
198
+
199
+ #### With Mode
200
+
201
+ ```bash
202
+ dotflow start --step examples.cli_with_mode.simple_step --mode sequential
203
+ ```
204
+
205
+ ```bash
206
+ dotflow start --step examples.cli_with_mode.simple_step --mode background
207
+ ```
208
+
209
+ ## More Examples
210
+
211
+ | | Example |
212
+ |--| -------------------------------------------------------------------------------------------------------------------------------- |
213
+ |01| [cli_with_callback](https://github.com/dotflow-io/examples/blob/master/cli_with_callback.py) |
214
+ |02| [cli_with_initial_context](https://github.com/dotflow-io/examples/blob/master/cli_with_initial_context.py) |
215
+ |03| [cli_with_mode](https://github.com/dotflow-io/examples/blob/master/cli_with_mode.py) |
216
+ |04| [cli_with_output_context](https://github.com/dotflow-io/examples/blob/master/cli_with_output_context.py) |
217
+ |05| [cli_with_path](https://github.com/dotflow-io/examples/blob/master/cli_with_path.py) |
218
+ |06| [simple_cli](https://github.com/dotflow-io/examples/blob/master/simple_cli.py) |
219
+ |07| [simple_class_workflow](https://github.com/dotflow-io/examples/blob/master/simple_class_workflow.py) |
220
+ |08| [simple_function_workflow_with_error](https://github.com/dotflow-io/examples/blob/master/simple_function_workflow_with_error.py) |
221
+ |09| [simple_function_workflow](https://github.com/dotflow-io/examples/blob/master/simple_function_workflow.py) |
222
+ |10| [step_class_result_context](https://github.com/dotflow-io/examples/blob/master/step_class_result_context.py) |
223
+ |11| [step_class_result_storage](https://github.com/dotflow-io/examples/blob/master/step_class_result_storage.py) |
224
+ |12| [step_class_result_task](https://github.com/dotflow-io/examples/blob/master/step_class_result_task.py) |
225
+ |13| [step_function_result_context](https://github.com/dotflow-io/examples/blob/master/step_function_result_context.py) |
226
+ |14| [step_function_result_storage](https://github.com/dotflow-io/examples/blob/master/step_function_result_storage.py) |
227
+ |15| [step_function_result_task](https://github.com/dotflow-io/examples/blob/master/step_function_result_task.py) |
228
+ |16| [step_with_initial_context](https://github.com/dotflow-io/examples/blob/master/step_with_initial_context.py) |
229
+ |17| [step_with_many_contexts](https://github.com/dotflow-io/examples/blob/master/step_with_many_contexts.py) |
230
+ |18| [step_with_previous_context](https://github.com/dotflow-io/examples/blob/master/step_with_previous_context.py) |
231
+ |19| [workflow_keep_going_true](https://github.com/dotflow-io/examples/blob/master/workflow_keep_going_true.py) |
232
+ |20| [workflow_step_callback](https://github.com/dotflow-io/examples/blob/master/workflow_step_callback.py) |
233
+ |21| [workflow_with_callback_failure](https://github.com/dotflow-io/examples/blob/master/workflow_with_callback_failure.py) |
234
+ |22| [workflow_with_callback_success](https://github.com/dotflow-io/examples/blob/master/workflow_with_callback_success.py) |
235
+ |23| [workflow_with_retry](https://github.com/dotflow-io/examples/blob/master/workflow_with_retry.py) |
236
+
237
+ ## Commit Style
238
+
239
+ - ⚙️ FEATURE
240
+ - 📝 PEP8
241
+ - 📌 ISSUE
242
+ - 🪲 BUG
243
+ - 📘 DOCS
244
+ - 📦 PyPI
245
+ - ❤️️ TEST
246
+ - ⬆️ CI/CD
247
+ - ⚠️ SECURITY
248
+
249
+ ## License
250
+ ![GitHub License](https://img.shields.io/github/license/dotflow-io/dotflow)
251
+
252
+ This project is licensed under the terms of the MIT License.
@@ -1,6 +1,6 @@
1
1
  """Dotflow __init__ module."""
2
2
 
3
- __version__ = "0.10.0.dev2"
3
+ __version__ = "0.11.1.dev1"
4
4
  __description__ = "🎲 Dotflow turns an idea into flow!"
5
5
 
6
6
  from .core.action import Action as action
@@ -53,11 +53,14 @@ class Execution:
53
53
  self._excution()
54
54
 
55
55
  def _is_action(self, class_instance: Callable, func: Callable):
56
- return (
57
- callable(getattr(class_instance, func))
58
- and not func.startswith("__")
59
- and getattr(class_instance, func).__module__ is Action.__module__
60
- )
56
+ try:
57
+ return (
58
+ callable(getattr(class_instance, func))
59
+ and getattr(class_instance, func).__module__ is Action.__module__
60
+ and not func.startswith("__")
61
+ )
62
+ except AttributeError:
63
+ return False
61
64
 
62
65
  def _execution_orderer(
63
66
  self,
@@ -37,7 +37,7 @@ def write_file(
37
37
  def read_file(
38
38
  path: Path,
39
39
  encoding: str = "utf-8"
40
- ) -> Any | None:
40
+ ) -> Any:
41
41
  """Read file"""
42
42
  if path.exists():
43
43
  with open(file=path, mode="r", encoding=encoding) as file:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "dotflow"
3
- version = "0.10.0.dev2"
3
+ version = "0.11.1.dev1"
4
4
  authors = [
5
5
  { name="Fernando Celmer", email="email@fernandocelmer.com" },
6
6
  ]
@@ -35,7 +35,7 @@ mongodb = ["dotflow-mongodb"]
35
35
 
36
36
  [tool.poetry]
37
37
  name = "dotflow"
38
- version = "0.10.0.dev2"
38
+ version = "0.11.1.dev1"
39
39
  description = "🎲 Dotflow turns an idea into flow!"
40
40
  authors = ["Fernando Celmer <email@fernandocelmer.com>"]
41
41
  readme = "README.md"
@@ -1,157 +0,0 @@
1
- # Welcome to dotflow
2
-
3
- ![](https://raw.githubusercontent.com/FernandoCelmer/dotflow/master/docs/assets/dotflow.gif)
4
-
5
- ![GitHub Org's stars](https://img.shields.io/github/stars/dotflow-io?label=Dotflow&style=flat-square)
6
- ![GitHub last commit](https://img.shields.io/github/last-commit/dotflow-io/dotflow?style=flat-square)
7
- ![PyPI](https://img.shields.io/pypi/v/dotflow?style=flat-square)
8
- ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/dotflow?style=flat-square)
9
- ![PyPI - Downloads](https://img.shields.io/pypi/dm/dotflow?style=flat-square)
10
-
11
- This is a very simple library that is still in the early stages of development. The main goal of this tool is to create a simple and secure workflow for executing any type of task. The library's API design was made to make it easy to add tasks and control their execution. To keep it simple, just instantiate the `DotFlow` class, use the `add` method, and the `start` method to begin execution.
12
-
13
- Start with the basics [here](https://dotflow-io.github.io/dotflow/nav/getting-started/).
14
-
15
- ## Getting Help
16
-
17
- We use GitHub issues for tracking bugs and feature requests and have limited bandwidth to address them. If you need anything, I ask you to please follow our templates for opening issues or discussions.
18
-
19
- - 🐛 [Bug Report](https://github.com/dotflow-io/dotflow/issues/new/choose)
20
- - 📕 [Documentation Issue](https://github.com/dotflow-io/dotflow/issues/new/choose)
21
- - 🚀 [Feature Request](https://github.com/dotflow-io/dotflow/issues/new/choose)
22
- - 💬 [General Question](https://github.com/dotflow-io/dotflow/issues/new/choose)
23
-
24
- ## Getting Started
25
-
26
- ### Install
27
-
28
- To install `Dotflow`, run the following command from the command line:
29
-
30
- **With Pip**
31
-
32
- ```bash
33
- pip install dotflow
34
- ```
35
-
36
- **With Poetry**
37
-
38
- ```bash
39
- poetry add dotflow
40
- ```
41
-
42
- ## A Simple Example
43
-
44
- The simplest file could look like this:
45
-
46
- ```python
47
- from dotflow import DotFlow, action
48
-
49
- def my_callback(*args, **kwargs):
50
- print(args, kwargs)
51
-
52
- @action(retry=5)
53
- def my_task():
54
- print("task")
55
-
56
- workflow = DotFlow()
57
- workflow.task.add(step=my_task, callback=my_callback)
58
- workflow.start()
59
- ```
60
-
61
- ## First Steps
62
-
63
- #### 1 - Import
64
-
65
- Start with the basics, which is importing the necessary classes and methods. ([DotFlow](https://dotflow-io.github.io/dotflow/nav/reference/dotflow/), [action](https://dotflow-io.github.io/dotflow/nav/reference/action/))
66
-
67
- ```python
68
- from dotflow import DotFlow, action
69
- ```
70
-
71
- #### 2 - Callback function
72
-
73
- Create a `my_callback` function to receive execution information of a task. `It is not necessary` to include this function, as you will still have a report at the end of the execution in the instantiated object of the `DotFlow` class. This `my_callback` function is only needed if you need to do something after the execution of the task, for example: sending a message to someone, making a phone call, or sending a letter. [More details](https://dotflow-io.github.io/dotflow/nav/reference/utils/#dotflow.utils.basic_functions.basic_callback)
74
-
75
- ```python
76
- def my_callback(*args, **kwargs):
77
- print(args, kwargs)
78
- ```
79
-
80
- #### 3 - Task function
81
-
82
- Now, create the function responsible for executing your task. It's very simple; just use the [action](https://dotflow-io.github.io/dotflow/nav/reference/action/) decorator above the function, and that's it—you've created a task. If necessary, you can also add the parameter called `retry` to set the maximum number of execution attempts if the function fails. [More details](https://dotflow-io.github.io/dotflow/nav/reference/utils/#dotflow.utils.basic_functions.basic_function)
83
-
84
- ```python
85
- @action(retry=5)
86
- def my_task():
87
- print("task")
88
- ```
89
-
90
- #### 4 - DotFlow Class
91
-
92
- Instantiate the DotFlow class in a `workflow` variable to be used in the following steps. [More details](https://dotflow-io.github.io/dotflow/nav/reference/dotflow/).
93
-
94
- ```python
95
- workflow = DotFlow()
96
- ```
97
-
98
- #### 5 - Add Task
99
-
100
- Now, simply add the `my_task` and `my_callback` functions you created earlier to the workflow using the code below. This process is necessary to define which tasks will be executed and the order in which they will run. The execution order follows the sequence in which they were added to the workflow. [More details](https://dotflow-io.github.io/dotflow/nav/reference/task-builder/#dotflow.core.task.TaskBuilder.add)
101
-
102
- ```python
103
- workflow.task.add(step=my_task, callback=my_callback)
104
- ```
105
-
106
- #### 6 - Start
107
-
108
- Finally, just execute the workflow with the following code snippet. [More details](https://dotflow-io.github.io/dotflow/nav/reference/workflow/#dotflow.core.workflow.Workflow)
109
-
110
- ```python
111
- workflow.start()
112
- ```
113
-
114
- ## More Examples
115
-
116
- | | Example |
117
- |--| ---------------------------------------------------------------------------------------------------------------------------------------- |
118
- |01| [cli_with_callback](https://github.com/dotflow-io/dotflow/blob/master/examples/cli_with_callback.py) |
119
- |02| [cli_with_initial_context](https://github.com/dotflow-io/dotflow/blob/master/examples/cli_with_initial_context.py) |
120
- |03| [cli_with_mode](https://github.com/dotflow-io/dotflow/blob/master/examples/cli_with_mode.py) |
121
- |04| [cli_with_output_context](https://github.com/dotflow-io/dotflow/blob/master/examples/cli_with_output_context.py) |
122
- |05| [cli_with_path](https://github.com/dotflow-io/dotflow/blob/master/examples/cli_with_path.py) |
123
- |06| [simple_cli](https://github.com/dotflow-io/dotflow/blob/master/examples/simple_cli.py) |
124
- |07| [simple_class_workflow](https://github.com/dotflow-io/dotflow/blob/master/examples/simple_class_workflow.py) |
125
- |08| [simple_function_workflow_with_error](https://github.com/dotflow-io/dotflow/blob/master/examples/simple_function_workflow_with_error.py) |
126
- |09| [simple_function_workflow](https://github.com/dotflow-io/dotflow/blob/master/examples/simple_function_workflow.py) |
127
- |10| [step_class_result_context](https://github.com/dotflow-io/dotflow/blob/master/examples/step_class_result_context.py) |
128
- |11| [step_class_result_storage](https://github.com/dotflow-io/dotflow/blob/master/examples/step_class_result_storage.py) |
129
- |12| [step_class_result_task](https://github.com/dotflow-io/dotflow/blob/master/examples/step_class_result_task.py) |
130
- |13| [step_function_result_context](https://github.com/dotflow-io/dotflow/blob/master/examples/step_function_result_context.py) |
131
- |14| [step_function_result_storage](https://github.com/dotflow-io/dotflow/blob/master/examples/step_function_result_storage.py) |
132
- |15| [step_function_result_task](https://github.com/dotflow-io/dotflow/blob/master/examples/step_function_result_task.py) |
133
- |16| [step_with_initial_context](https://github.com/dotflow-io/dotflow/blob/master/examples/step_with_initial_context.py) |
134
- |17| [step_with_many_contexts](https://github.com/dotflow-io/dotflow/blob/master/examples/step_with_many_contexts.py) |
135
- |18| [step_with_previous_context](https://github.com/dotflow-io/dotflow/blob/master/examples/step_with_previous_context.py) |
136
- |19| [workflow_keep_going_true](https://github.com/dotflow-io/dotflow/blob/master/examples/workflow_keep_going_true.py) |
137
- |20| [workflow_step_callback](https://github.com/dotflow-io/dotflow/blob/master/examples/workflow_step_callback.py) |
138
- |21| [workflow_with_callback_failure](https://github.com/dotflow-io/dotflow/blob/master/examples/workflow_with_callback_failure.py) |
139
- |22| [workflow_with_callback_success](https://github.com/dotflow-io/dotflow/blob/master/examples/workflow_with_callback_success.py) |
140
- |23| [workflow_with_retry](https://github.com/dotflow-io/dotflow/blob/master/examples/workflow_with_retry.py) |
141
-
142
- ## Commit Style
143
-
144
- - ⚙️ FEATURE
145
- - 📝 PEP8
146
- - 📌 ISSUE
147
- - 🪲 BUG
148
- - 📘 DOCS
149
- - 📦 PyPI
150
- - ❤️️ TEST
151
- - ⬆️ CI/CD
152
- - ⚠️ SECURITY
153
-
154
- ## License
155
- ![GitHub License](https://img.shields.io/github/license/dotflow-io/dotflow)
156
-
157
- This project is licensed under the terms of the MIT License.
File without changes