Skip to content

Commit

Permalink
[components] Move dagster-components test component lib to dagster_co…
Browse files Browse the repository at this point in the history
…mponents.lib.test
  • Loading branch information
smackesey committed Dec 19, 2024
1 parent 5a1be5c commit 6ca4051
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from dagster_components.cli.generate import generate_cli
from dagster_components.cli.list import list_cli
from dagster_components.core.component import BUILTIN_PUBLISHED_COMPONENT_ENTRY_POINT
from dagster_components.core.component import BUILTIN_MAIN_COMPONENT_ENTRY_POINT
from dagster_components.utils import CLI_BUILTIN_COMPONENT_LIB_KEY


Expand All @@ -20,7 +20,7 @@ def create_dagster_components_cli():
@click.option(
"--builtin-component-lib",
type=str,
default=BUILTIN_PUBLISHED_COMPONENT_ENTRY_POINT,
default=BUILTIN_MAIN_COMPONENT_ENTRY_POINT,
help="Specify the builitin component library to load.",
)
@click.version_option(__version__, "--version", "-v")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
from typing_extensions import Self

from dagster_components.core.component_rendering import TemplatedValueResolver, preprocess_value
from dagster_components.utils import ensure_dagster_components_tests_import


class ComponentDeclNode: ...
Expand Down Expand Up @@ -119,14 +118,14 @@ def get_entry_points_from_python_environment(group: str) -> Sequence[importlib.m

COMPONENTS_ENTRY_POINT_GROUP = "dagster.components"
BUILTIN_COMPONENTS_ENTRY_POINT_BASE = "dagster_components"
BUILTIN_PUBLISHED_COMPONENT_ENTRY_POINT = BUILTIN_COMPONENTS_ENTRY_POINT_BASE
BUILTIN_MAIN_COMPONENT_ENTRY_POINT = BUILTIN_COMPONENTS_ENTRY_POINT_BASE
BUILTIN_TEST_COMPONENT_ENTRY_POINT = ".".join([BUILTIN_COMPONENTS_ENTRY_POINT_BASE, "test"])


class ComponentRegistry:
@classmethod
def from_entry_point_discovery(
cls, builtin_component_lib: str = BUILTIN_PUBLISHED_COMPONENT_ENTRY_POINT
cls, builtin_component_lib: str = BUILTIN_MAIN_COMPONENT_ENTRY_POINT
) -> "ComponentRegistry":
"""Discover components registered in the Python environment via the `dagster_components` entry point group.
Expand All @@ -149,11 +148,6 @@ def from_entry_point_discovery(
and not entry_point.name == builtin_component_lib
):
continue
elif entry_point.name == BUILTIN_TEST_COMPONENT_ENTRY_POINT:
if builtin_component_lib:
ensure_dagster_components_tests_import()
else:
continue

root_module = entry_point.load()
if not isinstance(root_module, ModuleType):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from dagster_components.lib.test.all_metadata_empty_asset import (
AllMetadataEmptyAsset as AllMetadataEmptyAsset,
)
from dagster_components.lib.test.simple_asset import SimpleAsset as SimpleAsset
from dagster_components.lib.test.simple_pipes_script_asset import (
SimplePipesScriptAsset as SimplePipesScriptAsset,
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
from dagster._core.definitions.decorators.asset_decorator import asset
from dagster._core.definitions.definitions_class import Definitions
from dagster._core.execution.context.asset_execution_context import AssetExecutionContext
from typing_extensions import Self

from dagster_components import Component, ComponentLoadContext, component
from dagster_components.core.component import ComponentGenerateRequest
from dagster_components.core.component_decl_builder import YamlComponentDecl
from dagster_components.generate import generate_component_yaml
from typing_extensions import Self

if TYPE_CHECKING:
from dagster_components.core.component import ComponentDeclNode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
from dagster._core.definitions.decorators.asset_decorator import asset
from dagster._core.definitions.definitions_class import Definitions
from dagster._core.execution.context.asset_execution_context import AssetExecutionContext
from pydantic import BaseModel, TypeAdapter
from typing_extensions import Self

from dagster_components import Component, ComponentLoadContext, component
from dagster_components.core.component import ComponentGenerateRequest
from dagster_components.core.component_decl_builder import YamlComponentDecl
from dagster_components.generate import generate_component_yaml
from pydantic import BaseModel, TypeAdapter
from typing_extensions import Self

if TYPE_CHECKING:
from dagster_components.core.component import ComponentDeclNode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
from dagster._core.definitions.definitions_class import Definitions
from dagster._core.execution.context.asset_execution_context import AssetExecutionContext
from dagster._core.pipes.subprocess import PipesSubprocessClient
from pydantic import BaseModel, TypeAdapter
from typing_extensions import Self

from dagster_components import Component, ComponentLoadContext, component
from dagster_components.core.component import ComponentGenerateRequest
from dagster_components.core.component_decl_builder import YamlComponentDecl
from dagster_components.generate import generate_component_yaml
from pydantic import BaseModel, TypeAdapter
from typing_extensions import Self

if TYPE_CHECKING:
from dagster_components.core.component import ComponentDeclNode
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion python_modules/libraries/dagster-components/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def get_version() -> str:
],
"dagster.components": [
"dagster_components = dagster_components.lib",
"dagster_components.test = dagster_components_tests.lib",
"dagster_components.test = dagster_components.lib.test",
],
},
extras_require={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_cache_invalidation_uv_lock():
assert "CACHE [miss]" in result.output
assert "CACHE [write]" in result.output

subprocess.run(["uv", "add", "dagster-components[dbt]"], check=True)
subprocess.run(["uv", "add", "dagster-components[dbt]", "dagster-dbt"], check=True)

result = runner.invoke("list", "component-types")
assert_runner_result(result)
Expand Down

0 comments on commit 6ca4051

Please sign in to comment.