-
Notifications
You must be signed in to change notification settings - Fork 40
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
Add types to modal_version and modal_utils #1374
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Auto-approved 👍. This diff qualified for automatic approval and doesn't need follow up review.
@@ -196,7 +196,7 @@ async def _stream_function_call_data( | |||
while True: | |||
req = api_pb2.FunctionCallGetDataRequest(function_call_id=function_call_id, last_index=last_index) | |||
try: | |||
async for chunk in unary_stream(stub_fn, req): | |||
async for chunk in unary_stream(stub_fn, req): # type: ignore[var-annotated] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@freider I'm a little puzzled why this now raises a mypy error, since unary_stream
returns AsyncIterator[_RecvType]
.
modal-client/modal_utils/grpc_utils.py
Line 205 in 83e90f2
) -> AsyncIterator[_RecvType]: |
Not sure why this isn't picked up in functions.py
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's due to --follow-imports=skip
, so the imported type isn't available (removing that flag, this error disappears but you get tons of errors in the imported files instead...). I wonder if there is a way to check a single file for type errors but still follow imports in order to get types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would prefer not to have unnecessary # type: ignore
s in places just because mypy can't properly traverse things. The only case I think we should need it is when a .py-file references a type that's only defined in the same file's .pyi
file, since I doubt we can get mypy to actually read both
6f0e8fa
to
158366c
Compare
I updated the repo to use |
Just merged #1403 so it should be straight-forward to take on typing fixes for additional files now if you want to :) |
@freider Thanks for the heavy lifting! I'm afraid I haven't gotten the chance to take a closer look at |
Describe your changes
This PR adds mypy types to
modal_version
andmodal_utils
, as per #1372.