-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
28c6990
commit 308e59d
Showing
8 changed files
with
104 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,5 +16,4 @@ | |
DaskTransformComponent, | ||
DaskWriteComponent, | ||
PandasTransformComponent, | ||
python_component, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
from .lightweight_component import Image, lightweight_component # noqa | ||
from .pipeline import ( # noqa | ||
VALID_ACCELERATOR_TYPES, | ||
VALID_VERTEX_ACCELERATOR_TYPES, | ||
ComponentOp, | ||
Dataset, | ||
Pipeline, | ||
Resources, | ||
VALID_ACCELERATOR_TYPES, | ||
VALID_VERTEX_ACCELERATOR_TYPES, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import typing as t | ||
from dataclasses import dataclass | ||
from functools import wraps | ||
|
||
|
||
@dataclass | ||
class Image: | ||
base_image: t.Optional[str] = "fondant:latest" | ||
extra_requires: t.Optional[t.List[str]] = None | ||
script: t.Optional[str] = None | ||
|
||
|
||
def lightweight_component( | ||
extra_requires: t.Optional[t.List[str]] = None, | ||
base_image: t.Optional[str] = None, | ||
): | ||
"""Decorator to enable a python component.""" | ||
|
||
def wrapper(cls): | ||
image = Image( | ||
base_image=base_image, | ||
extra_requires=extra_requires, | ||
) | ||
|
||
# updated=() is needed to prevent an attempt to update the class's __dict__ | ||
@wraps(cls, updated=()) | ||
class PythonComponent(cls): | ||
@classmethod | ||
def image(cls) -> Image: | ||
return image | ||
|
||
@classmethod | ||
def is_python_component(cls) -> bool: | ||
return True | ||
|
||
return PythonComponent | ||
|
||
return wrapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
tests/component/test_python_component.py → tests/pipeline/test_python_component.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters