quickie.tasks.Group
- class quickie.tasks.Group(name: str | None = None, *, aliases: Sequence[str] | None = None, private: bool = False, wraps: type | Callable | None = None, args: Sequence[Arg | str | Sequence[str]] | None = None, extra_args: bool | None = None, condition: BaseCondition | None = None, before: Sequence[Callable] | None = None, after: Sequence[Callable] | None = None, cleanup: Sequence[Callable] | None = None)
Base class for tasks that run other tasks in sequence.
- __init__(name: str | None = None, *, aliases: Sequence[str] | None = None, private: bool = False, wraps: type | Callable | None = None, args: Sequence[Arg | str | Sequence[str]] | None = None, extra_args: bool | None = None, condition: BaseCondition | None = None, before: Sequence[Callable] | None = None, after: Sequence[Callable] | None = None, cleanup: Sequence[Callable] | None = None)
Initialize the task.
- Parameters:
name – The name it can be invoked with. If not provided, it defaults to the class name.
aliases – Alternative names it can be invoked with..
wraps – The obj (class or function) where the task was defined. If not provided, and the task is not private, it defaults to the class itself.
private – Whether the task is private. If not provided, it is private if the class name starts with an underscore.
args – The arguments for the task. If not provided, it defaults to the class attribute
args.extra_args – Whether to allow extra command line arguments. If not provided, it defaults to the class attribute
extra_args.condition – The condition to check before running the task. If not provided, it defaults to the class attribute
condition.before – The tasks to run before this task. If not provided, it defaults to the class attribute
before.after – The tasks to run after this task. If not provided, it defaults to the class attribute
after.cleanup – The tasks to run at the end, even if the task, or before or after tasks fail. If not provided, it defaults to the class attribute
cleanup.
Methods
__init__([name, aliases, private, wraps, ...])Initialize the task.
add_args(parser)Add arguments to the parser.
condition_passes(*args, **kwargs)Check the condition before running the task.
full_run(*args, **kwargs)Execute the full task lifecycle and return the result of
run().get_after(*args, **kwargs)Get the tasks to run after this task.
get_before(*args, **kwargs)Get the tasks to run before this task.
get_cleanup(*args, **kwargs)Get the tasks to run after this task, even if it fails.
get_help()Get the help message of the task.
get_parser(*[, name])Get the parser for the task.
get_plain_usage()Return the usage string without ANSI escape sequences.
get_short_help()Get the short help message of the task.
get_tasks(*args, **kwargs)Get the tasks to run.
log_task_execution(*args, **kwargs)Log information about the task execution.
log_task_execution_details(*args, **kwargs)Log details about the task execution.
parse_and_run(args)Parse arguments and run the task.
parse_args(*, parser, args, extra_args)Parse arguments.
run(*args, **kwargs)Run each sub-task in definition order and return their results.
run_after(*args, **kwargs)Run the tasks after this task.
run_before(*args, **kwargs)Run the tasks before this task.
run_cleanup(*args, **kwargs)Run the tasks after this task, even if it fails.
to_info_dict(cwd)Serialise task metadata to a plain dict suitable for JSON output.
Attributes
afterTasks to run after this task.
argsArguments for the task.
beforeTasks to run before this task.
cleanupTasks to run at the end, even if the task, or before or after tasks fail.
conditionThe condition to check before running the task.
extra_argsWhether to allow extra command line arguments.
parserParser for the task.
tasksThe task classes to run.