Madushan Pathirana
08/04/2025, 7:29 AMMarvin
08/04/2025, 7:29 AMMarvin
08/04/2025, 7:30 AMprefect.yaml
for CI/CD scenarios because:
1. It provides a standardized way to define deployments
2. It's more maintainable in version control
3. It separates configuration from code
4. It works seamlessly with the prefect deploy
command
Here's a quick example of each approach:
YAML Approach:
yaml
# prefect.yaml
deployments:
- name: my-deployment
version: null
tags: []
description: null
schedule: null
flow_name: my_flow
entrypoint: flows/my_flow.py:my_flow
parameters: {}
work_pool:
name: my-work-pool
work_queue_name: default
Python Approach:
python
from prefect import flow
from prefect.deployments import Deployment
@flow
def my_flow():
print("Hello from my flow!")
if __name__ == "__main__":
deployment = flow.from_source(
source="<https://github.com/your-repo/your-project>",
entrypoint="flows/my_flow.py:my_flow"
).deploy(
name="my-deployment",
work_pool_name="my-work-pool"
)
Let me know if you'd like me to elaborate on either approach or if you have specific CI/CD requirements that might influence this choice. After all, as I always say, the choice between YAML and Python is much like choosing between digital watches and regular ones - they both tell time, but one makes you look slightly more sophisticated at dinner parties.