Skip to content

Commit 397a414

Browse files
committed
[components] Move dg cli back to verb-first (update docs)
1 parent cb2c26b commit 397a414

34 files changed

+69
-63
lines changed

Diff for: docs/docs/guides/labs/components/existing-code-location.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This feature is still in development and might change in patch releases. It’s
1111

1212
:::note
1313

14-
This guide is only relevant if you are starting from an _existing_ Dagster code location. This setup is unnecessary if you used `dg code-location generate` to create your code location.
14+
This guide is only relevant if you are starting from an _existing_ Dagster code location. This setup is unnecessary if you used `dg scaffold code-location` to create your code location.
1515

1616
:::
1717

Diff for: docs/docs/guides/labs/components/index.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ First let's set up Sling. If we query the available component types in our envir
106106
This is because the basic `dagster-components` package (which was installed when we scaffolded our code location) is lightweight and doesn't include components for specific integrations (like Sling). We can get access to a Sling component by installing the `sling` extra of `dagster-components`:
107107

108108
:::note
109-
Recall that `dg` always operates in an isolated environment-- so how is it able to access the set of components types available in our project environment? Under the hood, `dg` attempts to resolve a project root whenever it is run. If it finds a `pyproject.toml` file with a `tool.dg.is_code_location = true` setting, then it will by default 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). When you run commands like `dg component-type list`, `dg` obtains the results by identifying the in-scope project environment and querying it. In this case, the project environment was set up for us as part of the `dg code-location scaffold` command.
109+
Recall that `dg` always operates in an isolated environment-- so how is it able to access the set of components types available in our project environment? Under the hood, `dg` attempts to resolve a project root whenever it is run. If it finds a `pyproject.toml` file with a `tool.dg.is_code_location = true` setting, then it will by default 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). 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 for us as part of the `dg scaffold code-location` command.
110110
:::
111111

112112
<CliInvocationExample contents="uv add 'dagster-components[sling]'" />
@@ -177,7 +177,7 @@ We'll need to create a Dagster DBT project component to interface with the dbt p
177177
<CliInvocationExample path="docs_beta_snippets/docs_beta_snippets/guides/components/index/18-dg-list-component-types.txt" />
178178

179179

180-
There it is: `dagster_components.dbt_project`. We can access detailed info about a component type using the `dg component-type info` command. Let's have a look at the `dagster_components.dbt_project` component type:
180+
There it is: `dagster_components.dbt_project`. We can access detailed info about a component type using the `dg info component-type` command. Let's have a look at the `dagster_components.dbt_project` component type:
181181

182182
<CliInvocationExample path="docs_beta_snippets/docs_beta_snippets/guides/components/index/19-dg-component-type-info.txt" />
183183

