Managing multiple projects with workspaces
dg
and Dagster Components are under active development. You may encounter feature gaps, and the APIs may change. To report issues or give feedback, please join the #dg-components channel in the Dagster Community Slack.
If you're just getting started, we recommend creating a single project instead of a workspace with multiple projects.
If you need to collaborate with multiple teams, or work with conflicting dependencies that require isolation from each other, you can scaffold a workspace directory that contains multiple projects, each with their own separate Python environment, while still being able to access all of your assets across every project in a single instance of the Dagster UI or dg
CLI.
A workspace directory contains a root dg.toml
with workspace-level settings, and a projects
directory with one or more projects. It also contains a Python environment in a deployments/local
folder that can be used for running dg
commands locally against the workspace.
When a dg
command runs in a workspace, it will create a subprocess for each project using that project's virtual environment, and communicate with each process through an API layer. The diagram below demonstrates a workspace with two projects, as well as their virtual environments.
1. Create a new workspace and first project
To scaffold a new workspace called dagster-workspace
, run uvx -U create-dagster workspace
and respond yes to the prompt to run uv sync
after scaffolding:
uvx create-dagster workspace dagster-workspace && cd dagster-workspace
The scaffolded workspace includes a projects
folder, which is currently empty, and a deployments
folder, which includes a local
folder with a pyproject.toml
file that specifies an environment for running dg
commands locally against your workspace.
Next, enter the directory and activate the virtual environment for the local
environment:
source deployments/local/.venv/bin/activate
You'll need to activate this virtual environment anytime you open a new terminal session and want to run a dg
command against the workspace.
Now we'll create a project inside our workspace called project-1
. Run uvx -U create-dagster project
with the path of the project:
uvx create-dagster project projects/project-1
Creating a Dagster project at /.../dagster-workspace/projects/project-1.
Scaffolded files for Dagster project at /.../dagster-workspace/projects/project-1.
A `uv` installation was detected. Run `uv sync`? This will create a uv.lock file and the virtual environment you need to activate in order to work on this project. If you wish to use a non-uv package manager, choose "n". (y/n) [y]: Running `uv sync --group dev`...
...
This will create a new Python environment for this project and associate that project with the workspace.