🎲 Dotflow turns an idea into flow!
Project description
Welcome to dotflow
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.
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.
Start with the basics here.
Table of Contents
Click to expand
Getting Help
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.
Getting Started
Install
To install Dotflow, run the following command from the command line:
With Pip
pip install dotflow
With Poetry
poetry add dotflow
A Simple Example
The simplest file could look like this:
from dotflow import DotFlow, action
def my_callback(*args, **kwargs):
print(args, kwargs)
@action
def my_task_x():
print("task")
@action(retry=5)
def my_task_y():
print("task")
workflow = DotFlow()
workflow.task.add(step=my_task_x, callback=my_callback)
workflow.task.add(step=my_task_y, callback=my_callback)
workflow.start()
First Steps
Import
Start with the basics, which is importing the necessary classes and methods. (DotFlow, action)
from dotflow import DotFlow, action
Callback function
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
def my_callback(*args, **kwargs):
print(args, kwargs)
Task function
Now, create the function responsible for executing your task. It's very simple; just use the 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
@action(retry=5)
def my_task_x():
print("task")
DotFlow Class
Instantiate the DotFlow class in a workflow variable to be used in the following steps. More details.
workflow = DotFlow()
Add Task
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
- Adding one step at a time:
workflow.task.add(step=my_task_x, callback=my_callback)
workflow.task.add(step=my_task_y, callback=my_callback)
- Adding multiple steps at the same time:
workflow.task.add(step=[my_task_x, my_task_y], callback=my_callback)
- Adding a step with the module path:
workflow.task.add(step="module.task.my_task_x", callback=my_callback)
Start
Finally, just execute the workflow with the following code snippet. More details
workflow.start()
CLI
Simple Start
dotflow start --step examples.cli_with_mode.simple_step
With Initial Context
dotflow start --step examples.cli_with_initial_context.simple_step --initial-context abc
With Callback
dotflow start --step examples.cli_with_callback.simple_step --callback examples.cli_with_callback.callback
With Mode
dotflow start --step examples.cli_with_mode.simple_step --mode sequential
dotflow start --step examples.cli_with_mode.simple_step --mode background
More Examples
Commit Style
- ⚙️ FEATURE
- 📝 PEP8
- 📌 ISSUE
- 🪲 BUG
- 📘 DOCS
- 📦 PyPI
- ❤️️ TEST
- ⬆️ CI/CD
- ⚠️ SECURITY
License
This project is licensed under the terms of the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dotflow-0.11.1.tar.gz.
File metadata
- Download URL: dotflow-0.11.1.tar.gz
- Upload date:
- Size: 19.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae918800a82c46247a0ca86f38bb559b63397613a06bb909273bf29edbdb60f6
|
|
| MD5 |
4478c3b4fde11c57273a458076079b52
|
|
| BLAKE2b-256 |
a3c60f8a6daa2075596d848afbc30bbe14a66307c885066f380fddc470038a6f
|
File details
Details for the file dotflow-0.11.1-py3-none-any.whl.
File metadata
- Download URL: dotflow-0.11.1-py3-none-any.whl
- Upload date:
- Size: 29.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69cdc2d081547d569d91f232310716c190616ae66baab5fe828d0fb39a4705e5
|
|
| MD5 |
4672fb36f25cd07a09f1e7f50969be33
|
|
| BLAKE2b-256 |
4e3faadd2548c9343380aa8f2e234e12ce97e372fbd3773de819f595264d02c4
|