CLI Reference

Four sub-commands for the full DAG lifecycle: generate, validate, list, and resolve.

Global Flags

FlagDescription
-v, --verboseShow debug-level output
-q, --quietSuppress informational output (warnings and errors only)

dagsmith generate

Render YAML specs into .py DAG files.

bash
dagsmith generate TARGETS [options]
FlagDescription
TARGETSOne or more YAML file paths or directories required
-p, --pattern REGEXFilter YAML files by filename regex
-o, --output-dir DIROutput directory (default: ./dags/)
--dry-runValidate and render without writing files
-x, --fail-fastStop on first failure
--no-formatSkip ruff post-processing

Examples

bash
# Generate all YAMLs in a directory
dagsmith generate specs/

# Single file
dagsmith generate specs/sequential_bq.yaml

# Directory + regex filter
dagsmith generate specs/ -p "bq_.*"

# Validate + render without writing (preview)
dagsmith generate specs/ --dry-run

# Fail-fast, skip formatting
dagsmith generate specs/ -x --no-format

# Explicit output directory
dagsmith generate specs/ -o dags/

What happens during generate

  1. Load — Reads the YAML file and expands ${VAR} references
  2. Validate — Pydantic validates every field; errors are shown with file/field context
  3. Render — The code generator produces a complete .py string
  4. Write — Writes to <output_dir>/<dag_id>.py
  5. Format — Runs ruff check --fix + ruff format (unless --no-format)

dagsmith validate

Validate YAML specs without generating code. Ideal for CI gates.

bash
dagsmith validate TARGETS [options]
FlagDescription
TARGETSOne or more YAML file paths or directories required
-p, --pattern REGEXFilter YAML files by filename regex
--strictTreat warnings as errors (missing metadata, zero retries, isolated tasks)

Validation checks

Strict mode warnings (treated as errors with --strict)

dagsmith list

Display all registered operators, sensors, and utilities from the registry.

bash
dagsmith list [options]
FlagDescription
--originFilter by section: standard, third_party, custom
--typeFilter by class type: operator, sensor, util, model

Examples

bash
# List everything
dagsmith list

# Only sensors
dagsmith list --type sensor

# Only custom classes
dagsmith list --origin custom

# Standard operators only
dagsmith list --origin standard --type operator

dagsmith resolve

Expand ${VAR__...__VAR} references and output the fully resolved YAML. Useful for debugging variable substitution.

bash
dagsmith resolve TARGETS [options]
FlagDescription
TARGETSOne or more YAML file paths or directories required
-p, --pattern REGEXFilter YAML files by filename regex
-o, --output FILEWrite resolved YAML to a file instead of stdout
-x, --fail-fastStop on first variable expansion error

Examples

bash
# Print resolved YAML to console
dagsmith resolve examples/01_simple_bq_pipeline.yaml

# Resolve matching files by pattern
dagsmith resolve examples/ -p "parallel"

# Write resolved output to a file
dagsmith resolve examples/01_simple_bq_pipeline.yaml -o resolved.yaml

# Stop on first variable error (CI use)
dagsmith resolve examples/ -x