quickie.factories.script

quickie.factories.script(obj: Callable[[...], str]) Script
quickie.factories.script(*, executable: str | None = None, env: dict[str, str] | None = None, env_file: str | None = None, wd: str | None = None, expected_exit_codes: Sequence[int] | None | UseDefault = USE_DEFAULT, timeout: float | None | UseDefault = USE_DEFAULT, retries: int | UseDefault = USE_DEFAULT, retry_delay: float | UseDefault = USE_DEFAULT, output_mode: OutputModeT | UseDefault = USE_DEFAULT, **kwargs: Unpack[CommonTaskKwargs]) PartialReturnType[Script]

Create a script from a function.

@script(name="hello", bind=True)
def hello_script(task):
    return "echo Hello, script!"

@script
def hello_world():
    """Docstring will be used as help text."""
    return "echo Hello, world!"
Parameters:
  • obj – The function to create the script from.

  • executable – The executable to use for the script.

  • env – The environment variables for the script.

  • env_file – Path to a .env file. Relative paths are resolved from the quickie tasks root. Values are overridden by env.

  • wd – The working directory for the script.

  • expected_exit_codes – Accepted subprocess exit codes for the script.

  • timeout – Timeout in seconds for each attempt. None means no limit.

  • retries – Number of additional attempts after an initial failure.

  • retry_delay – Seconds to wait between retry attempts.

  • output_mode – How to handle subprocess output — "stream" (default), "capture", or "tee". Accepts OutputMode values or the equivalent string literals.

  • kwargs – Common keyword arguments for tasks. See CommonTaskKwargs for more information.

Returns:

The task class, or, if obj is None, a partial function to be used as a decorator for a function.