Skip to content

Commit 38495c3

Browse files
authored
[dg] Assorted docs fixes (BUILD-966) (#29184)
## Summary & Motivation This PR is the result of a manual reading of all `dg`/components guides. I was looking for: - references to old project structure - references to old APIs (e.g. `dg list component-type`, `dg init --workspace-name`, ...) I updated everything I could find. In a few cases the pages were so out of date that I opened separate PRs for them: - #29185 - #29181 ## How I Tested These Changes Existing test suite.
1 parent bb6aaa3 commit 38495c3

File tree

6 files changed

+26
-64
lines changed

6 files changed

+26
-64
lines changed

docs/docs/guides/labs/components/building-pipelines-with-components/creating-a-project-with-components.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,14 @@ Running `dg scaffold project <project-name>` creates a fairly standard Python pr
2727

2828
The following files and directories are included:
2929

30-
- A Python package `jaffle_platform`-- the name is an underscored inflection of the
31-
project root directory (`jaffle_platform`).
32-
- An (empty) `jaffle_platform_tests` test package.
30+
- A Python package `jaffle_platform` located in `src/jaffle_platform`-- the name is an underscored inflection of the project root directory (`jaffle-platform`).
31+
- An (empty) `tests` package.
3332
- A `uv.lock` file.
3433
- A `pyproject.toml` file.
3534

3635
:::note
3736

38-
For more information about the sections and settings in pyproject.toml, see "[pyproject.toml settings](/guides/labs/components/building-pipelines-with-components/pyproject-toml)".
37+
For more information about the sections and settings in `pyproject.toml`, see "[pyproject.toml settings](/guides/labs/components/building-pipelines-with-components/pyproject-toml)".
3938

4039
:::
4140

docs/docs/guides/labs/components/components-etl-pipeline-tutorial.md

+11-13
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ To learn more about the files, directories, and default settings in a project sc
6262

6363
### 1. Add the Sling component type to your environment
6464

65-
To ingest data, you must set up [Sling](https://slingdata.io/). However, if you list the available component types in your environment at this point, the Sling component won't appear, since the `dagster` package doesn't contain components for specific integrations (like Sling):
65+
To ingest data, you must set up [Sling](https://slingdata.io/). We can list the component types available to our project with `dg list plugins`. If we run this now, the Sling component won't appear, since the `dagster` package doesn't contain components for specific integrations (like Sling):
6666

6767
<CliInvocationExample path="docs_snippets/docs_snippets/guides/components/index/7-dg-list-plugins.txt" />
6868

@@ -72,15 +72,13 @@ To make the Sling component available in your environment, install the `dagster-
7272

7373
:::note
7474

75-
`dg` always operates in an isolated environment, but it is able to access the set of component types available in your project environment because it attempts to resolve a project root whenever it is run. If `dg` finds a `pyproject.toml` file with a `tool.dg.is_project = true` setting, then it will expect a `uv`-managed virtual environment to be present in the same directory. (This can be confirmed by the presence of a `uv.lock` file.)
76-
77-
When you run commands like `dg list component-type` , `dg` obtains the results by identifying the in-scope project environment and querying it. In this case, the project environment was set up as part of the `dg scaffold project` command.
75+
When you run commands like `dg list plugins`, `dg` obtains the results by resolving a project environment and querying it. In this case, the project environment was set up as part of the `dg scaffold project` command. The `pyproject.toml` in newly scaffolded projects contains a setting `tool.dg.project.python_environment = "persistent_uv"`. This tells `dg` to expect a `uv`-managed virtual environment to be present in the project root directory. (This can be confirmed by the presence of a `uv.lock` file.)
7876

7977
:::
8078

8179
### 2. Confirm availability of the Sling component type
8280

83-
To confirm that the `dagster_sling.SlingReplicationCollectionComponent` component type is now available, run the `dg list component-type` command again:
81+
To confirm that the `dagster_sling.SlingReplicationCollectionComponent` component type is now available, run the `dg list plugins` command again:
8482

8583
<CliInvocationExample path="docs_snippets/docs_snippets/guides/components/index/8-dg-list-plugins.txt" />
8684

@@ -99,7 +97,7 @@ A single file, `component.yaml`, was created in the component folder. The `compo
9997
<CodeExample
10098
path="docs_snippets/docs_snippets/guides/components/index/11-component.yaml"
10199
language="YAML"
102-
title="jaffle-platform/jaffle_platform/defs/ingest_files/component.yaml"
100+
title="jaffle-platform/src/jaffle_platform/defs/ingest_files/component.yaml"
103101
/>
104102

105103
Right now the parameters define a single "replication"-- this is a Sling concept that specifies how data should be replicated from a source to a target. The details are specified in a `replication.yaml` file that is read by Sling. This file does not yet exist-- we are going to create it shortly.
@@ -121,15 +119,15 @@ Create a `replication.yaml` file that references the downloaded files:
121119
<CodeExample
122120
path="docs_snippets/docs_snippets/guides/components/index/13-replication.yaml"
123121
language="YAML"
124-
title="jaffle-platform/jaffle_platform/defs/ingest_files/replication.yaml"
122+
title="jaffle-platform/src/jaffle_platform/defs/ingest_files/replication.yaml"
125123
/>
126124

127125
Finally, modify the `component.yaml` file to tell the Sling component where replicated data with the `DUCKDB` target should be written:
128126

129127
<CodeExample
130128
path="docs_snippets/docs_snippets/guides/components/index/14-component-connections.yaml"
131129
language="YAML"
132-
title="jaffle-platform/jaffle_platform/defs/ingest_files/component.yaml"
130+
title="jaffle-platform/src/jaffle_platform/defs/ingest_files/component.yaml"
133131
/>
134132

135133
### 6. View and materialize assets in the Dagster UI
@@ -160,7 +158,7 @@ To interface with the dbt project, you will need to instantiate a Dagster dbt pr
160158

161159
<CliInvocationExample contents="uv add dagster-dbt dbt-duckdb" />
162160

163-
To confirm that the `dagster_dbt.DbtProjectComponent` component type is now available, run `dg list component-type`:
161+
To confirm that the `dagster_dbt.DbtProjectComponent` component type is now available, run `dg list plugins`:
164162

165163
<CliInvocationExample path="docs_snippets/docs_snippets/guides/components/index/17-dg-list-plugins.txt" />
166164

@@ -175,7 +173,7 @@ This creates a new component instance in the project at `jaffle_platform/defs/jd
175173
<CodeExample
176174
path="docs_snippets/docs_snippets/guides/components/index/19-component-jdbt.yaml"
177175
language="YAML"
178-
title="jaffle-platform/jaffle_platform/defs/jdbt/component.yaml"
176+
title="jaffle-platform/src/jaffle_platform/defs/jdbt/component.yaml"
179177
/>
180178

181179
### 4. Update the dbt project component configuration
@@ -193,7 +191,7 @@ We need to update the configuration of the `dagster_dbt.DbtProjectComponent` com
193191
<CodeExample
194192
path="docs_snippets/docs_snippets/guides/components/index/20-project-jdbt-incorrect.yaml"
195193
language="YAML"
196-
title="jaffle-platform/jaffle_platform/defs/jdbt/component.yaml"
194+
title="jaffle-platform/src/jaffle_platform/defs/jdbt/component.yaml"
197195
/>
198196

199197
You might notice the typo in the above file--after updating a component file, it's useful to validate that the changes match the component's schema. You can do this by running `dg check yaml`:
@@ -205,7 +203,7 @@ You can see that the error message includes the filename, line number, and a cod
205203
<CodeExample
206204
path="docs_snippets/docs_snippets/guides/components/index/22-project-jdbt.yaml"
207205
language="YAML"
208-
title="jaffle-platform/jaffle_platform/defs/jdbt/component.yaml"
206+
title="jaffle-platform/src/jaffle_platform/defs/jdbt/component.yaml"
209207
/>
210208

211209
Finally, run `dg check yaml` again to validate the fix:
@@ -235,7 +233,7 @@ And now target `*` and schedule `@daily`:
235233
<CodeExample
236234
path="docs_snippets/docs_snippets/guides/components/index/26-daily-jaffle.py"
237235
language="Python"
238-
title="jaffle-platform/jaffle_platform/defs/daily_jaffle.py"
236+
title="jaffle-platform/src/jaffle_platform/defs/daily_jaffle.py"
239237
/>
240238

241239
## Next steps

docs/docs/guides/labs/dg/configuring-dg.md

-36
This file was deleted.

docs/docs/guides/labs/dg/incrementally-adopting-dg/migrating-definitions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This guide covers using existing Dagster definitions with a `dg`-compatible proj
1313

1414
:::
1515

16-
In projects that heavily use `dg`, you would typically keep all definitions in the `defs/` directory. However, if you've converted an existing project to use `dg`, you may have definitions located in various other modules. This guide will show you how to move these existing definitions into the `defs` directory in a way that will allow them to be automatically loaded.
16+
In projects that are started with `dg`, all definitions are typically kept in the `defs/` directory. However, if you've converted an existing project to use `dg`, you may have definitions located in various other modules. This guide will show you how to move these existing definitions into the `defs` directory in a way that will allow them to be automatically loaded.
1717

1818
## Example project structure
1919

docs/docs/guides/labs/dg/multiple-projects.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ If you're just getting started, we recommend [scaffolding a single project](/gui
1515

1616
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.
1717

18-
A workspace directory contains a root `pyproject.toml` with workspace-level settings, and a `projects` directory with one or more projects.
18+
A workspace directory contains a root `dg.toml` with workspace-level settings, and a `projects` directory with one or more projects.
1919

2020
:::note
2121

@@ -25,7 +25,7 @@ A workspace does not define a Python environment by default. Instead, Python env
2525

2626
## Scaffold a new workspace and first project
2727

28-
To scaffold a new workspace with an initial project called `project-1`, run `dg init` with the `--workspace-name` option:
28+
To scaffold a new workspace with an initial project called `project-1`, run `dg init` with the `--workspace` option. You will be prompted for the name of the project:
2929

3030
<CliInvocationExample path="docs_snippets/docs_snippets/guides/dg/workspace/1-dg-init.txt" />
3131

@@ -37,12 +37,12 @@ The new workspace has the following structure:
3737

3838
<CliInvocationExample path="docs_snippets/docs_snippets/guides/dg/workspace/2-tree.txt" />
3939

40-
The `pyproject.toml` file for the `workspace` folder contains an `is_workspace` setting that marks this directory as a workspace:
40+
The `pyproject.toml` file for the `workspace` folder contains a `directory_type = "workspace"` setting that marks this directory as a workspace:
4141

4242
<CodeExample
43-
path="docs_snippets/docs_snippets/guides/dg/workspace/3-pyproject.toml"
43+
path="docs_snippets/docs_snippets/guides/dg/workspace/3-dg.toml"
4444
language="TOML"
45-
title="workspace/pyproject.toml"
45+
title="dagster-workspace/dg.toml"
4646
/>
4747

4848
:::note
@@ -51,13 +51,13 @@ The `pyproject.toml` file for the `workspace` folder contains an `is_workspace`
5151

5252
:::
5353

54-
The `project-1` directory contains a `pyproject.toml` file that defines
55-
it as a Dagster project:
54+
The `project-1` directory contains a `pyproject.toml` file with a
55+
`tool.dg.directory_type = "project"` section that defines it as a `dg` project:
5656

5757
<CodeExample
5858
path="docs_snippets/docs_snippets/guides/dg/workspace/4-project-pyproject.toml"
5959
language="TOML"
60-
title="workspace/projects/project-1/pyproject.toml"
60+
title="dagster-workspace/projects/project-1/pyproject.toml"
6161
/>
6262

6363
## Add a second project to the workspace

docs/docs/guides/labs/dg/scaffolding-a-project.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@ The `dg init` command creates a directory with a standard Python package structu
1919

2020
<CliInvocationExample path="docs_snippets/docs_snippets/guides/dg/scaffolding-project/2-tree.txt" />
2121

22-
- The top-level package `my_project` contains the deployable code that defines
22+
- The Python package `my_project` lives in `src/my_project` and contains the deployable code that defines
2323
your Dagster pipelines.
2424
- `my_project/defs` will contain your Dagster definitions.
2525
- `my_project/lib` is where you will define custom component types, and
2626
optionally other code you wish to share across Dagster definitions.
2727
- `my_project/definitions.py` is the entry point that Dagster will load when
2828
deploying your code location. It is configured to load all definitions from
2929
`my_project/defs`. You should not need to modify this file.
30-
- `my_project_tests` contains tests for the code in `my_project`.
30+
- `tests` is a separate Python package defined at the top level (outside
31+
`src`). It should contain tests for the `my_project` package.
3132
- `pyproject.toml` is a standard Python package configuration file. In addition
3233
to the regular Python package metadata, it contains a `tool.dg` section
3334
for `dg`-specific settings.

0 commit comments

Comments
 (0)