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.
pip install prefect-cloudNo compatibility data collected yet for this library.
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`.
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.
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.
Add `--dependencies 'package1,package2'` or `--dependencies /path/to/requirements.txt` to your `uvx prefect-cloud deploy` command.
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.
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.
Generate a new Prefect Cloud 2.x API key from the Prefect Cloud UI. Then, set it using the CLI with `prefect cloud login --key <YOUR_API_KEY>` or by setting the `PREFECT_API_KEY` environment variable. Ensure the key starts with 'pnu_' or 'pnb_'.
Ensure that all necessary Python packages are listed in your `requirements.txt` file and are installed in the Docker image or the execution environment where your Prefect worker operates. If using a custom Docker image, verify that the `Dockerfile` includes the installation of all dependencies.
Verify that all required files and directories are correctly packaged and transferred to the deployment environment. If using Docker, ensure your `Dockerfile` copies these assets correctly. Avoid hardcoding local development paths. For virtual environment issues, ensure the deployed environment can locate Python interpreters and scripts without relying on local virtual environment paths.
Consult the official Prefect 2.x documentation for the correct and up-to-date CLI commands. Ensure your `prefect` installation is the correct version and is up-to-date by running `pip install --upgrade prefect`. If specific commands like 'database' are not found, it might indicate a command that was removed or replaced in Prefect 2.x.