Skip to content
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

Mypy is reporting incompatible type for flow after upgrading to 3.1.6 #16396

Open
dgarros opened this issue Dec 16, 2024 · 2 comments
Open

Mypy is reporting incompatible type for flow after upgrading to 3.1.6 #16396

dgarros opened this issue Dec 16, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@dgarros
Copy link

dgarros commented Dec 16, 2024

Bug summary

After upgrading to 3.1.6, mypy is reporting a lot of errors especially around @flow that are declared with name and flow_run_name
The issue is not present in 3.1.5 and it's not present if we remove name and flow_run_name from the @flow definition

Not sure if this is important but all our @flow are async

There are 2 types of errors
On the flow definition itself

backend/infrahub/computed_attribute/tasks.py:638: error: Argument 1 has
incompatible type "Callable[[str, str, str], Coroutine[Any, Any, None]]";
expected "Callable[[str, str, str], Never]"  [arg-type]
    @flow(
     ^

When we are calling the flow as a python function

backend/tests/integration/services/adapters/workflow/test_setup.py:14: error:
Incompatible types in "await" (actual type "None", expected type
"Awaitable[Any]")  [misc]
            await setup_task_manager()
            ^~~~~~~~~~~~~~~~~~~~~~~~~~

Here is how the flow definition looks like

@flow(
    name="query-computed-attribute-transform-targets",
    flow_run_name="Query for potential targets of computed attributes for {node_kind}",
)
async def query_transform_targets(

Version info

prefect version
Version:             3.1.6
API version:         0.8.4
Python version:      3.12.7
Git commit:          6bfce9e8
Built:               Wed, Dec 11, 2024 10:46 AM
OS/Arch:             darwin/arm64
Profile:             default
Server type:         server
Pydantic version:    2.7.2

Additional context

No response

@dgarros dgarros added the bug Something isn't working label Dec 16, 2024
@zzstoatzz
Copy link
Collaborator

hi @dgarros - thank you for the issue! we've been making a lot of typing changes related to #16292. we'll take a look at this

@peku33
Copy link

peku33 commented Dec 16, 2024

Can confirm this in my project. Hundreds of typing errors after updating to 3.1.6.

  • serve() won't accept async deployments
  • @flow won't accept async functions
  • asyncio.gather won't accept async (sub)flows
  • won't accept awaiting async tasks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants