-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
[evaluation] ci: Enable mypy #37615
Merged
Merged
[evaluation] ci: Enable mypy #37615
Conversation
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
github-actions
bot
added
the
Evaluation
Issues related to the client library for Azure AI Evaluation
label
Sep 27, 2024
kdestin
changed the title
[evaluation] ci: Enable mypy
[DO NOT MERGE][evaluation] ci: Enable mypy
Sep 27, 2024
API change check APIView has identified API level changes in this PR and created following API reviews. |
kdestin
force-pushed
the
evaluation/mypy/enable
branch
4 times, most recently
from
October 3, 2024 17:08
2e979f9
to
5897e7d
Compare
kdestin
changed the title
[DO NOT MERGE][evaluation] ci: Enable mypy
[evaluation] ci: Enable mypy
Oct 3, 2024
kdestin
force-pushed
the
evaluation/mypy/enable
branch
from
October 3, 2024 17:38
5897e7d
to
1475867
Compare
luigiw
approved these changes
Oct 3, 2024
… methods _http_utils.py extensively uses decorators to implement the "convenience" request methods (get, post, put, etc...) for {Async}HttpPipeline, since they all share a common underlying implementation. However neither decorator annotated its return type (the type of the decorated function). Initially this was because the accurate type couldn't be spelled using a `Callable`, and pylance still did a fine job providing intellisense. It turns out that it currently isn't possible to spell it with a callable typing.Protocol. Our decorator applies to a method, and mypy struggles with the removal of the `self` attribute that occurs when a method binds to an object (see python/mypy issue Azure#16200). This commit resolves this by making the implementation of the http pipelines more verbose, removing the decorators and unrolling the implementation to each convenience method. Using `Unpack[TypeDict]` to annotate kwargs makes this substantially more readable, but this causes mypy to complain if unknown keys are passed as kwargs (useful for request-specific pipeline configuration).
…nt Sized in _tracing.py
…Client,CodeClient] Despite having similar interfaces with compatible calling conventions, the fact that ProxyClient and CodeClient have different "run" types (ProxyRun and CodeRun) causes type errors when dealing with a client of type Union[ProxyClient,CodeRun]. Mypy must consider the case when the wrong run type is used for a given client, despite that not being possible in this function. Refactoring the relevant code into a function allows us to clarify to mypy that client and run types are used consistently.
Promptflow does reflection on type annotations, and only accepts a dataclass, typeddict, or string as return type annotation.
Promptflow does reflection on type annotations and only allows dict
Promptflow does reflection on param types and disallows TypedDicts
kdestin
force-pushed
the
evaluation/mypy/enable
branch
from
October 7, 2024 18:52
1475867
to
6d2ea8f
Compare
Resolves a bug where the function was capturing data from the other scope, but data wasn't changed to the approriate value until after the function call.
kdestin
force-pushed
the
evaluation/mypy/enable
branch
from
October 7, 2024 20:14
6d2ea8f
to
676b717
Compare
6 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request enables mypy in CI for azure-ai-evaluation and resolves outstanding type errors
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines