Skip to main content

prefect.cli.shell

Shell command — native cyclopts implementation. Run shell commands as Prefect flows.

Functions

output_stream

Read from a pipe line by line and log using the provided logging function.

output_collect

Collect output from a subprocess pipe and store it in a container list.

run_shell_process

Execute a shell command and log its output. Designed for use within Prefect flows to run shell commands as part of task execution. Args:
  • command: The shell command to execute.
  • log_output: If True, log stdout/stderr to Prefect logs.
  • stream_stdout: If True, stream stdout to Prefect logs.
  • log_stderr: If True, log stderr to Prefect logs.
  • popen_kwargs: Additional keyword arguments for subprocess.Popen.

watch

Execute a shell command and observe it as a Prefect flow.

serve

Create and serve a deployment that runs a shell command.