Kedro

On this page 7

Kedro is an open-source Python framework for writing reproducible, maintainable and modular data science and machine learning code. In MLOps & deployment, it sits at the authoring layer: it turns exploratory notebook logic into a standard project structure of pure functions, declarative data connections and configuration files that an orchestrator, a container platform or a cloud ML service can then run in production.

Kedro was created at QuantumBlack, the AI unit of McKinsey, and later joined the LF AI & Data Foundation as a hosted project. Its central idea is borrowed from software engineering: separate code from data access and configuration, so that the same pipeline runs unchanged on a laptop, in continuous integration and on a production cluster.

How Kedro structures a machine learning project

Kedro structures a project around four core abstractions: nodes, pipelines, the Data Catalog and configuration. A node wraps an ordinary Python function and declares its named inputs and outputs. A pipeline is a collection of nodes, and Kedro resolves the execution order automatically from the data dependencies, forming a directed acyclic graph.

The Data Catalog maps every dataset name to a storage location and a loader, such as a CSV file on S3, a Parquet table, a Spark DataFrame or a pickled model. Because nodes only see names, the function code contains no file paths or credentials. This is the property that makes Kedro code portable between environments.

The table below summarizes the building blocks and the responsibility each one carries.

AbstractionDefined inResponsibility
NodePython function plus inputs and outputsPerforms one transformation step
Pipelinepipeline.py in a pipeline packageGroups nodes into a dependency graph
Data Catalogcatalog.ymlLoads and saves datasets by name
Parametersparameters.ymlHolds tunable values such as split ratios
RunnerCommand line or Python APIExecutes the graph sequentially or in parallel
Hookssettings.py and plugin classesInject logic before or after runs and nodes
Core Kedro abstractions and their roles

A new project created with kedro new follows a fixed project template: source code under src, configuration under conf, and data folders organized by processing layer. The uniform layout means a new team member can navigate any Kedro project in minutes.

Configuration environments and the Data Catalog

Kedro separates configuration into environments, usually conf/base for shared settings and conf/local for machine-specific values and secrets that never enter version control. Additional environments such as staging or prod override only the keys that differ, and kedro run --env=prod selects them at run time.

The OmegaConfigLoader merges these files and supports variable interpolation and runtime parameters. Datasets in the catalog can be marked versioned: true, which makes Kedro save each output under a timestamped version folder. This gives a lightweight form of data and model versioning, although it does not replace a dedicated tool such as DVC or a model registry.

The following table shows how typical settings are distributed across configuration files.

Setting typeTypical fileKept in version control
Dataset paths and formatsconf/base/catalog.ymlYes
Model hyperparametersconf/base/parameters.ymlYes
Cloud credentialsconf/local/credentials.ymlNo
Production overridesconf/prod/catalog.ymlYes, without secrets
Logging setupconf/logging.ymlYes
Where Kedro keeps different kinds of settings

Kedro compared with orchestrators and ML platforms

Kedro is not a workflow orchestrator and not a serving platform. It does not schedule jobs, retry failed tasks across machines or host prediction endpoints. Instead, it produces a well-defined pipeline graph that deployment plugins translate into the format of an orchestrator, such as Airflow DAGs, Kubeflow pipelines or Databricks jobs.

This division of labor is the most common source of confusion. The table compares Kedro with neighboring tools in the MLOps stack.

ToolPrimary roleRelationship to Kedro
KedroPipeline authoring and project structureDefines code, data and configuration
Apache AirflowScheduling and orchestrationRuns Kedro nodes as tasks via a plugin
KubeflowKubernetes-based ML workflowsExecutes containerized Kedro pipelines
MLflowExperiment tracking and model registryIntegrated through hooks or kedro-mlflow
Metaflow and ZenMLPipeline frameworks with built-in orchestrationOverlapping alternatives with different scope
DVCData and model versioningComplements versioned datasets
Kedro and related tools in the MLOps stack

In practice, teams pair Kedro with an experiment tracker and an orchestrator. The visualization tool Kedro-Viz renders the pipeline graph interactively, which helps reviewers inspect model lineage from raw data to trained artifact.

Deploying Kedro pipelines to production

Deploying a Kedro project usually means packaging it as a Python wheel with kedro package, building a container image and handing the pipeline to a target platform. Because the catalog abstracts storage, only the environment configuration changes between development and production.

The choice of deployment path depends on the infrastructure that already exists, as the decision table shows.

SituationRecommended approachReason
Single batch job on one machineContainer with kedro runSimplest path with no extra tooling
Existing Airflow estateAirflow plugin with one task per node groupReuses scheduling and alerting
Kubernetes clusterKubeflow or Argo WorkflowsScales nodes as separate pods
Spark-heavy workloadsDatabricks jobsNative distributed data processing
Managed cloud MLVertex AI or Amazon SageMaker pipelinesUses provider monitoring and registries
Choosing a deployment target for Kedro

A training pipeline and an inference pipeline are often defined in the same project and selected with kedro run --pipeline=name. Sharing preprocessing nodes between them reduces training-serving skew, because the same feature code runs in both paths.

Limitations and common mistakes

Kedro adds structure and some overhead. For a short experiment, the template and configuration files can feel heavy, and teams sometimes adopt it too early or too late. Common pitfalls include:

  • Overly granular nodes, which create hundreds of tiny tasks and slow orchestration when each node becomes a separate container.
  • Hidden side effects inside node functions, such as writing files directly, which breaks reproducibility and lineage.
  • Secrets in base configuration, instead of local files or a secrets manager.
  • Treating versioned datasets as a full model registry, without promotion stages or approval workflows.
  • Assuming Kedro provides real-time serving, when it targets batch pipelines; online inference needs a serving layer such as KServe or BentoML.

The framework also enforces one Python process per run by default, so distributed scale must come from the runner, from Spark or from the orchestrator rather than from Kedro itself.

The idea in brief

Kedro is a way to keep data science code tidy. Imagine a kitchen where every recipe step is on its own card. Each card says what goes in and what comes out. A separate list says where each ingredient is stored.

Because the cards never mention the shelf, you can move the kitchen and still cook the same dish. Kedro does this for machine learning work. The steps stay the same everywhere, and only the storage list changes. That makes the work easier to share, test and run on a schedule.

A practical scenario

A retail analytics team builds a weekly demand forecasting model in notebooks. Running it requires one analyst to execute twelve cells in the right order, and results differ between laptops. The team rewrites the work as a Kedro project with three modular pipelines: data preparation, model training and batch scoring, about 25 nodes in total.

Raw sales files on cloud storage are declared in catalog.yml, and the trained model is saved as a versioned dataset. Development uses conf/local, while conf/prod points to production buckets. The project is packaged as a wheel, built into a container and deployed through the Airflow plugin, which runs the scoring pipeline every Monday at 05:00.

The outcome is a fully reproducible weekly run that no longer depends on a single person. New analysts read the pipeline graph in Kedro-Viz on their first day, and when forecast accuracy drops, the team can trace each output back to the exact input files and parameters that produced it.