TaskRunner
Sub classes¶
| Name | Children | Inherits |
|---|---|---|
| CargoRunner anyenv.task_runners._cargo Task runner for Cargo (Rust) aliases and xtask. |
||
| JustRunner anyenv.task_runners._just Task runner for Just (casey/just). |
||
| MakefileRunner anyenv.task_runners._makefile Task runner for GNU Make. |
||
| PackageJsonRunner anyenv.task_runners._npm Task runner for package.json scripts. |
||
| DutyRunner anyenv.task_runners._python Task runner for Duty (pawamoy/duty). |
||
| InvokeRunner anyenv.task_runners._python Task runner for Invoke (pyinvoke.org). |
||
| DoitRunner anyenv.task_runners._python Task runner for doit (pydoit.org). |
||
| TaskfileRunner anyenv.task_runners._task Task runner for Taskfile (taskfile.dev). |
🛈 DocStrings¶
Base class for task runner configurations.
Each task runner implementation provides static metadata and implements methods for detecting, parsing, and running tasks via an ExecutionEnvironment.
Source code in src/anyenv/task_runners/_base.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
detect
async
¶
Check if this task runner is used in the given directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fs
|
AsyncFileSystem
|
Async filesystem to use for file operations |
required |
cwd
|
str
|
Directory to check for task runner config files |
required |
Source code in src/anyenv/task_runners/_base.py
get_config_file
async
¶
Get the config file path if it exists.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fs
|
AsyncFileSystem
|
Async filesystem to use for file operations |
required |
cwd
|
str
|
Directory to check |
required |
Source code in src/anyenv/task_runners/_base.py
get_run_command
¶
Get the command to run a specific task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_name
|
str
|
Name of the task to run |
required |
*args
|
str
|
Additional arguments to pass to the task |
()
|
Source code in src/anyenv/task_runners/_base.py
get_tasks
abstractmethod
async
¶
get_tasks(fs: AsyncFileSystem, cwd: str) -> list[TaskInfo]
Parse and return available tasks from the config file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fs
|
AsyncFileSystem
|
Async filesystem to use for file operations |
required |
cwd
|
str
|
Directory containing the task runner config |
required |
Source code in src/anyenv/task_runners/_base.py
is_available
¶
list_tasks_via_cli
async
¶
Get task list by running the help command.
Fallback when file parsing isn't possible (e.g., remote without file access).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
env
|
ExecutionEnvironment
|
Execution environment to run the command in |
required |
cwd
|
str | None
|
Working directory (optional) |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Raw output from the help command |
Source code in src/anyenv/task_runners/_base.py
run_task
async
¶
run_task(
env: ExecutionEnvironment, task_name: str, *args: str, cwd: str | None = None
) -> tuple[bool, str, str]
Run a specific task using the execution environment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
env
|
ExecutionEnvironment
|
Execution environment to run the command in |
required |
task_name
|
str
|
Name of the task to run |
required |
*args
|
str
|
Additional arguments to pass to the task |
()
|
cwd
|
str | None
|
Working directory (optional) |
None
|
Returns:
| Type | Description |
|---|---|
tuple[bool, str, str]
|
Tuple of (success, stdout, stderr) |