Skip to main content

dg.toml reference (Dagster OSS)

note

This article only applies to Dagster Open Source (OSS) deployments.

A dg.toml file can be used to configure code locations in Dagster. It tells Dagster where to find your code and how to load it. This is a TOML format configuration file. For example:

# dg.toml
directory_type = "workspace"

[workspace]

[[workspace.projects]]
path = "my-project"

Each entry in a dg file is considered a code location. A code location should contain a single Definitions object. This is created automatically when projects are scaffolded with create-dagster CLI.

Location of the dg.toml

Dagster command-line tools (like dg) look for the dg file in the current directory when invoked. This allows you to launch from that directory without the need for command line arguments:

dg dev

Multiple code locations

You can define multiple code locations in a single dg.toml file:

# dg.toml
directory_type = "workspace"

[workspace]

[[workspace.projects]]
path = "my-project-1"

[[workspace.projects]]
path = "my-project-2"

This assumes that both projects are nested within the current directory where the dg.toml file is located.

.
├── my-project-1
├── my-project-2
├── dg.toml
├── pyproject.toml
└── uv.lock

To load the dg.toml file from a different folder, use the -w argument:

dg dev -w path/to/dg.toml