-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Migration from v2.2 to v3 breaks mypy typing of my_flow.deploy()
#15275
Comments
Thanks for the bug report, @benjamincerigo! Also, huge thanks for sharing your MR; it was very helpful in understanding the issue! It looks like you're getting bit by some of the oddities of the Issues like these are why we plan to adjust our approach to sync and async utilities. You can read more and comment on the proposed approach in #15008. Back to your setup, I can suggest one adjustment that might help. You can use the |
@desertaxle thanks for the quick response and great suggestion. I will definitely refactor the implementation to use To clarify from my experiments mypy's typing for prefect it would seem that all functions in prefect that use |
Yeah, typing on I like your idea of adding a note to the docstring for |
A quick fix for the issue: PrefectHQ#15275
I would vote for explicit sync and async interfaces. In my opinion, transparency around async code makes this easier. MR is open :) but it does seem to be failing for reasons that seem unrelated to the changes I made :(. |
A quick fix for the issue: PrefectHQ#15275
Bug summary
After migrating from v2.2 to v3 there is an error for mypy due to the typing of the return of
my_flow.deploy(...)
.It would seem that the mypy has changed how it types the return value of
some_flow.deploy(...)
between prefect v2.2 and v3. In v2.2 it is being typed asCoroutine
and in v3 is being typed asUUID
.Here is the MR for an open-source project that uses prefect that makes the version update.
Error out CI: "Incompatible return value type (got "list[UUID]", expected "list[Coroutine[Any, Any, Any]]") [return-value]"
In the code base, we are running the deployment of flows in parallel. This is done by collecting the returns of
some_flow.deploy()
and then using them inawait asyncio.gather(deployment_coroutines)
. An example of thesome_flow.deploy(...)
and the example ofasyncio.gather(deployment_coroutines)
.My proposed solution to it is here. Could you recommend if this is the best option?
I also think that this is a breaking change and should be documented.
Version info (
prefect version
output)Additional context
No response
The text was updated successfully, but these errors were encountered: