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 pyke command. If no name is given, the function name is used. If the task uses a regex pattern option, that pattern will used and matched against args passed to pyke.

Options
  • default (bool) –

    Setting to True will set the task as default. This task will run when pyke doesn’t recieve any arguments.

  • deps (Iterable[Text]) –

    List of task names to run before the current task. Tasks that use patterns cannot be used as task dependencies.

  • pattern (Text, valid regex) –

    Regex pattern to match against args. All found matches will be passed to the task function as string arguments.

pyke.env(key: str, default: Optional[Any] = None) Any

Wrapper function for os.environ.get to 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 to None.

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.env or os.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.argv to 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