Scaffolding a project
warning
This feature is considered in a preview stage and is under active development. It can change significantly, or be removed completely. It is not considered ready for production use.
dg
provides support for scaffolding a special type of Python package, called a project, that defines a Dagster code location.
To scaffold a new project, use the dg scaffold project
command:
dg scaffold project my-project
Creating a Dagster project at /.../my-project.
Scaffolded files for Dagster project at /.../my-project.
...
Project structure
The dg scaffold project
command creates a directory with a standard Python package structure with some additions:
tree
.
└── my-project
├── my_project
│ ├── __init__.py
│ ├── definitions.py
│ ├── defs
│ │ └── __init__.py
│ └── lib
│ └── __init__.py
├── my_project_tests
│ └── __init__.py
├── pyproject.toml
└── uv.lock
6 directories, 7 files
- The top-level package
my_project
contains the deployable code that defines your Dagster pipelines. my_project/defs
will contain your Dagster definitions.my_project/lib
is where you will define custom component types, and optionally other code you wish to share across Dagster definitions.my_project/definitions.py
is the entry point that Dagster will load when deploying your code location. It is configured to load all definitions frommy_project/defs
. You should not need to modify this file.my_project_tests
contains tests for the code inmy_project
.pyproject.toml
is a standard Python package configuration file. In addition to the regular Python package metadata, it contains atool.dg
section fordg
-specific settings.uv.lock
is the lockfile for the Python package manageruv
.dg
projects useuv
by default. For more information, seeuv
integration.