{"id":5008,"library":"prefect-cloud","title":"Prefect Cloud CLI","description":"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.","status":"active","version":"0.1.10","language":"en","source_language":"en","source_url":"https://github.com/PrefectHQ/prefect-cloud","tags":["prefect","cloud","orchestration","workflow","deployment","cli"],"install":[{"cmd":"pip install prefect-cloud","lang":"bash","label":"Via pip"},{"cmd":"uvx prefect-cloud","lang":"bash","label":"Temporary install via uvx (recommended for quickstart)"}],"dependencies":[{"reason":"Required for defining flows and tasks that prefect-cloud deploys. Requires Python >=3.10.","package":"prefect","optional":false}],"imports":[],"quickstart":{"code":"# hello_flow.py\nfrom prefect import flow, task\n\n@task\ndef say_hello(name: str) -> str:\n    print(f\"Hello, {name}!\")\n    return f\"Said hello to {name}\"\n\n@flow(name=\"My Cloud Hello Flow\")\ndef hello_world_flow(target_name: str = \"World\"):\n    result = say_hello(target_name)\n    print(f\"Task result: {result}\")\n\n# To deploy: save this file, commit to a GitHub repo (e.g., your-username/your-repo/flows/hello_flow.py)\n# Then run the CLI command below.\n\n# CLI command (after logging into Prefect Cloud via 'uvx prefect cloud login'):\n# 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 * * *\"\n","lang":"python","description":"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`."},"warnings":[{"fix":"Rewrite flows to conform to the Prefect 2.x API (using `@flow` and `@task` decorators from the `prefect` library). Refer to the Prefect 2.x migration guide.","message":"Prefect 1.x flows are incompatible with Prefect 2.x and, by extension, `prefect-cloud`. If migrating from Prefect 1.x, significant code changes are required to adapt to the Prefect 2.x API.","severity":"breaking","affected_versions":"All versions of `prefect-cloud` (which targets Prefect 2.x+)"},{"fix":"Ensure `PREFECT_API_KEY` is set to a valid API key from your Prefect Cloud workspace and `PREFECT_API_URL` points to your Prefect Cloud API (e.g., `https://api.prefect.cloud/api/...`). Use `uvx prefect cloud login` to set up your profile correctly.","message":"Incorrect or missing `PREFECT_API_KEY` or `PREFECT_API_URL` environment variables can lead to authentication or connection failures when deploying or running flows with Prefect Cloud.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Add `--dependencies 'package1,package2'` or `--dependencies /path/to/requirements.txt` to your `uvx prefect-cloud deploy` command.","message":"When deploying flows with `prefect-cloud`, any external Python dependencies required by your flow must be explicitly declared, either via `--dependencies` arguments or by referencing a `requirements.txt` file in your repository.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Optimize logging verbosity. For large data, consider using external storage (e.g., S3, GCS) and passing references (paths/keys) between tasks instead of the raw data.","message":"Excessive logging or passing very large data objects directly between tasks in Prefect flows can lead to performance bottlenecks, increased resource consumption, and higher costs in cloud environments, even with serverless execution.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always keep your local `prefect` and `prefect-cloud` installations up-to-date and compatible with the Prefect Cloud service. Check release notes for any specific version requirements.","message":"Incompatibility between your locally installed `prefect` and `prefect-cloud` versions and the Prefect Cloud server can cause unexpected errors or deployment failures.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}