API Usage
- pyke.task(*args, **options: Any) Callable
Function decorator to create a Pykefile task with a name and certain options.
- Parameters
name (Text, optional) – Name of the task to be called from the
pykecommand. If no name is given, the function name is used. If the task uses a regexpatternoption, that pattern will used and matched against args passed topyke.- Options
- default (
bool) – Setting to
Truewill set the task as default. This task will run whenpykedoesn’t recieve any arguments.
- default (
- deps (
Iterable[Text]) – List of task names to run before the current task. Tasks that use patterns cannot be used as task dependencies.
- deps (
- pattern (
Text, valid regex) – Regex pattern to match against args. All found matches will be passed to the task function as string arguments.
- pattern (
- pyke.env(key: str, default: Optional[Any] = None) Any
Wrapper function for
os.environ.getto access enviornment variables in your tasks.- Parameters
key (
Text) – Dictionary key to get.default (
Any, optional) – Value to return if key isn’t found. Defaults toNone.
- Return type
Any
- pyke.export(**kv: Any) Union[Any, NoReturn]
Sets given mapping of keyword arguments as enviornment variables that can be accessed from
pyke.envoros.environ. Uses OS independent method to set env vars in running process.- Return type
Union[Any, NoReturn]
- pyke.run() NoReturn
Starts the Pykefile runner and parses
sys.argvto run specified tasks. Should only be run after all tasks have been specified.- Return type
NoReturn
- pyke.shell(cmd: str) subprocess.CompletedProcess
Wrapper function for
subprocess.run. Runs given command in the shell and returns the completed process.- Parameters
cmd (
Text) – Command to run in the shell.- Return type
subprocess.CompletedProcess