Prefect Cloud CLI

0.1.10 · active · verified Sun Apr 12

Prefect-cloud is a Python package providing a command-line interface (CLI) to easily deploy and run Python functions and workflows to Prefect Cloud. It streamlines the process of getting your data pipelines orchestrated and monitored in a serverless environment. The current version is 0.1.10, and it maintains an active release cadence with regular updates.

Warnings

Install

Quickstart

To use `prefect-cloud`, you first define your workflows using the `prefect` library's `@flow` and `@task` decorators. After developing your flow (e.g., in a file named `hello_flow.py`) and pushing it to a GitHub repository, you can deploy it to Prefect Cloud using the `uvx prefect-cloud deploy` command. This command uploads your flow, creates a deployment, and can optionally schedule its execution. Before deploying, ensure you've logged into Prefect Cloud using `uvx prefect cloud login`.

# hello_flow.py
from prefect import flow, task

@task
def say_hello(name: str) -> str:
    print(f"Hello, {name}!")
    return f"Said hello to {name}"

@flow(name="My Cloud Hello Flow")
def hello_world_flow(target_name: str = "World"):
    result = say_hello(target_name)
    print(f"Task result: {result}")

# To deploy: save this file, commit to a GitHub repo (e.g., your-username/your-repo/flows/hello_flow.py)
# Then run the CLI command below.

# CLI command (after logging into Prefect Cloud via 'uvx prefect cloud login'):
# uvx prefect-cloud deploy hello_world_flow --from https://github.com/your-username/your-repo/blob/main/flows/hello_flow.py --name "Hello Deployment" --schedule "0 0 * * *"

view raw JSON →