Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[components] Move dagster-components test component lib to dagster_components.lib.test #26611

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -123,14 +122,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 @@ -153,11 +152,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