Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
What is MLOps?  ›  Capstone Project

Python, Bash and Go in MLOps

Python 10 minPython is the language of models and pipelines, Bash glues tools and CI steps together, and Go powers much of the infrastructure MLOps runs on.

Python, Bash and Go in MLOps

An MLOps engineer on the churn project might write a feature function in the morning, fix a CI script before lunch, and read a Kubernetes error in the afternoon. Those three jobs lean on three different languages. You do not need to master all of them, but you need to know which one each job speaks.

The rule

Python builds the model, Bash glues the tools, Go runs the platform.

Python is where models live. Data loading (pandas), training (scikit-learn, PyTorch), tracking (MLflow) and pipelines (Airflow) all have Python APIs, so feature code, training scripts and small prediction services are written in it.

def skips_per_week(events, user_id):
    skips = events[(events.user_id == user_id) & (events.action == "skip")]
    return len(skips) / 4  # the table holds four weeks of events

Bash is the glue between command-line tools. CI steps, container entrypoints and "download, then test, then upload" chores are short shell scripts:

#!/usr/bin/env bash
set -euo pipefail   # stop at the first failing command
dvc pull
pytest tests/
python train.py

set -euo pipefail is the habit to keep: without it, a failed dvc pull would be ignored and training would run on missing data.

Go is the language much of the platform underneath is written in: Kubernetes, Docker and Prometheus. Most MLOps engineers read Go more than they write it — when debugging a tool, writing a small Kubernetes operator, or building a fast network service.

The shortcut

Ask "Who is the audience of this code?"

  • A model or data frame → Python.
  • Other command-line tools → Bash.
  • The infrastructure itself, where speed and a single binary matter → Go.
Three jobs on the churn projectStep 1 of 3
  1. Add a feature

    Counting playlist creations per user works on a data frame, so it is Python next to the training code.

The common mistake is writing a 300-line Bash script full of data logic. Once a script needs loops over records or real error handling, move it to Python.

Drills

Answer fast — trust the rule.

quick drill

Where should the code that computes days_since_last_login live?

quick drill

What does set -euo pipefail at the top of a Bash CI script do?

quick drill

Why do many MLOps engineers read some Go?

quick drill

A Bash script has grown to parse CSV rows and compute averages per user. What is the best move?

Remember

  • Python builds the model, Bash glues the tools, Go runs the platform.
  • Pick the language by the code's audience: data, tools or infrastructure.
  • Trap: data logic in long Bash scripts; move it to Python early.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainChoose the language

For the churn project, name which language you would reach for in each of these jobs and why: the feature and training code, a CI step that downloads data and runs tests, and a tool you read the source of because Kubernetes misbehaves.