@@ -202,15 +202,15 @@ You can see at first glance that there appear to be two copies of the `raw_custo
202202

203203
<CodeExample path="docs_beta_snippets/docs_beta_snippets/guides/components/index/22-project-jdbt-incorrect.yaml" language="YAML" title="jaffle-platform/jaffle_platform/components/jdbt/component.yaml" />
204204

205-
You might notice the typo in the above file - after updating a component file, it's often useful to validate that the changes match the component's schema. You can do this by running `dg component check`:
205+
You might notice the typo in the above file - after updating a component file, it's often useful to validate that the changes match the component's schema. You can do this by running `dg check component`:
206206

207207
<CliInvocationExample path="docs_beta_snippets/docs_beta_snippets/guides/components/index/23-dg-component-check-error.txt" />
208208

209209
You can see that the error message includes the filename, line number, and a code snippet showing the exact nature of the error. Let's fix the typo:
210210

211211
<CodeExample path="docs_beta_snippets/docs_beta_snippets/guides/components/index/24-project-jdbt.yaml" language="YAML" title="jaffle-platform/jaffle_platform/components/jdbt/component.yaml" />
212212

213-
Finally, we can re-run `dg component check` to validate that our fix works:
213+
Finally, we can re-run `dg check component` to validate that our fix works:
214214

215215
<CliInvocationExample path="docs_beta_snippets/docs_beta_snippets/guides/components/index/25-dg-component-check.txt" />
216216

Diff for: docs/docs/guides/labs/components/using-a-component.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ This feature is still in development and might change in patch releases. It’s
1515
You can view the available component types in your environment by running the following command:
1616

1717
```bash
18-
dg component-type list
18+
dg list component-type
1919
```
2020

2121
This will display a list of all the component types that are available in your project. If you'd like to see more information about a specific component, you can run:
2222

2323
```bash
24-
dg component-type docs <component-name>
24+
dg docs component-type <component-name>
2525
```
2626

2727
This will display a webpage containing documentation for the specified component type.
@@ -31,7 +31,7 @@ This will display a webpage containing documentation for the specified component
3131
Once you've selected the component type that you'd like to use, you can instantiate a new component by running:
3232

3333
```bash
34-
dg component generate <component-type> <component-name>
34+
dg scaffold component <component-type> <component-name>
3535
```
3636

3737
This will create a new directory underneath your `components/` folder that contains a `component.yaml` file. Some components may also generate additional files as needed.
@@ -46,7 +46,7 @@ The `component.yaml` is the primary configuration file for a component. It conta
4646
To see a sample `component.yaml` file for your specific component, you can run:
4747

4848
```bash
49-
dg component-type docs <component-name>
49+
dg docs component-type <component-name>
5050
```
5151

5252
## Component templating
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
dg deployment scaffold my-deployment
1+
dg scaffold deployment my-deployment
22

33
Creating a Dagster deployment at my-deployment.
44
Scaffolded files for Dagster project in my-deployment.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
dg code-location list
1+
dg list code-location
22

33
code-location-1
44
code-location-2

Diff for: examples/docs_beta_snippets/docs_beta_snippets/guides/components/deployments/11-component-type-list.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cd code_locations/code-location-2 && dg component-type list
1+
cd code_locations/code-location-2 && dg list component-type
22

33
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
44
┃ Component Type ┃ Summary ┃

Diff for: examples/docs_beta_snippets/docs_beta_snippets/guides/components/deployments/4-code-location-scaffold.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
dg code-location scaffold code-location-1
1+
dg scaffold code-location code-location-1
22

33
Creating a Dagster code location at /.../my-deployment/code_locations/code-location-1.
44
Scaffolded files for Dagster project in /.../my-deployment/code_locations/code-location-1.

Diff for: examples/docs_beta_snippets/docs_beta_snippets/guides/components/deployments/7-component-type-list.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cd code_locations/code-location-1 && dg component-type list
1+
cd code_locations/code-location-1 && dg list component-type
22

33
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
44
┃ Component Type ┃ Summary ┃

Diff for: examples/docs_beta_snippets/docs_beta_snippets/guides/components/deployments/8-component-type-list.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
dg component-type list
1+
dg list component-type
22

33
Using /.../my-deployment/code_locations/code-location-1/.venv/bin/dagster-components
44
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓

Diff for: examples/docs_beta_snippets/docs_beta_snippets/guides/components/deployments/9-code-location-scaffold.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cd ../.. && dg code-location scaffold code-location-2
1+
cd ../.. && dg scaffold code-location code-location-2
22

33
Creating a Dagster code location at /.../my-deployment/code_locations/code-location-2.
44
Scaffolded files for Dagster project in /.../my-deployment/code_locations/code-location-2.

Diff for: examples/docs_beta_snippets/docs_beta_snippets/guides/components/existing-project/8-dg-list-component-types.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
dg component-type list
1+
dg list component-type
22

33
Using /.../my-existing-project/.venv/bin/dagster-components
44
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓

Diff for: examples/docs_beta_snippets/docs_beta_snippets/guides/components/index/1-help.txt

+7-5
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ Usage: dg [OPTIONS] COMMAND [ARGS]...
3434
│ use for the cache. │
3535
╰────────────────────────────────────────────────────────────────────────────────────────╯
3636
╭─ Commands ─────────────────────────────────────────────────────────────────────────────╮
37-
│ code-location Commands for operating code location directories. │
38-
│ component Commands for operating on components. │
39-
│ component-type Commands for operating on components types. │
40-
│ deployment Commands for operating on deployment directories. │
41-
│ dev Start a local deployment of your Dagster project. │
37+
│ check Commands for checking the integrity of your Dagster code. │
38+
│ configure-editor Commands for configuring your editor. │
39+
│ dev Start a local deployment of your Dagster project. │
40+
│ docs Commands for generating docs from your Dagster code. │
41+
│ info Commands for operating on components types. │
42+
│ list Commands for listing Dagster entities. │
43+
│ scaffold Commands for scaffolding Dagster code. │
4244
╰────────────────────────────────────────────────────────────────────────────────────────╯

Diff for: examples/docs_beta_snippets/docs_beta_snippets/guides/components/index/18-dg-list-component-types.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
dg component-type list
1+
dg list component-type
22

33
Using /.../jaffle-platform/.venv/bin/dagster-components
44
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓

Diff for: examples/docs_beta_snippets/docs_beta_snippets/guides/components/index/19-dg-component-type-info.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
dg component-type info 'dbt_project@dagster_components'
1+
dg info component-type 'dbt_project@dagster_components'
22

33
dbt_project@dagster_components
44

Diff for: examples/docs_beta_snippets/docs_beta_snippets/guides/components/index/2-scaffold.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
dg code-location scaffold jaffle-platform
1+
dg scaffold code-location jaffle-platform
22

33
Creating a Dagster code location at /.../jaffle-platform.
44
Scaffolded files for Dagster project in /.../jaffle-platform.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
dg component scaffold dbt_project@dagster_components jdbt --project-path dbt/jdbt
1+
dg scaffold component dbt_project@dagster_components jdbt --project-path dbt/jdbt
22

33
Creating a Dagster component instance folder at /.../jaffle-platform/jaffle_platform/components/jdbt.
44
Using /.../jaffle-platform/.venv/bin/dagster-components

Diff for: examples/docs_beta_snippets/docs_beta_snippets/guides/components/index/23-dg-component-check-error.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
dg component check
1+
dg check component
22

33
/.../jaffle-platform/jaffle_platform/components/jdbt/component.yaml:8 - Unable to parse YAML: while scanning a quoted scalar, found unexpected end of stream
44
|
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
dg component check
1+
dg check component
22

33
All components validated successfully.

Diff for: examples/docs_beta_snippets/docs_beta_snippets/guides/components/index/7-dg-list-component-types.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
dg component-type list
1+
dg list component-type
22

33
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
44
┃ Component Type ┃ Summary ┃

Diff for: examples/docs_beta_snippets/docs_beta_snippets/guides/components/index/8-dg-list-component-types.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
dg component-type list
1+
dg list component-type
22

33
Using /.../jaffle-platform/.venv/bin/dagster-components
44
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
dg component scaffold 'sling_replication_collection@dagster_components' ingest_files
1+
dg scaffold component 'sling_replication_collection@dagster_components' ingest_files
22

33
Creating a Dagster component instance folder at /.../jaffle-platform/jaffle_platform/components/ingest_files.
44
Using /.../jaffle-platform/.venv/bin/dagster-components

Diff for: examples/docs_beta_snippets/docs_beta_snippets/guides/components/migrating-definitions/3-scaffold.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
dg component scaffold 'definitions@dagster_components' elt-definitions
1+
dg scaffold component 'definitions@dagster_components' elt-definitions
22

33
Using /.../my-existing-project/.venv/bin/dagster-components
44
Creating a Dagster component instance folder at /.../my-existing-project/my_existing_project/components/elt-definitions.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
dg component-type scaffold shell_command
1+
dg scaffold component-type shell_command
22

33
Creating a Dagster component type at /.../my-component-library/my_component_library/lib/shell_command.py.
44
Scaffolded files for Dagster project in /.../my-component-library/my_component_library/lib.

Diff for: examples/docs_beta_snippets/docs_beta_snippets/guides/components/shell-script-component/3-dg-list-component-types.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
dg component-type list
1+
dg list component-type
22

33
Using /.../my-component-library/.venv/bin/dagster-components
44
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
dg component-type docs shell_command@my_component_library
1+
dg docs component-type shell_command@my_component_library

Diff for: examples/docs_beta_snippets/docs_beta_snippets/guides/components/shell-script-component/6-scaffold-instance-of-component.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
dg component scaffold 'shell_command@my_component_library' my_shell_command
1+
dg scaffold component 'shell_command@my_component_library' my_shell_command
22

33
Using /.../my-component-library/.venv/bin/dagster-components
44
Creating a Dagster component instance folder at /.../my-component-library/my_component_library/components/my_shell_command.

Diff for: examples/docs_beta_snippets/docs_beta_snippets_tests/snippet_checks/guides/components/test_component_docs_existing_code_location/test_existing_code_location.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def next_snip_no():
150150
)
151151

152152
run_command_and_snippet_output(
153-
cmd="dg component-type list",
153+
cmd="dg list component-type",
154154
snippet_path=COMPONENTS_SNIPPETS_DIR
155155
/ f"{next_snip_no()}-dg-list-component-types.txt",
156156
update_snippets=update_snippets,

Diff for: examples/docs_beta_snippets/docs_beta_snippets_tests/snippet_checks/guides/components/test_components_docs.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def next_snip_no():
6868

6969
# Scaffold code location
7070
run_command_and_snippet_output(
71-
cmd="dg code-location scaffold jaffle-platform --use-editable-dagster",
71+
cmd="dg scaffold code-location jaffle-platform --use-editable-dagster",
7272
snippet_path=COMPONENTS_SNIPPETS_DIR / f"{next_snip_no()}-scaffold.txt",
7373
update_snippets=update_snippets,
7474
snippet_replace_regex=[
@@ -113,7 +113,7 @@ def next_snip_no():
113113
)
114114

115115
run_command_and_snippet_output(
116-
cmd="dg component-type list",
116+
cmd="dg list component-type",
117117
snippet_path=COMPONENTS_SNIPPETS_DIR
118118
/ f"{next_snip_no()}-dg-list-component-types.txt",
119119
update_snippets=update_snippets,
@@ -125,7 +125,7 @@ def next_snip_no():
125125
)
126126
_run_command("uv tree")
127127
run_command_and_snippet_output(
128-
cmd="dg component-type list",
128+
cmd="dg list component-type",
129129
snippet_path=COMPONENTS_SNIPPETS_DIR
130130
/ f"{next_snip_no()}-dg-list-component-types.txt",
131131
update_snippets=update_snippets,
@@ -134,7 +134,7 @@ def next_snip_no():
134134

135135
# Scaffold new ingestion, validate new files
136136
run_command_and_snippet_output(
137-
cmd="dg component scaffold 'sling_replication_collection@dagster_components' ingest_files",
137+
cmd="dg scaffold component 'sling_replication_collection@dagster_components' ingest_files",
138138
snippet_path=COMPONENTS_SNIPPETS_DIR
139139
/ f"{next_snip_no()}-dg-scaffold-sling-replication.txt",
140140
update_snippets=update_snippets,
@@ -247,14 +247,14 @@ def next_snip_no():
247247
f"uv add --editable '{EDITABLE_DIR / 'dagster-dbt'!s}' && uv add --editable '{EDITABLE_DIR / 'dagster-components'!s}[dbt]'; uv add dbt-duckdb"
248248
)
249249
run_command_and_snippet_output(
250-
cmd="dg component-type list",
250+
cmd="dg list component-type",
251251
snippet_path=COMPONENTS_SNIPPETS_DIR
252252
/ f"{next_snip_no()}-dg-list-component-types.txt",
253253
update_snippets=update_snippets,
254254
snippet_replace_regex=[MASK_JAFFLE_PLATFORM],
255255
)
256256
run_command_and_snippet_output(
257-
cmd="dg component-type info 'dbt_project@dagster_components'",
257+
cmd="dg info component-type 'dbt_project@dagster_components'",
258258
snippet_path=COMPONENTS_SNIPPETS_DIR
259259
/ f"{next_snip_no()}-dg-component-type-info.txt",
260260
update_snippets=update_snippets,
@@ -263,7 +263,7 @@ def next_snip_no():
263263

264264
# Scaffold dbt project components
265265
run_command_and_snippet_output(
266-
cmd="dg component scaffold dbt_project@dagster_components jdbt --project-path dbt/jdbt",
266+
cmd="dg scaffold component dbt_project@dagster_components jdbt --project-path dbt/jdbt",
267267
snippet_path=COMPONENTS_SNIPPETS_DIR
268268
/ f"{next_snip_no()}-dg-scaffold-jdbt.txt",
269269
update_snippets=update_snippets,
@@ -290,7 +290,7 @@ def next_snip_no():
290290
""",
291291
)
292292
run_command_and_snippet_output(
293-
cmd="dg component check",
293+
cmd="dg check component",
294294
snippet_path=COMPONENTS_SNIPPETS_DIR
295295
/ f"{next_snip_no()}-dg-component-check-error.txt",
296296
update_snippets=update_snippets,
@@ -314,7 +314,7 @@ def next_snip_no():
314314
""",
315315
)
316316
run_command_and_snippet_output(
317-
cmd="dg component check",
317+
cmd="dg check component",
318318
snippet_path=COMPONENTS_SNIPPETS_DIR
319319
/ f"{next_snip_no()}-dg-component-check.txt",
320320
update_snippets=update_snippets,

0 commit comments

Comments
 (0)