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

WIP - Type @task decorator #1372

Closed
wants to merge 2 commits into from
Closed
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
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ recursive-include flytekit_scripts *

# include specific files
include README.md
include flytekit/py.typed
include flytekit/deck/html/template.html

include CHANGELOG.md
Expand Down
8 changes: 6 additions & 2 deletions flytekit/core/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,12 @@ def find_pythontask_plugin(cls, plugin_config_type: type) -> Type[PythonFunction
return PythonFunctionTask


from typing import TypeVar, ParamSpec
T = TypeVar('T')
P = ParamSpec('P')

def task(
_task_function: Optional[Callable] = None,
_task_function: Optional[Callable[P, T]],
task_config: Optional[Any] = None,
cache: bool = False,
cache_serialize: bool = False,
Expand All @@ -90,7 +94,7 @@ def task(
execution_mode: Optional[PythonFunctionTask.ExecutionBehavior] = PythonFunctionTask.ExecutionBehavior.DEFAULT,
task_resolver: Optional[TaskResolverMixin] = None,
disable_deck: bool = True,
) -> Union[Callable, PythonFunctionTask]:
) -> Union[Callable[P, T], PythonFunctionTask]:
"""
This is the core decorator to use for any task type in flytekit.

Expand Down
Empty file added flytekit/py.typed
Empty file.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
exclude=["boilerplate", "docs", "plugins", "tests*"],
),
include_package_data=True,
package_data={'flytekit': ['py.typed']},
url="https://github.com/flyteorg/flytekit",
description="Flyte SDK for Python",
long_description=open("README.md", encoding="utf-8").read(),
Expand Down