You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With modern development tooling, when you implement a function, you will see a list of variables the function expects.
When you write a function as a Task using the Prefect @task decorator, it hides the parameters since the return type is 'FunctionTask'.
Expected Behavior
The IDE should be able to show the expected parameters, even if they have to be annotated in the @task decorator somehow. This way when building tasks (especially a large number of tasks), you can see what the task expects when you attempt to use it in your flow.
Reproduction
Create a Task function (decorated with @task), then when using it in the Flow you will not see any hints as to what variables it expects, or if any at all.
Environment
Linux ubuntu 20.04 docker container, using visual studio code, with python extension installed.
Optionally run prefect diagnostics from the command line and paste the information here. -->
{
"config_overrides": {},
"env_vars": [
"PREFECT__CLOUD__USE_LOCAL_SECRETS",
"PREFECT__CLOUD__API_KEY"
],
"system_information": {
"platform": "Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.28",
"prefect_backend": "cloud",
"prefect_version": "0.15.12",
"python_version": "3.9.6"
}
}
The text was updated successfully, but these errors were encountered:
Hi! This is primarily a consequence of the novelty of typing in Python. The language has only recently added support for maintaining type signatures on decorated functions like this. Prefect Orion supports this, but it only works with pyright (and consequently, VSCode) and it was a lot of work. It's actually not possible with mypy as they haven't added support for the ParamSpec type yet. We'd have to write a mypy extension, but I'd rather wait for real support to come upstream.
It is likely that our team will focus on supporting this cleanly in Orion rather than attempting to add compatibility here. I'd be willing to review a PR that backports the Orion implementation though.
Description
With modern development tooling, when you implement a function, you will see a list of variables the function expects.
When you write a function as a Task using the Prefect @task decorator, it hides the parameters since the return type is 'FunctionTask'.
Expected Behavior
The IDE should be able to show the expected parameters, even if they have to be annotated in the @task decorator somehow. This way when building tasks (especially a large number of tasks), you can see what the task expects when you attempt to use it in your flow.
Reproduction
Create a Task function (decorated with @task), then when using it in the Flow you will not see any hints as to what variables it expects, or if any at all.
Environment
Linux ubuntu 20.04 docker container, using visual studio code, with python extension installed.
Optionally run
prefect diagnostics
from the command line and paste the information here. -->{
"config_overrides": {},
"env_vars": [
"PREFECT__CLOUD__USE_LOCAL_SECRETS",
"PREFECT__CLOUD__API_KEY"
],
"system_information": {
"platform": "Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.28",
"prefect_backend": "cloud",
"prefect_version": "0.15.12",
"python_version": "3.9.6"
}
}
The text was updated successfully, but these errors were encountered: