A template repository for building production ML pipelines with ZenML and GitHub Actions. Fork this repo and adapt it to your own ML problem.
When you open a pull request:
- To staging branch: Creates a pipeline snapshot and runs it on your staging stack
- To main branch: Creates a production snapshot (manual approval required to run)
All configuration (model names, tags, snapshot naming) is centralized in project_config.yaml.
- Fork this repository
- Set up your ZenML server and stacks
- Add
ZENML_API_KEYto your GitHub repository secrets - Edit
project_config.yamlwith your project details - Update
.github/workflows/pipeline_run.yamlwith your ZenML server URL and stack names
├── project_config.yaml # Central configuration (edit this first)
├── pipeline/
│ └── training_pipeline.py
├── steps/ # Pipeline steps
├── configs/
│ ├── local.yml # Local development settings
│ ├── staging.yml # Staging environment settings
│ └── production.yml # Production environment settings
├── build.py # Creates snapshots (used by CI/CD)
├── run.py # Runs pipeline locally
└── promote.py # Promotes model versions to production
Edit project_config.yaml to customize your project:
project:
name: "my-project"
model:
name: "MyModel"
description: "My ML model"
tags: ["classification", "v1"]
pipeline:
name: "my_training_pipeline"
run_name_prefix: "training"
tags: ["training"]
snapshot:
prefix: "my_model" # Generates: STG_my_model_abc1234Install dependencies:
pip install -r requirements.txtRun the pipeline locally:
python run.py --environment localThe GitHub Actions workflow in .github/workflows/pipeline_run.yaml handles automation.
Update these environment variables for your setup:
env:
ZENML_STORE_URL: https://your-workspace.zenml.io
ZENML_PROJECT: your-project
ZENML_STAGING_STACK: your-staging-stack
ZENML_PRODUCTION_STACK: your-production-stack- Replace the steps in
steps/with your own data loading, preprocessing, and training logic - Update
pipeline/training_pipeline.pyto wire up your steps - Adjust parameters in
configs/*.ymlfor your use case - Update
project_config.yamlwith your model and pipeline names
Create a snapshot manually:
python build.py --environment staging --stack my-stackCreate and run:
python build.py --environment staging --stack my-stack --runPromote a model to production:
python promote.py --version 1- Python 3.10+
- ZenML server (cloud or self-hosted)
- Remote stack with orchestrator, artifact store, and container registry