quickie.factories

Factories for creating tasks from functions.

We can create tasks from functions using the task, script, and command decorators. Additionally, we can add arguments to the tasks using the arg decorator.

@task(
    name="hello"
    args=[
        Arg("number1", type=int, help="The first number."),
        Arg("number2", type=int, help="The second number."),
    ]
)
def sum(number1, number2):
    console.print(f"The sum is {number1 + number2}.")

@script(args=["--name"])
def sum(name="world"):
    """Docstring will be used as help text."""
    return f"echo Hello, {name}!"

@command
def compose():
    return ["docker", "compose", "up"]

Module Attributes

PartialReturnType

Used for type hinting the return type of a decorator.

DecoratorReturnType

Used for type hinting the return type of a decorator.

Functions

command(-> ~quickie.tasks.Command)

Create a command task from a function.

group(-> ~quickie.tasks.Group)

Create a group task from a function.

script(-> ~quickie.tasks.Script)

Create a script from a function.

task(-> ~quickie.tasks.Task)

Create a task from a function.

task_factory_helper(...)

Create a task class from a function.

thread_group(-> ~quickie.tasks.ThreadGroup)

Create a thread group task from a function.

Classes

CommonTaskKwargs

Common keyword arguments for task decorators.