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", bind=True)
@arg("number1", type=int, help="The first number.")
@arg("number2", type=int, help="The second number.")
def sum(task, number1, number2):
    task.console.print(f"The sum is {number1 + number2}.")

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

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

Functions

arg(*name_or_flags[, completer])

Used to add arguments to the arguments parser of a task.

command()

Create a command task from a function.

generic_task_factory()

Create a task class from a function.

group()

Create a group task from a function.

script()

Create a script from a function.

task()

Create a task from a function.

thread_group()

Create a thread group task from a function.