Conditions
Conditions are used to determine if a task should run or not. They can be chained together with logical operators to create complex conditions.
Logical operators:
&for AND|for OR~for NOT^for XOR
from quickie import task, conditions
@task(condition=conditions.FirstRun() & conditions.PathsExist("file1", "file2"))
def some_task():
print("This task will run only the first time and if both files exist.")
You can use built-in conditions from quickie.conditions or create your own by subclassing quickie.conditions.base.BaseCondition and
implementing the quickie.conditions.base.BaseCondition.__call__() method, which should return True if the condition passes, False otherwise.
Additionally the quickie.conditions.base.BaseCondition.__call__() must accept the task as an argument, and the arguments passed to the task.
You can also use the quickie.conditions.condition() decorator to create a condition from a function.
Builtin conditions:
quickie.conditions.All- Accepts other conditions and returns True if all of them pass. This is a shortcut for using the & operator.quickie.conditions.FirstRun- Returns True if the task has not been run before. Optionally checks if it has been run with the same arguments.quickie.conditions.FilesModified- Returns True if any of the files have been modified since the last run. Accepts folder, and excluding files.quickie.conditions.PathsExist- Returns True if all the paths exist.