Converting an existing project
In this guide, we walk through converting an existing Dagster project that defines a Python package with a single Dagster asset, which is exposed in a top-level Definitions object in my_existing_project/definitions.py.
- uv
- pip
If you used uv to set up your Dagster project, you will have a pyproject.toml project configuration file:
tree
.
├── my_existing_project
│ ├── __init__.py
│ ├── assets.py
│ ├── definitions.py
│ └── py.typed
├── pyproject.toml
└── uv.lock
2 directories, 6 files
If you used pip to set up your Dagster project, you will have a setup.py project configuration file:
tree
.
├── my_existing_project
│ ├── __init__.py
│ ├── assets.py
│ ├── definitions.py
│ └── py.typed
└── setup.py
2 directories, 5 files
Step 1: Create and activate a virtual environment
First, you will need to make sure you have an activated and up-to-date virtual environment. We recommend creating the virtual environment in the project root (particularly when using uv), although it is not required.
- uv
- pip
If you don't have a virtual environment yet, run:
uv sync
Then activate it:
source .venv/bin/activate
If you don't have a virtual environment yet, run:
python -m venv .venv
Next, activate it:
source .venv/bin/activate
Finally, install the project package as an editable install:
pip install --editable .
Step 2: Install dependencies
Next, you will need to install the dg command line tool into your project virtual environment.
- uv
- pip
uv add dagster-dg-cli
pip install dagster-dg-cli