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
Now that .spawn() is type-aware via this PR, outputs = modal.functions.gather(*[my_function.spawn(job) for job in jobs]) is accepted by type-checkers, and since .spawn returns a generic FunctionCall[R] (where my_function returns R), it should be possible for outputs to be type-checked to the return type of my_function without any additional annotations.
making my IDE the only IDE that knows the type of gather(*fn_calls), which is nice (the annotation may be a bit wrong idk).
I'm not sure how y'all generate your .pyi files but maybe you could have a build step that edits them to match the true behavior; the modal SDK annotations seem to be overly pessimistic/broad.
The text was updated successfully, but these errors were encountered:
Now that
.spawn()
is type-aware via this PR,outputs = modal.functions.gather(*[my_function.spawn(job) for job in jobs])
is accepted by type-checkers, and since.spawn
returns a genericFunctionCall[R]
(wheremy_function
returnsR
), it should be possible foroutputs
to be type-checked to the return type ofmy_function
without any additional annotations.Would have to make the
gather
function generic.Note - I manually edit the generated
functions.pyi
in the Modal package to have this:making my IDE the only IDE that knows the type of
gather(*fn_calls)
, which is nice (the annotation may be a bit wrong idk).I'm not sure how y'all generate your
.pyi
files but maybe you could have a build step that edits them to match the true behavior; the modal SDK annotations seem to be overly pessimistic/broad.The text was updated successfully, but these errors were encountered: