Skip to main content
DVC uses several file formats to track data, define pipelines, and lock reproducible states. This guide explains the structure and purpose of each file type.

File Types Overview

.dvc Files

Single-stage files for tracking data

dvc.yaml

Multi-stage pipeline definitions

dvc.lock

Lock file for reproducibility

.dvc Files (Single-Stage Files)

.dvc files are used to track individual data files or directories. They’re created with dvc add or when defining single-stage operations.

Basic Structure

A typical .dvc file contains output metadata:

Complete Schema

array
required
List of output files or directories tracked by this .dvc file
array
List of dependencies (for single-stage files with commands)
string
Command to execute (for single-stage files)
string
Working directory for the command
string
MD5 checksum of the stage definition
boolean
default:"false"
Whether the stage is frozen (won’t be re-executed)
boolean
default:"false"
Always consider this stage as changed
object
Custom metadata for the stage
string
Description of the stage

Examples

Directory checksums end with .dir and represent a hash of all files within.
Setting cache: false is useful for small files like metrics that don’t need caching.

dvc.yaml (Pipeline Files)

dvc.yaml files define multi-stage pipelines with dependencies, parameters, and outputs.

Basic Structure

Complete Schema

object
required
Dictionary of pipeline stages, where keys are stage names
array | object
Variables that can be referenced in the pipeline using ${var}
array
Global parameter files to track
array
Global metric files
array
Global plot definitions
object
Model registry artifacts
array
Dataset definitions

Advanced Examples

This creates three stages: process@train, process@test, and process@val.
Dependencies and outputs are relative to the dvc.yaml location, not the working directory.

dvc.lock (Lock Files)

dvc.lock is automatically generated and should not be edited manually. It ensures reproducibility by recording exact states.

Structure

Schema Fields

string
required
Lock file schema version (currently “2.0”)
object
Locked state of each stage
array
Locked dataset states

Lock File Features

DVC uses the lock file to determine if a stage needs to be re-executed:
  • If dependencies or parameters change, the stage runs again
  • If the lock file matches current state, the stage is skipped
Always commit dvc.lock to version control. It’s essential for reproducibility and collaboration.

File Naming Conventions

Valid .dvc filenames

  • data.csv.dvc
  • model.pkl.dvc
  • images.dvc
  • any_name.dvc

Pipeline files

  • dvc.yaml (standard)
  • dvc.lock (auto-generated)
  • Custom: pipeline.yaml
  • Custom: train.dvc.yaml
Pipeline files must be named exactly dvc.yaml. The .dvc extension is only for single-stage tracking files.

Best Practices

Always track these files:
  • .dvc files
  • dvc.yaml
  • dvc.lock
  • params.yaml
Never track:
  • Actual data files
  • Cache directories
  • .dvc/config.local
Good:
Bad:

Next Steps

Configuration

Learn about DVC configuration files

Remote Storage

Configure remote storage backends