Skip to content

Commit bfa6e14

Browse files
committed
[components] Rename dg check component -> dg check yaml
1 parent d0e767d commit bfa6e14

File tree

8 files changed

+20
-22
lines changed

8 files changed

+20
-22
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -185,15 +185,15 @@ We need to update the configuration of the `dagster_components.dbt_project` comp
185185

186186
<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" />
187187

188-
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 component`:
188+
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`:
189189

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

192192
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:
193193

194194
<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" />
195195

196-
Finally, run `dg check component` again to validate the fix:
196+
Finally, run `dg check yaml` again to validate the fix:
197197

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

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 check component
1+
dg check yaml
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 check component
1+
dg check yaml
22

33
All components validated successfully.

examples/docs_beta_snippets/docs_beta_snippets_tests/snippet_checks/guides/components/test_components_docs.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ def next_snip_no():
290290
""",
291291
)
292292
run_command_and_snippet_output(
293-
cmd="dg check component",
293+
cmd="dg check yaml",
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 check component",
317+
cmd="dg check yaml",
318318
snippet_path=COMPONENTS_SNIPPETS_DIR
319319
/ f"{next_snip_no()}-dg-component-check.txt",
320320
update_snippets=update_snippets,

python_modules/libraries/dagster-dg/CHANGELOG.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
## 0.1.16
44

55
- The entire dg CLI has been changed from noun-first to verb-first, e.g. dg code-location scaffold is now dg scaffold code-location.
6-
- The `info` command has been renamed to `inspect`. Combining this change with the new verb-first orientation, `dg component-type info` is now `dg inspect component-type`.
6+
- Some commands have also been renamed beyond the switch in order:
7+
- The `info` command has been renamed to `inspect`. `dg component-type info` is now `dg inspect component-type`.
8+
- `dg component check` command is now `dg check yaml`.
79

810
## 0.1.15
911

python_modules/libraries/dagster-dg/dagster_dg/cli/check.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ def check_group():
4141
}
4242

4343

44-
def _is_local_component(component_name: str) -> bool:
45-
return component_name.endswith(".py")
46-
47-
4844
def _scaffold_value_and_source_position_tree(
4945
filename: str, row: int, col: int
5046
) -> ValueAndSourcePositionTree:
@@ -65,16 +61,16 @@ class ErrorInput(NamedTuple):
6561
source_position_tree: ValueAndSourcePositionTree
6662

6763

68-
@check_group.command(name="component", cls=DgClickCommand)
64+
@check_group.command(name="yaml", cls=DgClickCommand)
6965
@click.argument("paths", nargs=-1, type=click.Path(exists=True))
7066
@dg_global_options
7167
@click.pass_context
72-
def component_check_command(
68+
def check_yaml_command(
7369
context: click.Context,
7470
paths: Sequence[str],
7571
**global_options: object,
7672
) -> None:
77-
"""Check component files against their schemas, showing validation errors."""
73+
"""Check component.yaml files against their schemas, showing validation errors."""
7874
resolved_paths = [Path(path).absolute() for path in paths]
7975
top_level_component_validator = Draft202012Validator(schema=COMPONENT_FILE_SCHEMA)
8076

python_modules/libraries/dagster-dg/dagster_dg_tests/cli_tests/test_check_commands.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def test_check_component_succeeds_non_default_component_package() -> None:
9393
assert BASIC_VALID_VALUE.component_type_filepath
9494
shutil.copy(BASIC_VALID_VALUE.component_type_filepath, components_dir / "__init__.py")
9595

96-
result = runner.invoke("check", "component")
96+
result = runner.invoke("check", "yaml")
9797
assert_runner_result(result, exit_0=True)
9898

9999

@@ -115,7 +115,7 @@ def test_validation_cli(test_case: ComponentValidationTestCase) -> None:
115115
) as tmpdir,
116116
):
117117
with pushd(tmpdir):
118-
result = runner.invoke("check", "component")
118+
result = runner.invoke("check", "yaml")
119119
if test_case.should_error:
120120
assert result.exit_code != 0, str(result.stdout)
121121

@@ -150,7 +150,7 @@ def test_validation_cli_multiple_components(scope_check_run: bool) -> None:
150150
with pushd(str(tmpdir)):
151151
result = runner.invoke(
152152
"check",
153-
"component",
153+
"yaml",
154154
*(
155155
[
156156
str(Path("foo_bar") / "components" / "basic_component_missing_value"),
@@ -181,7 +181,7 @@ def test_validation_cli_multiple_components_filter() -> None:
181181
with pushd(tmpdir):
182182
result = runner.invoke(
183183
"check",
184-
"component",
184+
"yaml",
185185
str(Path("foo_bar") / "components" / "basic_component_missing_value"),
186186
)
187187
assert result.exit_code != 0, str(result.stdout)
@@ -206,7 +206,7 @@ def test_validation_cli_local_component_cache() -> None:
206206
) as code_location_dir,
207207
):
208208
with pushd(code_location_dir):
209-
result = runner.invoke("check", "component")
209+
result = runner.invoke("check", "yaml")
210210
assert re.search(
211211
r"CACHE \[write\].*basic_component_success.*local_component_registry", result.stdout
212212
)
@@ -216,7 +216,7 @@ def test_validation_cli_local_component_cache() -> None:
216216
)
217217

218218
# Local components should all be cached
219-
result = runner.invoke("check", "component")
219+
result = runner.invoke("check", "yaml")
220220
assert not re.search(
221221
r"CACHE \[write\].*basic_component_success.*local_component_registry", result.stdout
222222
)
@@ -242,7 +242,7 @@ def test_validation_cli_local_component_cache() -> None:
242242
).write_text(contents + "\n")
243243

244244
# basic_component_success local component is now be invalidated and needs to be re-cached, the other one should still be cached
245-
result = runner.invoke("check", "component")
245+
result = runner.invoke("check", "yaml")
246246
assert re.search(
247247
r"CACHE \[write\].*basic_component_success.*local_component_registry", result.stdout
248248
)

python_modules/libraries/dagster-dg/dagster_dg_tests/cli_tests/test_environment_validation.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def to_cli_args(self) -> tuple[str, ...]:
4848

4949
CODE_LOCATION_CONTEXT_COMMANDS = [
5050
CommandSpec(("configure-editor", "code-location"), "vscode"),
51-
CommandSpec(("check", "component")),
51+
CommandSpec(("check", "yaml")),
5252
CommandSpec(("list", "component")),
5353
CommandSpec(("scaffold", "component"), DEFAULT_COMPONENT_TYPE, "foot"),
5454
]

0 commit comments

Comments
 (0)