PrefectHQ/prefect 源码下载与部署教程

项目概述

Prefect is a workflow orchestration framework for building resilient data pipelines in Python.

项目地址

https://github.com/PrefectHQ/prefect

项目页面预览

PrefectHQ/prefect preview

关键指标

  • Stars:21334
  • 主要语言:Python
  • License:Apache License 2.0
  • 最近更新:2026-01-15T08:09:43Z
  • 默认分支:main

本站高速下载(国内可用)

点击下载(本站镜像)
– SHA256:c839062acb1ea452862cc1fb09f98f1057b188fef3abcd0dc0d5783b487bedff

安装部署要点(README 精选)

Getting started

Prefect requires Python 3.10+. To install the latest version of Prefect, run one of the following commands:

pip install -U prefect
uv add prefect

Then create and run a Python file that uses Prefect flow and task decorators to orchestrate and observe your workflow – in this case, a simple script that fetches the number of GitHub stars from a repository:

from prefect import flow, task
import httpx


@task(log_prints=True)
def get_stars(repo: str):
    url = f"https://api.github.com/repos/{repo}"
    count = httpx.get(url).json()["stargazers_count"]
    print(f"{repo} has {count} stars!")


@flow(name="GitHub Stars")
def github_stars(repos: list[str]):
    for repo in repos:
        get_stars(repo)


# run the flow!
if __name__ == "__main__":
    github_stars(["PrefectHQ/prefect"])

Fire up a Prefect server and open the UI at http://localhost:4200 to see what happened:

prefect server start

To run your workflow on a schedule, turn it into a deployment and schedule it to run every minute by changing the last line of your script to the following:

if __name__ == "__main__":
    github_stars.serve(
        name="first-deployment",
        cron="* * * * *",
        parameters={"repos": ["PrefectHQ/prefect"]}
    )

You now have a process running locally that is looking for scheduled deployments!
Additionally you can run your workflow manually from the UI or CLI. You can even run deployments in response to events.

[!TIP]
Where to go next – check out our documentation to learn more about:
Deploying flows to production environments
Adding error handling and retries
Integrating with your existing tools
Setting up team collaboration features

常用命令(从 README 提取)

pip install -U prefect

uv add prefect

prefect server start

通用部署说明

  1. 下载源码并阅读 README
  2. 安装依赖(pip/npm/yarn 等)
  3. 配置环境变量(API Key、模型路径、数据库等)
  4. 启动服务并测试访问
  5. 上线建议:Nginx 反代 + HTTPS + 进程守护(systemd / pm2)

免责声明与版权说明

本文仅做开源项目整理与教程索引,源码版权归原作者所有,请遵循对应 License 合规使用。

© 版权声明
THE END
喜欢就支持一下吧
点赞11 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容