-
Notifications
You must be signed in to change notification settings - Fork 107
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
[BUG] Improve Type Hints on Python Model V2 #1161
Comments
Hi @baluyotraf thanks for update will update you soon |
It sounds like you're encountering an issue where your type checker (pyright) is failing when applied to the decorators in the Azure Functions Python Library (azure-functions-python-library). The problem seems to be with the type hint definitions on the decorators, specifically the use of the Callable type hint. The Callable type hint is not defined completely, which is causing issues with your type checker. One solution to this issue would be to update the type hint definitions on the decorators to be more specific. For example, instead of using Callable, you could use a more specific type hint such as Callable[[Arg1Type, Arg2Type], ReturnType]. This will give the type checker more information about the types of arguments and return values that the decorated function should have. Another way could be using new typing module introduced in python 3.10 called ParamSpec which is more specific, allowing more detailed function type hints. Another solution would be to configuring your type checker to be less strict. This may allow it to process the decorators as they are currently defined, but it may also make it less effective at catching type-related errors in your code. |
Yes. It looks like we're on the same page on the problem. AFAIK there's no way to override the To allow the type checking to pass through our pipelines, we just put I guess on our side, we would like to know if there's a nicer workaround on the issue, or if there are plans to update the typing in the python library. For now we are fine to just get by with the |
@vrdmr please comment on this |
@baluyotraf Hi baluyotraf, i submitted an PR addressing this issue, can you please take a look and let me know if you have any questions |
pr merged, changes will go in next release in Feb |
Yup no complains here. Thanks! |
Hello! We are playing around with the Python Model V2. We think it looks great, however the decorators fail when we apply our type checker (pyright on strict settings). Looks like the culprit is the type hint definitions on the decorators. The
Callable
type hint are not defined completely. For example:These can use the recommendation from pyright or using the newer ParamSpec for typing.
I can work on this if needed since it's pretty simple yet pretty impactful for us.
The text was updated successfully, but these errors were encountered: