-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
azure.ai.ml.entities._inputs_outputs._get_param_with_standard_annotation
doesn't support stringizized annotations enabled by from __future__ import annotations
.
#35538
Comments
This issue is related to stringizing annotations as per PEP 563 and PEP 649. The problem can be solved by |
mldesigner.command_component
decorated functions.azure.ai.ml.entities._inputs_outputs._get_param_with_standard_annotation
doesn't support stringizized annotations.
azure.ai.ml.entities._inputs_outputs._get_param_with_standard_annotation
doesn't support stringizized annotations.azure.ai.ml.entities._inputs_outputs._get_param_with_standard_annotation
doesn't support stringizized annotations enabled by from __future__ import annotations
.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Azure/azure-ml-sdk @azureml-github. |
Hi @mchikyt3 - thank you for bringing this to our attention. I see your PR to address it. Please let me know if you need help getting the tests green. Once it is ready for review, I can review it and help you get it merged. Thank you for contributing. |
Hi, @diondrapeck. Thank you for your reply. Regarding the test for the PR, I've found that the original code doesn't pass (see commit 261e93e). Please let me know if this is a known issue, or I've missed something. Thanks. |
Can you link to the specific test/error log where you're seeing that? I don't see it in the errors for your PR. |
I have reverted my changes, only leaving an empty comment to trigger testing. You may check the errors now #35599. Thanks. |
Yes, I've confirmed this is a failure going on in main, unrelated to your PR. Please add your changes back and I'll review them. Once the main issue is fixed, we can get your PR tested objectively and merged. Thank you! |
Thanks @diondrapeck. My changes are back now. |
Describe the bug
I'm using
mldesigner.command_component
to convert a function into a command component that is used later in a pipeline. The inputs and outputs of the command components are determined by the type annotations of the parameters of the function. However, stringized annotations, which is enabled byfrom __future__ import annotations
, can't be parsed.After debugging, the problem can be traced down to #L334, where
getattr(cls_or_func, "__annotations__", {})
returns a dictionary of type annotation strings. It can be replaced by a helper functiontyping.get_type_hints(cls_or_func, include_extras=True)
to correctly evaluate the type back from its string form. The flaginclude_extras
is set toTrue
to correctly deal with theAnnotated
type.To Reproduce
Steps to reproduce the behavior:
Expected behavior
The type should be correctly recognized.
The text was updated successfully, but these errors were encountered: